View unanswered posts | View active topics It is currently Fri Dec 27, 2024 8:12 am



Reply to topic  [ 9 posts ] 
 Lua errors, but script working? 
Author Message
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: Lua errors, but script working?
Use self.RightTimer:Reset() and self.RightTimer:ElapsedSimS instead of numbers. Timers don't work like that.


Mon Feb 28, 2011 6:03 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: Lua errors, but script working?
Yes. That translates as "if it has been more than 10 seconds".

You can also use MS for milliseconds, should you need it.


Mon Feb 28, 2011 6:33 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: Lua errors, but script working?
Sorry, ElapsedSimTimeMS.


Mon Feb 28, 2011 6:50 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: Lua errors, but script working?
Sorry, I'm off form today. It's self.RightTimer.ElapsedSimTimeMS


Mon Feb 28, 2011 7:10 pm
Profile

Joined: Fri Feb 25, 2011 3:52 pm
Posts: 39
Reply with quote
Post Re: Lua errors, but script working?
GlobalAccS*c*alar should work)


Tue Mar 01, 2011 2:13 pm
Profile
DRL Developer
DRL Developer

Joined: Tue Aug 11, 2009 5:09 am
Posts: 395
Reply with quote
Post Re: Lua errors, but script working?
Nonsequitorian wrote:
Thanks man.
Code:
self.Vel.Y = self.Vel.Y - (SceneMan.GlobalAccSalar * TimerMan.DeltaTimeSecs);

The key to figuring out Lua scripting for CC is reading the documentation.

The correct use in this case would be SceneMan.GlobalAcc.Y


Tue Mar 01, 2011 8:22 pm
Profile
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post Re: Lua errors, but script working?
Velocity isn't a scalar, but a vector. You'd need to do something like
Self.Velocity:SetMagnitude(Self.Velocity.Magnitude - 0.1)
or whatever the actual syntax is.


Wed Mar 02, 2011 5:36 am
Profile WWW
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: Lua errors, but script working?
You have to type out "0.9". Otherwise, it thinks you're trying to access an object's member.


Thu Mar 03, 2011 12:16 am
Profile WWW
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: Lua errors, but script working?
It happens in the order that you've written it out. The velocity will be multiplied by 0.9, then its y-component will be decreased by the value of gravity times the delta time.


Thu Mar 03, 2011 1:10 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 9 posts ] 

Who is online

Users browsing this forum: No registered users


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 post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.044s | 14 Queries | GZIP : Off ]