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 


Please Help setCaption Button ON-OFF

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater
Reputation: 17

Joined: 10 Apr 2015
Posts: 602

PostPosted: Mon Jan 08, 2018 7:23 pm    Post subject: Reply with quote

from this threat : http://forum.cheatengine.org/viewtopic.php?p=5648583

Code:
x=0                               --define a variable and set it to 0 (call it whatever you like, 'x' is just an example)
function CEButton1Click(sender)   --this is the function that gets called when you press the button 'CEButton1'
  if(x==0)then                    --check if the variable is equal to 0
    --something                   --place your code here (whatever you want to happen if the button is pressed for the first time)
    x=1                           --set the variable to 1 so that next time the button is pressed something else happens
  else                            --if the variable wasn't equal to 0 in the first place
    --something else              --place your code here (whatever you want to happen when the button is pressed for the second time)
    x=0                           --set the variable back to 0 so that next time the button is pressed your first code is executed again
  end                             --end of 'if'
end                               --end of the button



so,

Code:
gButtonOnW = 0

function CEButton1Click(sender)
  addresslist=getAddressList()
if (gButtonOnW ==0) then
control_setCaption(UDF1_CEButton1, "OFF")
local memrec=addresslist_getMemoryRecordByDescription(getAddressList(), "Hack1")
memoryrecord_unfreeze(memrec)
gButtonOnW = 1
else
-- control_setCaption(UDF1_CEButton1, "Wait")
-- gButtonOnW=true
local memrec=addresslist_getMemoryRecordByDescription(getAddressList(), "Hack1")
memoryrecord_freeze(memrec)
control_setCaption(UDF1_CEButton1, "ON")
gButtononW = 0
    end
end

_________________
Singapore Sling + Johnnie Walker + Some Peanuts....
Back to top
View user's profile Send private message
samy_grecu
!BEWARE! Deletes post on answer
Reputation: 0

Joined: 30 Dec 2016
Posts: 12
Location: Italy

PostPosted: Tue Jan 09, 2018 12:18 pm    Post subject: Reply with quote

Thank you
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
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