How do you check to see if a value of an address has changed?
-
- Novice Cheater
- Posts: 18
- Joined: Fri Feb 23, 2018 9:41 am
- Reputation: 2
How do you check to see if a value of an address has changed?
Let's say I want to have a function execute whenever a certain address value changes from one value to another(let's say address 0x80000000). I've tried setting readInteger("80000000") as a variable and then comparing it to itself, but that doesn't appear to work. How could I changing of an address via Lua?
Re: How do you check to see if a value of an address has changed?
Not real sure but some thing like this might work, and the synchronized thread part is only needed if you want to mess with stuff on the UI thread.
Code: Select all
{$lua}
------------------------------ ENABLE ------------------------------
[ENABLE]
local address = 0x80000000
local function synchronizedLuaThread(thread)
if RunLuaThread then
-- Body for UI code.
end
checkSynchronize()
if thread ~= nil and type(thread.terminate) == 'function' then
thread.terminate()
end
end
local function luaThread(thread)
while RunLuaThread do
if readInteger(address) ~= LuaThreadLastValue then
LuaThreadLastValue = readInteger(address)
-- Body for non-UI code.
synchronize(synchronizedLuaThread)
end
sleep(0)
end
thread.terminate()
end
----------------------------------
if syntaxcheck then return end
RunLuaThread = true
LuaThreadLastValue = readInteger(address)
createThread(luaThread)
------------------------------ DISABLE ------------------------------
[DISABLE]
if syntaxcheck then return end
RunLuaThread = false
LuaThreadLastValue = nil
-
- Novice Cheater
- Posts: 18
- Joined: Fri Feb 23, 2018 9:41 am
- Reputation: 2
Re: How do you check to see if a value of an address has changed?
Thanks for trying to help me, but I wasn't able to understand how to implement the above code. However, I ended up solving my issue anyways. I'd asked this because I needed to check whenever things in the game met a certain condition, and then set values based on that. I instead found an address that flags whenever the thing I wanted to record happened, and that was enough to do what I wanted. Thanks once again though!
Who is online
Users browsing this forum: No registered users