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 


Lua Script Erorr

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

Joined: 01 Jan 2020
Posts: 1

PostPosted: Wed Jan 01, 2020 3:31 pm    Post subject: Lua Script Erorr Reply with quote

Hello im making a script for Trainer hack in Spscific game and i want to know why is this error is appearing and how can i fix it ?
Thanks



ssforce.png
 Description:
 Filesize:  25.55 KB
 Viewed:  2119 Time(s)

ssforce.png


Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4711

PostPosted: Wed Jan 01, 2020 5:01 pm    Post subject: Reply with quote

You're missing an "end" somewhere. Indenting your code will help you find where to put it.
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
.lua
Expert Cheater
Reputation: 1

Joined: 13 Sep 2018
Posts: 203

PostPosted: Wed Jan 01, 2020 11:49 pm    Post subject: Reply with quote

Line 129 should have one less end. It is better to indent the code to check whether the function is complete
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1532

PostPosted: Thu Jan 02, 2020 5:33 am    Post subject: Reply with quote

Brackets will solve the problem. Wink


autoAssemble([[code]])

or


function CECheckbox1Change(sender)
HackON=([[
[ENABLE]
Aobscan(_code1,28 1E B1 00 06 02 28 27 B1 00 06 16 6F 5D CF 00 06 2A)

_code1:
db 28 1E 1F 7D 06 02 28 27 B1 00 06 16 6F 5D CF 00 06 2A
[DISABLE]
]])

HackOFF=([[
[ENABLE]
Aobscan(_code2,28 1E 1F 7D 06 02 28 27 B1 00 06 16 6F 5D CF 00 06 2A)

_code2:
db 28 1E B1 00 06 02 28 27 B1 00 06 16 6F 5D CF 00 06 2A
[DISABLE]
]])

if sender.checked==true then
autoAssemble(HackON)
else
autoAssemble(HackOFF)
end
end

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4711

PostPosted: Thu Jan 02, 2020 11:06 am    Post subject: Reply with quote

It's fine to leave off the parenthesis if the function can take just one string parameter.
Code:
print"foo"
print[[bar]]


The "correct" way to disable a script in Lua is with disableinfo.
Code:
local script = [[
[ENABLE]
alloc(newmem,1024)
// ...

[DISABLE]
dealloc(newmem)
]]

-- Enable the script
local success, disableinfo = autoAssemble(script)
assert(success, "The script failed to activate.")

-- Disable the script.
success = autoAssemble(script, disableinfo)
assert(success, "The script failed to deactivate.")

_________________
I don't know where I'm going, but I'll figure it out when I get there.
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