Scripts / GetTimer(e)

Author
Message
lordjulian
10
Years of Service
User Offline
Joined: 10th Jan 2014
Location:
Posted: 30th Apr 2016 02:30
This seems to be messed up. I get a starting value of around 4000000 upon starting a Test Mode level.
Julian
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 30th Apr 2016 04:43
I am remembering that Lee mentioned something about this in one of the last 8 or so twitch broadcasts.

I will have to search thru them. But try the script board. Mushroom fixed his, and smallg I am sure has it solved already.
You might just need to use the StartTimer(e) in a different spot to get it to reset, before you poll for your timer value to perform whatever action you want.

Script Guru's correct me please if I am of the wall here.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

lordjulian
10
Years of Service
User Offline
Joined: 10th Jan 2014
Location:
Posted: 30th Apr 2016 17:38
Thanks, Myke. I'll look into that.
Julian
PM
lordjulian
10
Years of Service
User Offline
Joined: 10th Jan 2014
Location:
Posted: 1st May 2016 00:34
I looked at SmallG's threat. I tried g_timer but that seems messed up too.
Julian
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 1st May 2016 03:23 Edited at: 1st May 2016 03:37
Looking thru the global.lua file I dont see a g_timer statement Just a global variable that reads the milliseconds the game has been started. What your looked at might have been a defined variable.

I am thinking that in the start of the main function of your script you could check the value of the GetTimer(e) and then if it is above zero, (a set of conditions to allow the script to continue) issue a StartTimer(e) statement again to reset it at that point to zero.

Then move on thru the script and see if you can get the timer display to read zero.

I will try a few of the scripts around for timer stuff and see what I can find. Maybe there is still a bug in it.
In this thread here:
https://forum.game-guru.com/thread/215060
Smallg shows possible ways to use this. reading the g_timer variable, setting a local in your script to reference that and reset your variable to zero there. This might need to be the very first thing done in the script. Last post, he made some global functions as an approach to this.

Go to this thread and test the snippets and see if you can make any headway with that. Maybe a few questions there will bring some of the coders around to giving more suggestions or a solution to your situation.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 1st May 2016 09:54
As mike said, you just need to call a variable once at the start of the main(e) loop like this

if game_timer_started == nil then
StartTimer(e)
game_timer_started = 1
end
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
lordjulian
10
Years of Service
User Offline
Joined: 10th Jan 2014
Location:
Posted: 1st May 2016 19:08
Thanks, smallG!
Julian
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 1st May 2016 21:41
Cool. I am going to move this to the script board, as this is a scripting issue and can get more attention there.

Thanks.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

Login to post a reply

Server time is: 2024-12-22 17:58:20
Your offset time is: 2024-12-22 17:58:20