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 set if statements to hotkeys?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
ParkourPenguin
I post too much
Reputation: 155

Joined: 06 Jul 2014
Posts: 4774

PostPosted: Sat Aug 26, 2017 8:49 pm    Post subject: Reply with quote

You have to execute the script again in order for the changes to take effect.
_________________
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
Hayjamieoliver
Newbie cheater
Reputation: 0

Joined: 29 Nov 2016
Posts: 16
Location: idk

PostPosted: Sat Aug 26, 2017 9:19 pm    Post subject: Reply with quote

I did that, it just does

Error:Failure determining what [[[337D5560+100]+B8]+658]+24 means

_________________
Smile
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 155

Joined: 06 Jul 2014
Posts: 4774

PostPosted: Sat Aug 26, 2017 9:48 pm    Post subject: Reply with quote

It works perfectly fine for me. Are you using the latest version of Cheat Engine? Are you sure the pointer path is correct? Take note that in the "change address" window (found by double clicking on the "address" field of a pointer in the address list), the offsets are listed last-to-first from top-down (i.e. the first offset is at the bottom).
_________________
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
Hayjamieoliver
Newbie cheater
Reputation: 0

Joined: 29 Nov 2016
Posts: 16
Location: idk

PostPosted: Sat Aug 26, 2017 11:22 pm    Post subject: Reply with quote

Whilst my cheat engine was outdated, being at version 6.5, this was not the issue. I ended up changing it slightly, like so:

Code:
if setAIHotkey then setAIHotkey.destroy(); setAIHotkey=nil end
if resetAIHotkey then resetAIHotkey.destroy(); resetAIHotkey=nil end

local changedAddresses = {}

setAIHotkey = createHotkey(function(hk)
  -- look for stuff to change
 -- local baseAddr = getAddress('[Insertgame.exe+02B47F58]')  -- now unused
  local playerVal = readInteger('[[[[[Insertgame.exe+02B5D718]+420]+450]+C0]+58]+24')

  print (playerVal)

for offs2 = 0x100, 0x1B0, 8 do  -- range is inclusive

  print("getting ai addresses")

  local baseAddr = getAddress('[Insertgame.exe+02B47F58]') --New declaring of base address, now with no offsets.

  print("base address finished")

  local aiAddr = getAddress(('[[[[%08X+%X]+%X]+%X]+%X]+%X'):format(baseAddr, 0x50, offs2, 0xB8, 0x658, 0x24))
  local aiVal = readInteger(aiAddr)
  print(aiVal)
  if aiVal ~= playerVal then
    writeInteger(aiAddr, playerVal)
    changedAddresses[#changedAddresses+1] = {addr = aiAddr, val = aiVal}
  end
end
end, VK_MENU, VK_F3)  -- change hotkey key codes here

resetAIHotkey = createHotkey(function(hk)
  for i = #changedAddresses, 1, -1 do
    writeInteger(changedAddresses[i].addr, changedAddresses[i].val)
    changedAddresses[i] = nil
  end
end, VK_MENU, VK_F5)  -- change hotkey key codes here


Moving the declaration of the base address into the for loop seems to have fixed all the issues. I'm not really sure what caused it, and this might be somewhat inefficient coding, but I'm not really concerned with either of those things as long as it works Smile



Thank you so, so much for all your help, I think this knowledge will be useful in many other ways as well Very Happy

_________________
Smile
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
Goto page Previous  1, 2
Page 2 of 2

 
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