Jump to content

game.py+interfacemodule


Recommended Posts

Boas, estou a ter uma guerra enorme aqui a uns dias.

 

no game.py eu tenho esta função: 

Hidden Content

    Give reaction or reply to this topic to see the hidden content.

 

e no file interfacemodule.py esta:

Hidden Content

    Give reaction or reply to this topic to see the hidden content.

 

Como é que raio, eu faço no interface module, para ir fazer a função __FazerTestes do game.py?

Link to post
Share on other sites
Guest Ezrekith

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! :D 
Good luck.

Edited by Ezrekith
Link to post
Share on other sites
Guest Ezrekith

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 by Ezrekith
Link to post
Share on other sites

@Forgotten no xD   this is not what i need.

 

in Game.py i have this:

Hidden Content

    Give reaction or reply to this topic to see the hidden content.

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

Hidden Content

    Give reaction or reply to this topic to see the hidden content.

Sorry for my english!

Edited by Aeglon
Link to post
Share on other sites
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 post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...