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 Timer Syntax Error

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

Joined: 06 Dec 2020
Posts: 2

PostPosted: Sun Dec 06, 2020 1:43 pm    Post subject: Lua Timer Syntax Error Reply with quote

Hello i'm semi new to Cheat Engine and started looking into LUA scripting a day or so ago. Alotugh i'm a bit over my head here i found a thread called
"send key inputs at specific pointer value" with code on how to send a button input when a pointer's value reaches a specific value. I copied this code and modified it to fit my own adress but i'm getting a syntax error i don't know how to deal with.

Code:
local timer = createTimer(getMainForm())
timer.Interval = 100
timer.OnTimer = function(timer)
value=tonumber(AddressList.getMemoryRecordByDescription('p2_attack_type').Value)
if Value == 1
then
keyDown(0x41)
Sleep 100
keyUp (0x41)
end





The error seems to be related to the KeyDown function but i can't really pinpoint what it wants, i'd love some pointers or resources on how to figure this out, thank you.



error.png
 Description:
 Filesize:  4.29 KB
 Viewed:  1332 Time(s)

error.png


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

Joined: 06 Jul 2014
Posts: 4719

PostPosted: Sun Dec 06, 2020 2:02 pm    Post subject: Reply with quote

Indent your code and you'll see the error.
_________________
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
yubiyoy
How do I cheat?
Reputation: 0

Joined: 06 Dec 2020
Posts: 2

PostPosted: Sun Dec 06, 2020 2:34 pm    Post subject: Reply with quote

ParkourPenguin wrote:
Indent your code and you'll see the error.


I can't belive i missed this, i feel like an idiot. Thank you.
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