Jump to content
×
×
  • Create New...
  • 0

[Help]Anti EXP button


Aurora

Question

Hello everybody!

Today i'm trying to add a Anti EXP button but when i click on the button nothing happens?

Here is the code that i have

Game.py

			#AntiEXP
			"AntiEXP"				: self.__MakeAntiEXP,
			
	def __MakeAntiEXP(self, qid):
		constInfo.AntiEXPqin= int(qid)

uiinventory

			self.wndMoneySlot = self.GetChild("Money_Slot")
			self.AntiEXP = self.GetChild2("AntiEXP")			
			self.mallButton = self.GetChild2("MallButton")
			
		# MallButton
		if self.mallButton:
			self.mallButton.SetEvent(ui.__mem_func__(self.ClickMallButton))
			
		#AntiEXP
		if self.AntiEXP:
			self.AntiEXP.SetEvent(ui.__mem_func__(self.ClickAntiEXP))
			
	def ClickMallButton(self):
		print "click_mall_button"
		net.SendChatPacket("/click_mall")
		
	#AntiEXP
	def ClickAntiEXP(self):
		import event
		qid = constInfo.AntiEXPqin
		event.QuestButtonClick(qid)

	# DSSButton
	def ClickDSSButton(self):
		print "click_dss_button"
		self.interface.ToggleDragonSoulWindow()
		

Costinfo.py

AntiEXPqin = 0

I hope someone can help me here is a screen from the inventory

Screen: http://prntscr.com/7j4hd8

Kind regards

- Aurora

  • Love 1
Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

Here is the quest

quest antiexp begin
    state start begin
        when login begin
            if pc.getqf("antiexp") == 1 then
                pc.block_exp()
                chat("Anti EXP is already enabled")
            end
        end
        when letter begin
            cmdchat("AntiEXP "..q.getcurrentquestindex())
        end
		when button or info begin
            if pc.getqf("antiexp") == 0 then
                pc.block_exp()
                pc.setqf("antiexp", 1)
                chat("Anti EXP has been activated")
            elseif pc.getqf("antiexp") == 1 then
                pc.unblock_exp()
                pc.setqf("antiexp", 0)
                chat("Anti EXP has been disabled")
            end
        end
    end
end

 

Link to comment
Share on other sites

  • 0
Open game.py

