Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Can I attach to the same code, two events?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 205

PostPosted: Fri Jul 06, 2018 3:04 pm    Post subject: Can I attach to the same code, two events? Reply with quote

Can I attach to the same code, two events. Because I do not want to write next code twice. For example: I want to read values with two events.
Event 1: UDF1.CEPanel4.OnClick = function(sender)
Event 2: UDF1.TabSheet4.OnShow = function(sender)
Code:
UDF1.CEPanel4.OnClick = function(sender)
UDF1.TabSheet4.OnShow = function(sender)

CEEditbattlepts.Text = bAnd(0xFFFF, readInteger(0x009E92C4))

  Editcbattlepts.Text = bAnd(0xFFFF, readInteger(0x009E91E4))

  fortcspeed.Text = readBytes(0x00A785F4)

  Attractionvalue.Text = readBytes(0x009E9217)
end
end


Is there any other solution to not write the code 2 times?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4706

PostPosted: Fri Jul 06, 2018 3:46 pm    Post subject: Reply with quote

Code:
local function dostuff()
  -- code
end
panel.OnClick = dostuff
tabsheet.OnShow = dostuff

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 205

PostPosted: Sat Jul 07, 2018 2:59 am    Post subject: Reply with quote

Thank you
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites