Jump to content

How to add new button function


Recommended Posts

Hi, i have a problem with add function to button.

I would like to add AFK system to this button.

 

Here i given the code, what i doing wrong?

 

inventorywindow:

			...
                        "name" : "AfkButton",
			"type" : "button",
                        ...

there is all ok because i see button in game and i can click on it

 

uiinventory:

		self.afkButton = None	


		self.afkButton.SetEvent(ui.__mem_func__(self.ClickAfkButton))

                self.afkButton.SetEvent(ui.__mem_func__(self.ClickAfkButton))

		def ClickAfkButton(self):
			event.QuestButtonClick(constInfo.AFK_BUTTON)

i add this functions under my functions from other buttons

 

 

constInfo:

AFK_BUTTON = 0

game.py

			"afk"			: self.__openAfk,



	def __openAfk(self, id):
		constInfo.AFK_BUTTON = int(id)
		if constInfo.AFK_BUTTON == 0:
			constInfo.AFK_BUTTON = 1
			self.PopupMessage("AFK active")
		elif constInfo.AFK_BUTTON == 1:
			constInfo.AFK_BUTTON = 0
			self.PopupMessage("AFK deactived")

What i doing wrong? Thanks for help!

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.