Scripts / How to add duration to TextOnCenterXColor ?

Author
Message
Freakon
GameGuru TGC Backer
15
Years of Service
User Offline
Joined: 24th Feb 2009
Location: UK
Posted: 1st May 2017 11:26
The example of the code is:



Trying to get: TextCenterOnXColor to also have duration, but can't seem to find anything in global

Would it be as simple as adding it to global as:



or is there something more complex going on in the background that I am not aware of? If so, could someone please offer a small bit of help?
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 1st May 2017 12:19
As far as I know text doesn't have a duration, only prompts do, you would have to do it with a timer, I'm sure someone will be able to tell you how, I never could get timers to work.

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
Freakon
GameGuru TGC Backer
15
Years of Service
User Offline
Joined: 24th Feb 2009
Location: UK
Posted: 1st May 2017 12:28 Edited at: 1st May 2017 12:31
Thank Belidos, I was thinking narrowly! as I have dabbled with timers before! and absolutely that would do what I need, why I didn't think of this myself is beyond me, and thanks for kicking my brain in the right direction
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 1st May 2017 13:57
To handle time just set a time value and compare with g_Time: r.g. to make something happen after 1.3 seconds do this:

time_value = math.huge

-- set time (make sure only done once
time_value = g_tTime + 1300


-- check if expired
if g_Time > time_value then

-- do stuff here

-- 'cancel timer'
time_value = math.huge
end

If you check out my helicopter scripts I have done this using functions so it is more readable.





Been there, done that, got all the T-Shirts!
PM
Freakon
GameGuru TGC Backer
15
Years of Service
User Offline
Joined: 24th Feb 2009
Location: UK
Posted: 1st May 2017 16:24 Edited at: 1st May 2017 16:26
Thanks AM, I can't really get my head round this to be fair, but I would rather have a go at it, so I will come back in a few hours!

Also, there are 11 scripts for the helicopters hard to narrow it down, I just want text to display on the screen for 3 seconds in a specific location and color after picking up a weapon rather than the bland PromptDuration at the bottom..
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 1st May 2017 17:37
The main script is helicopter.lua, in it there are functions for two timers but in reality they just check g_Time against stored values as I've shown above.
Been there, done that, got all the T-Shirts!
PM

Login to post a reply

Server time is: 2024-12-23 06:00:50
Your offset time is: 2024-12-23 06:00:50