Aeglon Posted November 7, 2017 at 11:09 AM Share Posted November 7, 2017 at 11:09 AM Boas, estou a ter uma guerra enorme aqui a uns dias. no game.py eu tenho esta função: def __FazerTestes(self, qid): constInfo.FazerTestesqin= int(qid) e no file interfacemodule.py esta: def testtesttesttest(self): (((aqui vai ter que fazer a função do game.py))) Como é que raio, eu faço no interface module, para ir fazer a função __FazerTestes do game.py? Link to comment Share on other sites More sharing options...
Aeglon Posted November 8, 2017 at 07:36 AM Author Share Posted November 8, 2017 at 07:36 AM any help? Link to comment Share on other sites More sharing options...
Guest Ezrekith Posted November 8, 2017 at 01:08 PM Share Posted November 8, 2017 at 01:08 PM (edited) Hi there! There are multiple ways to ask something from the game.py for example if you'd like to ask it from a quest you probably have a command func in your lua like: command("HI_IM_A_COMMAND") So you have to define this command in your game.py like: "HI_IM_A_COMMAND" : self._COMMAND_FUNC, #^This is the command ^This is the function of the command. So you have to define the function of the command: def _COMMAND_FUNC(self): constInfo.IS_IT_WORKING = "YES" In your constInfo file you have to declare the IS_IT_WORKING with the same mode Modes for constInfo: -the number oriental : IS_IT_WORKING = 0 -the word oriental : IS_IT_WORKING = " " So in my case i will write IS_IT_WORKING = " " After this, we have to set this into any function so this "YES" thing will be showed as a text for me right now, which looks like this: def mycommandfunction(self): self.mytext = ui.TextLine() self.mytext.SetParent(self) self.mytext.SetCenterPosition() self.mytext.SetText(constInfo.IS_IT_WORKING) self.mytext.Show() In your case the interfacemodule thing should be the same BUT if you'd like to set the testestest thing into a board i doN't recommand you to start with interfacemodule.py I hope you can understand everything and can use something from this to help out yourself on this war! Good luck. Edited November 8, 2017 at 01:22 PM by Ezrekith Link to comment Share on other sites More sharing options...
Aeglon Posted November 8, 2017 at 01:34 PM Author Share Posted November 8, 2017 at 01:34 PM @Forgotten i understand u well. But all i need is: to call this funcion "def _COMMAND_FUNC(self):" but in interfacemodule..py For what i need have to be in here. Link to comment Share on other sites More sharing options...
Guest Ezrekith Posted November 8, 2017 at 01:41 PM Share Posted November 8, 2017 at 01:41 PM (edited) Well you already set the command then so you just have to make a call on this: def __FazerTestes(self, qid): constInfo.FazerTestesqin= int(qid) Put a space before the '=' In your constinfo you have to set this: FazerTestesqin = 0 interfacemodule import constInfo (If you don't have) #And this is your function call: def mycommandfunction(self): self.mytext = ui.TextLine() self.mytext.SetPosition(300,300) self.mytext.SetText("This is my function result %d" % constInfo.FazerTestesqin) self.mytext.Show() You can add this to the python constructor (Which is the def __init__(self):) Edited November 8, 2017 at 01:43 PM by Ezrekith Link to comment Share on other sites More sharing options...
Aeglon Posted November 8, 2017 at 05:26 PM Author Share Posted November 8, 2017 at 05:26 PM (edited) @Forgotten no xD this is not what i need. in Game.py i have this: def __FazerTestes(self, qid): constInfo.FazerTestesqin= int(qid) and this function ___FazerTestes(self, qid): is working very fine. Until here, its all ok!! But, i need to call this function ___FazerTestes(self, qid): in interfacemodule.py. I dont know how to make it, but i know have to be something like this interfacemodule.py def testtesttesttest(self): self.game.__FazerTestes(): ///// But this way dont work Sorry for my english! Edited November 8, 2017 at 05:27 PM by Aeglon Link to comment Share on other sites More sharing options...
Guest Ezrekith Posted November 8, 2017 at 05:30 PM Share Posted November 8, 2017 at 05:30 PM You can't call the game with this: self.game.xy You have to call constInfo functions to get things from game.. xD Link to comment Share on other sites More sharing options...
Aeglon Posted November 8, 2017 at 05:32 PM Author Share Posted November 8, 2017 at 05:32 PM i know i can. I have 100% sure i can XD cuz i have it in my old server and it's a very very simple code line. But i cant remember, and i dont have my "old files" now Link to comment Share on other sites More sharing options...
GODSPEED Posted November 8, 2017 at 06:53 PM Share Posted November 8, 2017 at 06:53 PM 1 hora atrás, Aeglon disse: i know i can. I have 100% sure i can XD cuz i have it in my old server and it's a very very simple code line. But i cant remember, and i dont have my "old files" now tenta fazer : from game import function_do_game dps usas a tua função def funcaodointra(): function_do_game(5,5,59) Link to comment Share on other sites More sharing options...
Aeglon Posted November 8, 2017 at 10:36 PM Author Share Posted November 8, 2017 at 10:36 PM ainda não funciona, mas já deu para avançar mais qualquer coisa.... mas ainda não dá xD Obrigado na mesma. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now