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 


noob help, how to access a table value from a script

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
moleeater
How do I cheat?
Reputation: 0

Joined: 28 Feb 2025
Posts: 4

PostPosted: Fri Feb 28, 2025 11:25 pm    Post subject: noob help, how to access a table value from a script Reply with quote

Hi, i am a beginner in Cheat Engine, i would like to allow the user to have a normal value in his cheat table, that he can edit freely, and i would like to have a script in this table, that can read the value of what the user has set, and use it in the script, edit it into the ram. I would not like to search for the pointer of the vanilla value in the ram, i would like to make my own value in the ram.

This is my current table, it is not working on clicking the checkbox:
Code:

    <CheatEntry>
      <Description>Camera FOV  --  enable</Description>
      <ID>6</ID>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>
        // ModuleCamera::UpdateCameraFXs
          // v101->camera_parameters.field_of_view = (float)((float)(v69 * 0.5) + 1.0) * 0.6981317007977318;
          // (this_02->camera_parameters).field_of_view = (fVar16 * 0.04 * 0.5 + 1.0) * 0.6981317;
        [ENABLE]
          globalalloc(camera_fov_value, 8)
            camera_fov_value:
              dd (double)0.6981317007977318
          aobscanmodule(vanilla_address6, prog.dll, ****************660F5AC0F30F118118060000C7456700000000488D5567E896753300F3410F10858000)
            registersymbol(vanilla_address6)
            alloc(modded_address6, 0x20, vanilla_address6)
            modded_address6:
              mulsd xmm0, [camera_fov_value]
              jmp vanilla_address6+8
            vanilla_address6:
              jmp modded_address6
        [DISABLE]
          vanilla_address6:
            db F2 0F 59 05 4A 4A 49 00
          unregistersymbol(vanilla_address6)
          dealloc(modded_address6)
      </AssemblerScript>
      <CheatEntries>
        <CheatEntry>
          <Description>Camera FOV  --  value</Description>
          <ID>7</ID>
          <VariableType>Double</VariableType>
          <Address>camera_fov_value</Address>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>

Am i using the CheatEntry correctly? Am i referencing it correctly? Where is the error? Please help me, thank you!
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Sat Mar 01, 2025 1:26 am    Post subject: Reply with quote

change
Code:

mulsd xmm0, [camera_fov_value]

to
Code:

push rax
mov rax,camera_fov_value
mulsd xmm0, [rax]
pop rax


or change
Code:

globalalloc(camera_fov_value, 8)

to
Code:

alloc(camera_fov_value,8,prog.dll)
registersymbol(camera_fov_value)

_________________
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
moleeater
How do I cheat?
Reputation: 0

Joined: 28 Feb 2025
Posts: 4

PostPosted: Sat Mar 01, 2025 4:10 am    Post subject: Reply with quote

Thank you for your help!

Another question, if i may hijack this thread, how do reference the value (not pointer) of a CheatEntry in {$asm} ?
Code:
mov dword ptr [r13+0x618], camera_fov_value
wrote in ram a different value. Do i need to put it into a register, like
Code:
              push rax
              mov rax, [camera_fov_value]
              mov dword ptr [r13+0x618], rax
              pop rax
?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4691

PostPosted: Sat Mar 01, 2025 12:33 pm    Post subject: Reply with quote

Use square brackets to access the memory at an address.

Most instructions can only access one memory address at a time. Memory-to-memory `mov` instructions aren't possible.

Use a register as you said, but use the right size for the data you're moving:
Code:
push rax                    // back up the entire 8-byte register
mov eax,[camera_fov_value]  // move 4 bytes
mov [r13+618],eax           // ^
pop rax                     // restore the entire register

_________________
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
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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