The forum has been set to read-only mode. For community discussion and questions, head over to our Discord: https://discord.taleoftwowastelands.com

Help me understand negative timers

General mod discussion and requests.
Post Reply
H1ms3lf
Posts: 146
Joined: Tue Apr 11, 2017 8:44 pm

Help me understand negative timers

Post by H1ms3lf » Fri May 26, 2017 3:13 am



Okay, positive timers are pretty easy to figure out, but the scripts in the scenes I'm messing around with use negative timers, so help me understand those to avoid screwing what is already set up there =X




This is a simple timer, can someone convert it to instead use a - GetSecondsPassed instead of + ?

(BTW, what is the syntax to post script code? I tried a few but no success, gonna put in a quote)


[quote]


Begin GameMode


if CG03.turnincount >= 9 && timer > 6   ;reset timer so it can start counting


set timer to 0


elseif CG03.turnincount == 9 &&  timer > 5 ;after 5 seconds do this and reset the timer to avoid repetition until another 5 seconds have passed


Say CG03TurnInTestTopic


set timer to 0


else


set timer to timer + GetSecondsPassed


endif


end


[/quote]





Thanks very much!! =]


Compulsive post editor and CEO for the ENDLESS WAVES OF BAD DOGGIE!!

Currently trying to get the FWE Wasteland Explorer bike to work in TTW =X



User avatar
RoyBatty
Gary
Posts: 7742
Joined: Sun Apr 27, 2014 10:26 am
Location: Vault 108

[code]

Post by RoyBatty » Fri May 26, 2017 3:33 am


float ftimer

int doonce

int irun



Begin GameMode



    if doonce == 0

        set ftimer to 10

        set doonce to 1

    endif



    if irun = 0



        if fTimer < 5

            (do something)

        elseif fTimer < 2

            (do something)

        elseif fTimer < 0

            set irun to 1

        endif



        set fTimer to ftimer - GetSecondsPassed

    endif



End



Image

H1ms3lf
Posts: 146
Joined: Tue Apr 11, 2017 8:44 pm

Thanks!

Post by H1ms3lf » Fri May 26, 2017 3:37 am

Thanks!



Today is a holiday here, gonna get some work done on that little mod =)


Compulsive post editor and CEO for the ENDLESS WAVES OF BAD DOGGIE!!

Currently trying to get the FWE Wasteland Explorer bike to work in TTW =X



Post Reply