Posted: Mon Feb 19, 2018 2:13 am Post subject: loading a lua created symbol in asm
I know this doesn't belong in this forum but I couldn't find any related forums in the main forum index/table/whatever you call it, basically I've copied some aobscans from someone else's existing scripts into my lua script in the hopes that I can put all the table scripts into one script making it less confusing for others when I finally upload the completed table that includes my own additions and the converted originals. The addresses they give are fine (and apparently consistently spaced providing room for the more faster calculated addresses) and the registering of the symbols goes fine too but I don't know how to make the existing ASM scripts load them instead so that I can test their behavior remains the same _________________
Those who do not trust in christ to save them from their sins will only experience hell when their soul is released from it's earthly vessel.
You can memoize the result of an AOBScan like this:
Code:
local AOBScanMemo = setmetatable({},{__mode = 'kv'})
function AOBScanMemoized(...)
local aobstr = (...)
local t = AOBScanMemo[aobstr]
if t then return t end
local aobres = AOBScan(...)
t = {}
if aobres then
for i = 1, aobres.Count do
t[i] = getAddress(aobres[i-1])
end
aobres.destroy()
end
AOBScanMemo[aobstr] = t
return t
end
The return value from a {$lua} block is inserted into the script, so you can do something like this:
Code:
{$lua}
return ('define(aobresult,%08X)'):format(AOBScanMemoized('12 34 AB CD','+X-C-W')[1])
{$asm}
aobresult:
db 56 78
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Thanks, I'll give mgr.inz.Player's suggestion a try first tomorrow sometime, only just got back from work so can't be bothered tonight
Edit: Whoops forgot to pop back and mention that it didn't work out, despite the unedited asm working perfectly fine when I activate it CE reports some error further down in the script when I only add the line for copying the value of the symbol I wanted to try using and comment out the original line. No matter how many variations of asm_value = $lua_value or define(asm_value,$lua_value) or some other such variation CE reports an error in the pre-existing asm so now I'm just gonna examine each of the blocks pulled up and decide what I can use to replicate original behavior via lua (minus the asm modifications) _________________
Those who do not trust in christ to save them from their sins will only experience hell when their soul is released from it's earthly vessel.
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