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 


Check the status of a checkbox inside of an assembly script?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
TPRammus
Advanced Cheater
Reputation: 0

Joined: 05 Jan 2016
Posts: 61
Location: Germany

PostPosted: Mon Jun 27, 2016 12:53 pm    Post subject: Check the status of a checkbox inside of an assembly script? Reply with quote

Hey!

I've found an instruction which has to do with all needs of an character (Food, Sleep, Cigarette and Food of his Animal). (The needs of an character are visually displayed as a bar)

I could just move #220 (the maximum) into [esi+18] but I want to make seperate checkboxes for every need. So what I did, is find instructions which are executed constantly and move 1 or 0 into [Sleep] (global allocated) for example (and autoAssemble it into a checkbox). That way, I can check if the (for example Sleep-) checkbox is activated or not. But the instructions that I've found doesnt get executed everytime constantly so its kinda messy.
Is there a better (cleaner) way to do this?

With my way, the 'master-script'(the script where I check if [Sleep] 1 is and where the actual cheat is) and the Sleep script(The script for the checkbox) (for example) has to be enabled.
These are my scripts.
'Master-Script':
Code:
  autoAssemble([[
    aobscanmodule(unlFood,cartlife.exe,89 46 18 8B 06 8B)
    alloc(newmem,$1000)
    globalalloc(FoodAnimal,4)
    globalalloc(Food,4)
    globalalloc(Sleep,4)
    globalalloc(Cigarette,4)
    registersymbol(unlFood)
    label(code)
    label(return)
    label(FoodAnimalLabel)
    label(FoodLabel)
    label(SleepLabel)
    label(CigaretteLabel)
    label(FillBar)
    label(normalcode)

    newmem:
    code:
    cmp [esi+28],(int)1650616683 //check if the address is the Food of the Animal
    je FoodAnimalLabel
    cmp [esi+28],(int)1635019126 //check if the address is Sleep
    je SleepLabel
    cmp [esi+28],(int)1920234862 //check if the address is Food
    je FoodLabel
    cmp [esi+28],(int)1717985635 //check if the address is Cigarette
    je CigaretteLabel
    jmp normalcode

    FoodAnimalLabel:
    cmp [FoodAnimal],1 //check if the checkbox for it is enabled
    je FillBar //jump to the cheat if it is
    jmp normalcode //jump to the normal code if its not
    FoodLabel:
    cmp [Food],1 //same
    je FillBar
    jmp normalcode
    SleepLabel:
    cmp [Sleep],1 //same
    je FillBar
    jmp normalcode
    CigaretteLabel:
    cmp [Cigarette],1 //same
    je FillBar
    jmp normalcode

    normalcode: //the normal code
    mov [esi+18],eax
    mov eax,[esi]
    jmp return
    FillBar: //the cheat
    mov [esi+18],(int)220
    mov eax,[esi]
    jmp return
    unlFood:
    jmp code
    return:
  ]])

Script for the checkbox Sleep:
Code:
  autoAssemble([[
    aobscanmodule(activateSleep,cartlife.exe,89 90 0C 02 00 00)
    alloc(newmem,$1000)
    registersymbol(activateSleep)
    label(code)
    label(return)
    globalalloc(FoodAnimal,4)
    globalalloc(Food,4)
    globalalloc(Sleep,4)
    globalalloc(Cigarette,4)

    newmem:
    code:
    mov [Sleep],1 //for the checkbox
      mov [eax+0000020C],edx //the normal code
      jmp return
    activateSleep:
      jmp code
      nop
    return:
  ]])
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Mon Jun 27, 2016 8:08 pm    Post subject: This post has 1 review(s) Reply with quote

Or...
Code:
writeInteger("Sleep",1)
Back to top
View user's profile Send private message
TPRammus
Advanced Cheater
Reputation: 0

Joined: 05 Jan 2016
Posts: 61
Location: Germany

PostPosted: Tue Jun 28, 2016 6:08 am    Post subject: Reply with quote

Zanzer wrote:
Or...
Code:
writeInteger("Sleep",1)

Wow I didnt know this is possible :o
So that would be like globalalloc+move?
If yes, just because I'm interested, can you dealloc Sleep after this?

Edit: Oh I guess it is without globalalloc. But this helps me so much! 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