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 


New to scripting, what is the problem with this sctipt?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Back2Storymode
How do I cheat?
Reputation: 0

Joined: 15 May 2021
Posts: 1

PostPosted: Sat May 15, 2021 2:35 am    Post subject: New to scripting, what is the problem with this sctipt? Reply with quote

I've been trying to convert an AutoAssembly script to a lua one, so that I could run it with the generic trainer from the generic trainer generator, upon inspection, it looks fine to me (I have extremelly poor coding skills, this is acually a thing I've been doing to learn) but whenever I try to run it I get an error that says: [string "{$lua}..."]:1: unexpected symbol near '{'
this has been bugging me a lot, even if that is deleted (whole first lines) everything seems to be unexpected, I am fully aware this has to do with my own inhability to work around these kinds of tools and that the mistake is mine, but I am too new to this to understand what went wrong. help is appreciated, this is the code:
Code:
 
{$lua}
if syntaxcheck then return end

[ENABLE]


scan = AOBScan("01 02 EB 10 DD 43 08")[0]
registerSymbol("roomcontrol",scan)

mem = allocatememory(0x1000)
registerSymbol("newmem",mem)


label(return)

newmem:
  add [edx],#-1
  jmp SPOOKY.exe+14CF5B
  fld qword ptr [ebx+08]
  jmp return

roomcontrol:
  jmp newmem
  nop 2
return:
autoAssemble([[
label(return)

newmem:
  add [edx],#-1
  jmp SPOOKY.exe+14CF5B
  fld qword ptr [ebx+08]
  jmp return

roomcontrol:
  jmp newmem
  nop 2
return:
]])

[DISABLE]
writeBytes(scan, 0x01, 0x02, 0xEB, 0x10, 0xDD, 0x43, 0x08)

unregisterSymbol("newmem")
unregisterSymbol("roomcontrol")

deAlloc(mem,0x1000)
scan = nil
mem = nil

Also, most codes from downloaded trainers tend to fail too, even if they worked once before, and the game hasn't had any updates for years, so it can't be a patch. I also verified that the trainers were using permanent adresses, which still work.

_________________
I am afraid of clowns
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 37

Joined: 24 Feb 2017
Posts: 794
Location: 'Merica

PostPosted: Sat May 15, 2021 6:38 am    Post subject: Reply with quote

Use "autoAssemble", you wont need to convert mutch and ASM runs faster so you'll get less lag.
https://wiki.cheatengine.org/index.php?title=Lua:autoAssemble

But ultimately the lua "AOBscan" returns a list not an address. Plus you still have ASM in the lua script.

_________________
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 Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
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