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 


How to use checkbox to enable script?

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

Joined: 28 Jun 2010
Posts: 662

PostPosted: Wed Mar 07, 2012 1:17 pm    Post subject: How to use checkbox to enable script? Reply with quote

Code:
function CECheckbox1Click(sender)
         if checkbox_getState(checkbox) == 1 then
            local memrec=memoryrecord_getID(memrec1)
            local isActive=memoryrecord_isActive(memrec)
            cheatcomponent_setActive(CETrainer_CECheckbox1, isActive)
            if gBeepOnAction then
             beep()
            end
   end
end

addresslist=getAddressList()
memrec1=addresslist_getMemoryRecordByID(addresslist,1)


CECheckbox1Click(CECheckbox1)

I want to enable my script if someone checks the checkbox.

I get access violation.
Back to top
View user's profile Send private message Send e-mail
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25296
Location: The netherlands

PostPosted: Wed Mar 07, 2012 2:26 pm    Post subject: Reply with quote

I'm assuming you're trying to use the checkbox of a Cheat component that the automated trainer generator creates for you.

In that case, check this:
http://forum.cheatengine.org/viewtopic.php?t=537515

Once you get the checkbox you can use checkbox_ specific functions on it, like checkbox_onChange(cb, CheckboxStateChangefunction)

note that the checkbox of a "Cheat" component is linked to the Active property so watch for infinite loops

---
alternatively, instead of making use of the old generic ce 5.x CheatList object create your own gui instead with a checkbox that you place and control yourself

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN 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