ddabrahim Posted June 24, 2014 Posted June 24, 2014 Hi, Sorry for the noob question but I really have no idea what am I doing wrong. I would like to check Inside an object Lua script If a specified Key is pressed then play a specified animation of the object but I always get "then" expected near "(" or "("expectd near ' or argument expected near "(" error message and I have no idea what am I doing wrong. I was looking for the answer in the documentation and in other Lua scripts but I just can't get it to work. This is the code I'm using function Script:UpdateWorld() if window:KeyDown(Key.W) then self.entity:SetAnimationFrame(Time:GetCurrent()/50.0,1,self.walk) end end Also tried many other ways such as KeyDown(Key.W) window:KeyDown(Key:W) Window:KeyDown(Key:W) KeyDown(Key:W) == true But nothing works Also tried using while loop instead of if statement but no luck. I was also watching the Lua script video tutorials on youtube but it using Leadwerks v2.3 and looks like scripting worked differently in that version as even that way I can't get it to work. I'm appreciate any help. Quote
Rick Posted June 24, 2014 Posted June 24, 2014 If inside an entity script you can do: App.window:KeyDown(Key.A) If inside App.lua self.window:KeyDown(Key.a) You were so close with many variations that you had If you want to get caught up quickly on Lua for LE you can schedule some 1 on 1 training via the link in my sig. Each 1 hour session is only $10 and I go through all of this stuff. I explain all of this stuff and you'll understand Lua for LE at a more lower level and why these things are the way they are. Quote
ddabrahim Posted June 24, 2014 Author Posted June 24, 2014 Thanks for your help, yes a training can be useful maybe I'm going to book an appointment with you sometime 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.