View previous topic :: View next topic |
Author |
Message |
justanotherperson How do I cheat? Reputation: 0
Joined: 16 Nov 2022 Posts: 4
|
Posted: Wed Nov 16, 2022 3:03 am Post subject: Trying to get my LUA script in a pre-existing table |
|
|
I want to add my LUA script to a table so that it's toggle-able with the checkbox next to it, i.e. looks like this:
□ <MyScript>
I've gotten as far as trying to use the Auto Assemble menu to add it by doing this:
Code: |
[ENABLE]
{$Lua}
local timer = createTimer(getMainForm())
timer.Interval = 100
timer.OnTimer = function(timer)
Value=tonumber(AddressList.getMemoryRecordByDescription('Current Animation').Value)
if Value == 2006 or 2005 or 2004 or 2012 or 2010 or 2011 then
keyDown(0x51)
Sleep 100
keyUp (0x51)
end
[DISABLE]
{$Lua}
|
I'm clicking "Assign to current cheat table" but getting the follow error:
Lua error in the script at line 2:[string "local syntax check, memrec=......"]:
8: syntax error near '100'
The script works on its own if I just execute on startup but I want to be able to toggle it on and off and see it in the actual table as described above.
I'm probably missing something obvious but I've looked at the forums and can't figure it out myself.
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1055 Location: 0x90
|
Posted: Wed Nov 16, 2022 3:52 am Post subject: |
|
|
You were missing the parenthesis for the function Sleep().
Code: |
{$LUA}
if syntaxcheck then return end
-- Destroy the timer if it exists so you don't end up creating a timer several times
if timer then timer.destroy(); timer = nil end
timer = createTimer(getMainForm())
timer.Interval = 100
timer.OnTimer = function()
Value = AddressList.getMemoryRecordByDescription('Current Animation').Value
if (Value == '2006') or (Value == '2005') or (Value == '2004') or (Value == '2012') or (Value == '2010') or (Value == '2011') then
keyDown(0x51)
Sleep(100)
keyUp (0x51)
end
|
Also, no need to typecast here.
Edit: Sorry about the mistakes. I have updated my example to reflect the changes mentioned by DB.
Last edited by LeFiXER on Wed Nov 16, 2022 5:55 am; edited 1 time in total |
|
Back to top |
|
|
justanotherperson How do I cheat? Reputation: 0
Joined: 16 Nov 2022 Posts: 4
|
Posted: Wed Nov 16, 2022 4:03 am Post subject: |
|
|
Thanks for the reply but it's still showing an error:
Not all code is injectable.
(Lua error in the script at line 2: [string "local syntaxcheck, memrec=...
..."]:4: syntax error near ';')
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Wed Nov 16, 2022 4:56 am Post subject: |
|
|
try your code in lua engine with some test variables before putting it in a memoryrecord
that way you can also debug things and step through code
in your case for example replace timer.destroy; with timer.destroy()
also, you're missing the end of the function , so add an extra end
and the timer is declared as local, so the timer.destroy() won't be seen when the script is reactivated. Make it global (remove local)
and that if condition will always return true, use something like (Value == '2006') or (Value == '2007') or (Value == '2008') ....
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
|