Well if it's a static value you can simply add a memory record for it and then freeze it (set the memory record's Active property to true in lua), the same can be said if the value you set it to is only rarely updated (just update the value of the memory record when the value you care about changes).
Since you want it to be done constantly here's a lua script that creates a timer that does the work, destroying itself (and thus stopping) if the script is disabled
Code:
{$lua}
[ENABLE]
-- if just a syntax check on save/load don't run the following code
if syntaxcheck then return end
local timer = createTimer()
timer.onTimer = function(timer)
-- check if the script is disabled
-- note there's probably a way to set a function to be called when the script is disabled but I don't know it off the top of my head lol
al = getAddressList()
mr = al.getMemoryRecordByDescription("Lua Auto Write")
if not mr.Active then timer.destroy() end
-- otherwise do the work
--writeInteger("[Tutorial-i386.exe+1FC5D0]+480", 333) -- tutorial test line
writeInteger("JohnnyMoves", 0x170 + (readInteger"JohnnyMoves+20" or 0))
end
timer.interval = 100 -- 100 milliseconds is 1/10 of a second
[DISABLE]
edit: "better" (?) lua using OnDeactivate event:
Code:
{$lua}
[ENABLE]
if syntaxcheck then return end
local timer = createTimer()
timer.onTimer = function(timer)
--writeInteger("[Tutorial-i386.exe+1FC5D0]+480", 333) -- tutorial test line
writeInteger("JohnnyMoves", 0x170 + (readInteger"JohnnyMoves+20" or 0))
end
local al = getAddressList()
local mr = al.getMemoryRecordByID(136)
mr.OnDeactivate = function(mr,before,cs)
-- if about to change state, return true to let it contine and deactivate
if before then return true end
-- otherwise state has changed so stop the timer
timer.destroy()
end
timer.interval = 100 -- 1/10 of a second
[DISABLE]
If you wanted an asm script then you could use createThread instead and write asm code to load the desired value and write it then sleep for a little while and repeat
code:
// load desired value
mov eax, [JohnnyMoves+20] // assumes JohnnyMoves is a registered symbol already
add eax, 170
// store desired value
mov [JohnnyMoves], eax
cmp byte ptr [codeDisable], 0
je loop // loop if script still enabled
ret // otherwise let the thread die/return
loop:
// wait 100 milliseconds
push #100 // note: mov into ecx for x64
call kernel32.sleep // returns only after time requested has elapsed
jmp code // loop
// byte to set when disabling script to let thread know it should die
codeDisable:
db 0
// register codeDisable as a symbol so it can be used in DISABLE section
// (note code needs to be registered for createThread to work but globalalloc does it for us)
registerSymbol(codeDisable)
createThread(code)
[DISABLE]
codeDisable:
db 1
unregisterSymbol(codeDisable)
Last edited by FreeER on Thu Mar 23, 2017 3:54 pm; edited 2 times in total
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