add in 	def __ServerCommand_Build(self):
		serverCommandList={


			"antiexp"				: self.__antiexp,	
			
then add below function:

	# System Anti Exp - Start
	def __antiexp(self, qid):
		constInfo.antiexp= int(qid)
	# System Anti Exp - End	
	
Add in constinfo.py:

antiexp = 0

Open uiinventory and search function:

self.DSSButton = self.GetChild2("DSSButton") and add below:

			self.VegaS_button_Exp = self.GetChild2("VegaS_button_Exp")
			
search function:

self.DSSButton.SetEvent(ui.__mem_func__(self.ClickDSSButton)) and add below:

		## Button Anti-Experienta
		if self.VegaS_button_Exp:
			self.VegaS_button_Exp.SetEvent(ui.__mem_func__(self.ClickVegaS_button_Exp))	
			
			
Then add the function below:

###Button anti-experienta###		
	def ClickVegaS_button_Exp(self):
		import event
		qid = constInfo.antiexp
		event.QuestButtonClick(qid)	
		
Importing the module event earlier in uiinventory.

Inventorywindow add :

               {
                    "name" : "VegaS_button_Exp",
                    "type" : "button",
                    
                    "x" : your details,
                    "y" : your details,
					
					"tooltip_text" : "Anti-ExP",
                    
					"default_image" : "you images",
					"over_image" : "you imagesa",
					"down_image" : "you images",
                },
		
		
And this quest:

quest anti_exp begin
    state start begin
		when letter begin
            cmdchat("antiexp "..q.getcurrentquestindex())
        end
		when button or info begin
		if pc.getqf("antiexp") == 0 then
			pc.setqf("antiexp", 1)
			chat("[System Anti_Experience] - Activated] Experience points will be reset to 0 every second!")
            local ep = pc.get_exp()
            pc.give_exp2(-ep)
			timer("vegas", 1)
		elseif pc.getqf("antiexp") == 1 then
			pc.setqf("antiexp", 0)
			chat("[System Anti_Experience] - Disabled] I've now receive experience points again!")
			end
		end	
					
		when vegas.timer with pc.getqf("antiexp") == 1 begin
			local ep = pc.get_exp()
            pc.give_exp2(-ep)
			timer("vegas1", 1)
			pc.setqf("antiexp", 1)
		end	
			
		when vegas1.timer with pc.getqf("antiexp") == 1 begin
			local ep = pc.get_exp()
            pc.give_exp2(-ep)
			timer("vegas", 1)
			pc.setqf("antiexp", 1)
		end
		
		when login with pc.getqf("antiexp") == 1 begin
			chat("[System Anti_Experience] - Activated]")
			local ep = pc.get_exp()
			pc.give_exp2(-ep)
			timer("vegas", 1)
			pc.setqf("antiexp", 1)
		end
	
		when login with pc.getqf("antiexp") == 0 begin
			chat("[System Anti_Experience] - It is not enabled!]")
		end
	end
end

 

Edited by VegaS
Link to comment
Share on other sites

  • 0
Open game.py

add in 	def __ServerCommand_Build(self):
		serverCommandList={


			"antiexp"				: self.__antiexp,	
			
then add below function:

	# System Anti Exp - Start
	def __antiexp(self, qid):
		constInfo.antiexp= int(qid)
	# System Anti Exp - End	
	
Add in constinfo.py:

antiexp = 0

Open uiinventory and search function:

self.DSSButton = self.GetChild2("DSSButton") and add below:

			self.VegaS_button_Exp = self.GetChild2("VegaS_button_Exp")
			
search function:

self.DSSButton.SetEvent(ui.__mem_func__(self.ClickDSSButton)) and add below:

		## Button Anti-Experienta
		if self.VegaS_button_Exp:
			self.VegaS_button_Exp.SetEvent(ui.__mem_func__(self.ClickVegaS_button_Exp))	
			
			
Then add the function below:

###Button anti-experienta###		
	def ClickVegaS_button_Exp(self):
		import event
		qid = constInfo.antiexp
		event.QuestButtonClick(qid)	
		
Importing the module event earlier in uiinventory.

Inventorywindow add :

               {
                    "name" : "VegaS_button_Exp",
                    "type" : "button",
                    
                    "x" : your details,
                    "y" : your details,
					
					"tooltip_text" : "Anti-ExP",
                    
					"default_image" : "you images",
					"over_image" : "you imagesa",
					"down_image" : "you images",
                },
		
		
And this quest:

quest anti_exp begin
    state start begin
		when letter begin
            cmdchat("antiexp "..q.getcurrentquestindex())
        end
		when button or info begin
		if pc.getqf("antiexp") == 0 then
			pc.setqf("antiexp", 1)
			chat("[System Anti_Experience] - Activated] Experience points will be reset to 0 every second!")
            local ep = pc.get_exp()
            pc.give_exp2(-ep)
			timer("vegas", 1)
		elseif pc.getqf("antiexp") == 1 then
			pc.setqf("antiexp", 0)
			chat("[System Anti_Experience] - Disabled] I've now receive experience points again!")
			end
		end	
					
		when vegas.timer with pc.getqf("antiexp") == 1 begin
			local ep = pc.get_exp()
            pc.give_exp2(-ep)
			timer("vegas1", 1)
			pc.setqf("antiexp", 1)
		end	
			
		when vegas1.timer with pc.getqf("antiexp") == 1 begin
			local ep = pc.get_exp()
            pc.give_exp2(-ep)
			timer("vegas", 1)
			pc.setqf("antiexp", 1)
		end
		
		when login with pc.getqf("antiexp") == 1 begin
			chat("[System Anti_Experience] - Activated]")
			local ep = pc.get_exp()
			pc.give_exp2(-ep)
			timer("vegas", 1)
			pc.setqf("antiexp", 1)
		end
	
		when login with pc.getqf("antiexp") == 0 begin
			chat("[System Anti_Experience] - It is not enabled!]")
		end
	end
end

 

​It didn't work?

  • Love 1
Link to comment
Share on other sites

  • 0
On 20.6.2015 at 16:27, VegaS said:
Open game.py

add in 	def __ServerCommand_Build(self):
		serverCommandList={


			"antiexp"				: self.__antiexp,	
			
then add below function:

	# System Anti Exp - Start
	def __antiexp(self, qid):
		constInfo.antiexp= int(qid)
	# System Anti Exp - End	
	
Add in constinfo.py:

antiexp = 0

Open uiinventory and search function:

self.DSSButton = self.GetChild2("DSSButton") and add below:

			self.VegaS_button_Exp = self.GetChild2("VegaS_button_Exp")
			
search function:

self.DSSButton.SetEvent(ui.__mem_func__(self.ClickDSSButton)) and add below:

		## Button Anti-Experienta
		if self.VegaS_button_Exp:
			self.VegaS_button_Exp.SetEvent(ui.__mem_func__(self.ClickVegaS_button_Exp))	
			
			
Then add the function below:

###Button anti-experienta###		
	def ClickVegaS_button_Exp(self):
		import event
		qid = constInfo.antiexp
		event.QuestButtonClick(qid)	
		
Importing the module event earlier in uiinventory.

Inventorywindow add :

               {
                    "name" : "VegaS_button_Exp",
                    "type" : "button",
                    
                    "x" : your details,
                    "y" : your details,
					
					"tooltip_text" : "Anti-ExP",
                    
					"default_image" : "you images",
					"over_image" : "you imagesa",
					"down_image" : "you images",
                },
		
		
And this quest:

quest anti_exp begin
    state start begin
		when letter begin
            cmdchat("antiexp "..q.getcurrentquestindex())
        end
		when button or info begin
		if pc.getqf("antiexp") == 0 then
			pc.setqf("antiexp", 1)
			chat("[System Anti_Experience] - Activated] Experience points will be reset to 0 every second!")
            local ep = pc.get_exp()
            pc.give_exp2(-ep)
			timer("vegas", 1)
		elseif pc.getqf("antiexp") == 1 then
			pc.setqf("antiexp", 0)
			chat("[System Anti_Experience] - Disabled] I've now receive experience points again!")
			end
		end	
					
		when vegas.timer with pc.getqf("antiexp") == 1 begin
			local ep = pc.get_exp()
            pc.give_exp2(-ep)
			timer("vegas1", 1)
			pc.setqf("antiexp", 1)
		end	
			
		when vegas1.timer with pc.getqf("antiexp") == 1 begin
			local ep = pc.get_exp()
            pc.give_exp2(-ep)
			timer("vegas", 1)
			pc.setqf("antiexp", 1)
		end
		
		when login with pc.getqf("antiexp") == 1 begin
			chat("[System Anti_Experience] - Activated]")
			local ep = pc.get_exp()
			pc.give_exp2(-ep)
			timer("vegas", 1)
			pc.setqf("antiexp", 1)
		end
	
		when login with pc.getqf("antiexp") == 0 begin
			chat("[System Anti_Experience] - It is not enabled!]")
		end
	end
end

 

0208 10:05:38079 ::   File "ui.py", line 1395, in CallEvent

0208 10:05:38079 :: TypeError
0208 10:05:38079 :: : 
0208 10:05:38079 :: __antiexp() takes exactly 2 arguments (1 given)
0208 10:05:38079 :: 

Link to comment
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


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.