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 can i use button to enable script? 6.1

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
zokz
Newbie cheater
Reputation: 0

Joined: 21 Aug 2011
Posts: 10

PostPosted: Fri May 25, 2012 10:14 pm    Post subject: how can i use button to enable script? 6.1 Reply with quote

how can i use button to enable script?

i want to make a trainer with a ON button that turn on the script
but i dont know how to add a button and use it

NOT HOTKEY
Back to top
View user's profile Send private message
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Sat May 26, 2012 2:28 am    Post subject: Reply with quote

If you want to code it in Lua.

Code:

openProcess([[Tutorial-i386.exe]])
local form = createForm( true );

local button = createButton(form)
control_setPosition(button, 100,100)
control_setCaption(button, [[Hack It!]])

control_onClick(button,func)

i = 0

function func()

if( i == 0 ) then

-- PUT YOUR AUTOASSEMBLE SCRIPT HERE (ENABLE SECTION)

        autoAssemble( [[alloc(newmem,2048) //2kb should be enough
label(returnhere)
label(originalcode)
label(exit)

newmem: //this is allocated memory, you have read,write,execute access
//place your code here

originalcode:
sub [ebx+00000464],eax
mov [ebx+00000464],#5000
exit:
jmp returnhere

"Tutorial-i386.exe"+2276B:
jmp newmem
nop
returnhere:]]
            );
    else

--DISABLE SCRIPT
        autoAssemble( [[dealloc(newmem)
"Tutorial-i386.exe"+2276B:
sub [ebx+00000464],eax
//Alt: db 29 83 64 04 00 00]]
            );
    end

i = (i +1)%2

return true
end


or If you want to toggle cheat script.

Code:
openProcess([[Tutorial-i386.exe]])
local form = createForm( true );

local button = createButton(form)
control_setPosition(button, 100,100)
control_setCaption(button, [[Hack It!]])

control_onClick(button,func)

i = 0
addresslist=getAddressList()
memrec=addresslist_getMemoryRecordByDescription(addresslist,[[Hack It!]])

function func()

if( i == 0 ) then

--ENABLE CHEAT SCRIPT

  memoryrecord_freeze(memrec)
else
--DISABLE CHEAT SCRIPT
    memoryrecord_unfreeze(memrec)
end

i = (i +1)%2

return true
end

_________________
Back to top
View user's profile Send private message Send e-mail
g4m3rxx
Newbie cheater
Reputation: 0

Joined: 13 May 2012
Posts: 19
Location: India

PostPosted: Sat May 26, 2012 10:17 am    Post subject: Reply with quote

This is the thing i want
thank u

But can I use single button for multiple AA??
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Sat May 26, 2012 10:25 am    Post subject: Reply with quote

yes, just add multiple autoAssemble calls in the function

also, disable scripts don't work well with the autoAssemble script (it won't free the memory)
for aa scripts that can toggle the script needs to be in a memory record and your script needs to set the entry to frozen/unfrozen instead

_________________
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