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 


script with pointer and offset

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

Joined: 26 Oct 2021
Posts: 31
Location: Earth

PostPosted: Tue Aug 30, 2022 1:01 pm    Post subject: script with pointer and offset Reply with quote

I also need help with setting up a scipt regarding pointers,

I have this pointer that points to a an address with a value that changes each time the game is booted up , now i need a script to hotkey toggle that value + 480 when hitting mouse button 4 and revert back to the original value when hitting mouse button 5, how would i go about doing this
Back to top
View user's profile Send private message
Kvist
How do I cheat?
Reputation: 0

Joined: 11 Aug 2022
Posts: 6

PostPosted: Tue Aug 30, 2022 2:24 pm    Post subject: Reply with quote

Edit: Removed the part of the answer that had literally nothing to do with the question

To toggle, you'd need an AA script somewhat like this

Code:

{$lua}
if syntaxcheck then return end

[ENABLE]
local record = AddressList.getMemoryRecordByDescription("My Value")
if record then
  original = record.NumberValue
  record:setValue(original + 480)
end


[DISABLE]
local record = AddressList.getMemoryRecordByDescription("My Value")
if record then
  record:setValue(original)
  original = nil -- not strictly necessary
end


The original value needs to be globally accessible in some way to have it available to both the enable and the disable section of the script. The record variable could also be moved out of the sections to the top and then be declared global if desired.

Then, for the hotkeys, I find it's best to set these through CE directly (press Ctrl+H with the script selected). However, if you want to do it in Lua:

Code:

local script = AddressList.getMemoryRecordByDescription("My Toggle")

if script and script.HotkeyCount == 0 then
  script.createHotkey({ VK_XBUTTON1 }, mrhActivate)
  script.createHotkey({ VK_XBUTTON2 }, mrhDeactivate)
end
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