Data Realms Fan Forums
http://45.55.195.193/

Lua errors, but script working?
http://45.55.195.193/viewtopic.php?f=73&t=21610
Page 1 of 1

Author:  Roast Veg [ Mon Feb 28, 2011 6:03 pm ]
Post subject:  Re: Lua errors, but script working?

Use self.RightTimer:Reset() and self.RightTimer:ElapsedSimS instead of numbers. Timers don't work like that.

Author:  Roast Veg [ Mon Feb 28, 2011 6:33 pm ]
Post subject:  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.

Author:  Roast Veg [ Mon Feb 28, 2011 6:50 pm ]
Post subject:  Re: Lua errors, but script working?

Sorry, ElapsedSimTimeMS.

Author:  Roast Veg [ Mon Feb 28, 2011 7:10 pm ]
Post subject:  Re: Lua errors, but script working?

Sorry, I'm off form today. It's self.RightTimer.ElapsedSimTimeMS

Author:  zoidberg [ Tue Mar 01, 2011 2:13 pm ]
Post subject:  Re: Lua errors, but script working?

GlobalAccS*c*alar should work)

Author:  Abdul Alhazred [ Tue Mar 01, 2011 8:22 pm ]
Post subject:  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

Author:  411570N3 [ Wed Mar 02, 2011 5:36 am ]
Post subject:  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.

Author:  TheLastBanana [ Thu Mar 03, 2011 12:16 am ]
Post subject:  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.

Author:  TheLastBanana [ Thu Mar 03, 2011 1:10 am ]
Post subject:  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.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/