Scripts / timer delay use return. end?

Author
Message
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 22nd May 2019 15:30
Hi people. I wanted to insert a timer delay into a script that simply
moves an object, reaches a point, waits a while, then continues to
move the object. This movement is ongoing through the level.
So I didn't want to mess up the game elsewhere.
Attempts to create a simple delay in the script has turned into a
complexity for some reason! lol

Can/ should I use the return. end call or might that work instead?
Thanks for any help.

-------- we check here for reach point and if so...
stoppoint[e] = 1 -------- point is reached
timecheck[e]= StartTimer(e)
end

if stoppoint[e] == 1 and GetTimer(e) > (timecheck[e] + 5000)) then
stoppoint[e] = 0
----- essentially continue with script
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 22nd May 2019 18:22
Don't think start timer returns a value so should probably look like this

----- essentially continue with script
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 22nd May 2019 20:03 Edited at: 22nd May 2019 20:04
All the StartTimer does is record the g_Time value in the g_Entity list .

All GetTimer does is return the differemce between g_Time and the stored value.

So you can just check g_Time yourself like this:


That example would simply wait 3 seconds before carrying on with the script when started.
In the 'do stuff' part simply set 'timer[ e] = nil' to trigger another 3 second wait.
Been there, done that, got all the T-Shirts!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 22nd May 2019 20:42
Aha! Okay, maybe that's it! Hope so. Will check soon,
but been filling out piles of paperwork for too much
federal job applications!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 23rd May 2019 05:53
Yes! Whew, what a day. Thanks guys.
Coming closer to gettin it.
PM

Login to post a reply

Server time is: 2024-04-26 13:06:13
Your offset time is: 2024-04-26 13:06:13