Discussion Best way to check if a timer is running?

D.V.D

Make a wish
I want to make a spell that uses a global timer instead of a separate timer for each spell casted which gets created and destroyed constantly. At the same time, I don't want the timer to run every 0.03 seconds if no spells were casted(may cause a bit of unneeded lag). So I wanted to use a boolean that is enabled when a spell is casted and disabled when no spells are being casted. When the boolean is set to false I want to Pause my timer but I have no clue of how to find out when to enable it again. I thought of maybe using events to detect when the boolean is false or something but Im afraid using another trigger would actually be worse than just having the timer constantly run. Anyone have any suggestions on how to do this?
 

Ashlebede

New Member
JASS:
if TimerGetElapsed(t)!=0 and TimerGetRemaining(t)!=0 then
//timer is started
else
//timer ain't started
endif


Try that. Maybe [ljass]PauseTimer()[/ljass] won't change the timer elapsed and remaining, since there is a [ljass]ResumeTimer()[/ljass] native, after all. So you could try this :

JASS:
//whenever the timer is started:
call TimerStart(t,timeout,true,function myFunc)
call SaveBoolean(udg_H,GetHandleId(t),0,true)
//whenever you pause it:
call PauseTimer(t)
call SaveBoolean(udg_H,GetHandleId(t),0,false)


You can check whether it is paused by loading those booleans.
 

Trollvottel

never aging title
I want to make a spell that uses a global timer instead of a separate timer for each spell casted which gets created and destroyed constantly. At the same time, I don't want the timer to run every 0.03 seconds if no spells were casted(may cause a bit of unneeded lag). So I wanted to use a boolean that is enabled when a spell is casted and disabled when no spells are being casted. When the boolean is set to false I want to Pause my timer but I have no clue of how to find out when to enable it again. I thought of maybe using events to detect when the boolean is false or something but Im afraid using another trigger would actually be worse than just having the timer constantly run. Anyone have any suggestions on how to do this?
just count an integer up when a spell is casted and down when it is finished. if it is 0 you can just pause it.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    that sucks
  • jonas jonas:
    @midnight8 how is it looking
  • midnight8 midnight8:
    meh, me, wife and her friend thaty traveled with us all have covid, seems to be winding down some for me at least. Felt like complete shit, been sleeping a lot, just bieng lazy as hell. I feel like that today has probably been like 11 or 12 days since exposure. Have not had any fever today, and have not taken any meds, so hopefully by monday or tuesday I will be good to go, sadly have passed it on to our teen son, I guess that was pretty much unavoidable
  • The Helper The Helper:
    hope you get to feeling better and get vaccinated my friend
  • midnight8 midnight8:
    I will at some point, but so many vaccinated people still getting it. One of the bands we watch in vegas, all 4 had been vaccinated and are now positive.
  • Ghan Ghan:
    Symptoms?
  • Ghan Ghan:
    I think the symptoms are typically less severe if previously vaccinated.
  • midnight8 midnight8:
    I have had all of the symptoms, taste is slightly starting to come back, but smell, no. Honestly, just been a little miserable, have never felt in any danger from it. Being trapped at home sucks. lol
  • midnight8 midnight8:
    meh, got a little fever again this morning, guess gonna be a few more days
  • The Helper The Helper:
    I went to Comicon this last weekend I hope I dont get it I feel fine and I am not vaccinated and did not wear a mask
  • The Helper The Helper:
    Comicon really was not packed though like it was in the past. I am not really worried though it was the most people I have been around in a year.
  • tom_mai78101 tom_mai78101:
    Still, getting vaccinated is a good idea. We're getting Delta variant spikes here in Boston.
  • The Helper The Helper:
    I am not against vaccination at all I just have a serious procrastination problem I plan on getting vaccinated soon
  • midnight8 midnight8:
    was kinda same with me, I was gonna do it, and life got in the way.
  • midnight8 midnight8:
    we wore mask in some places, but at 118 degrees outside, little rough. :)
  • The Helper The Helper:
    yeah i had another friend in Vegas talking about that heat damn
  • The Helper The Helper:
    Well I do not think I got Covid from the Comicon
    +1
  • tom_mai78101 tom_mai78101:
    Pushed out a new Pokemon Walking algorithm build. With a new system in place, I'll probably start tackling triggers and NPCs,
    +1
  • Varine Varine:
    Is it fucking hot everywhere?
  • Varine Varine:
    What's a pokemon walking algorithm?
  • jonas jonas:
    it's an engine for pokemon games that closely emulates the walking behavior of pokemon red/blue/yellow
  • jonas jonas:
    basically if you wanted to implement pokemon yellow from scratch, and you'd want it to feel as close as possible to the real thing, you'd start with that
  • Varine Varine:
    Like from the Gameboy games? I'm not at all familiar with Pokemon.
  • jonas jonas:
    yeah
  • The Helper The Helper:
    I only played the Pokemon games on the Gamecube and Wii and such not on the portables my kids had all those games but I never really played on the portables. Now that I think about maybe once sooooo long ago.

    Members online

    No members online now.

    Affiliates

    Hive Workshop NUON Dome
    Top