Jump to content
  • 0

How to add new button function


guy12

Question

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
  • Answers 1
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

1 answer to this question

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 account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • 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.