Making a Wait Without Waits...

Komaqtion

You can change this now in User CP.
Reaction score
469
Why timers are better? Look at PolledWait function:

JASS:
function PolledWait takes real duration returns nothing
    local timer t
    local real  timeRemaining

    if (duration > 0) then
        set t = CreateTimer()
        call TimerStart(t, duration, false, null)
        loop
            set timeRemaining = TimerGetRemaining(t)
            exitwhen timeRemaining <= 0

            // If we have a bit of time left, skip past 10% of the remaining
            // duration instead of checking every interval, to minimize the
            // polling on long waits.
            if (timeRemaining > bj_POLLED_WAIT_SKIP_THRESHOLD) then
                call TriggerSleepAction(0.1 * timeRemaining)
            else
                call TriggerSleepAction(bj_POLLED_WAIT_INTERVAL)
            endif
        endloop
        call DestroyTimer(t)
    endif
endfunction


PolledWait uses Timers.

If you can read the green comments you'll see that it's not that good with lower periods either, as they skip intervals, and they still use TSA, so it still won't be very accurate... It's not that you use timers that's the only good thing, it's how you use it too, you know :p
 

tooltiperror

Super Moderator
Reaction score
231
TSA is too inaccurate to use correctly, and too controlled to make random times :(

Timers are just all around better tbh. Working with them is easy once you get the hang of it.
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
umh?.... TSA does NOT keep counting when you pause the game?
atleast didn't for meright now when i tested...

My guess is that your test is bad. We're talking about timers in multi-player, not timers in single-player. In single-player, it literally pauses the game when you alt-tab out and use the pause function. Multi-player is a bit different.

- Jesus4Lyf
"In terms of the dilemma of do you use a triggercondition and timers, or do you use a triggeraction and sleeps, I'd say what you're doing is fine. Purists might disagree. No one knows what's more efficient - TSA or timers. It shouldn't matter anyway. "

what i could read there is no 100% answear why timers is better

Timers are better when you need extreme precision, and extremely short periods (such as 0.15s or lower). Waits are useful when you don't care about precision.

TSA is too inaccurate to use correctly, and too controlled to make random times :(

You can make random times with the Random functions. Just don't expect TSA to be random the way you want it to. It will be random enough.

Timers are just all around better tbh. Working with them is easy once you get the hang of it.

True, but beginners will find them confusing, and people who don't work in structs will find it tedious. Once you're working in structs, they're wonderful though.

[ljass]PolledWait[/ljass] leaks, and is very rarely needed. Usually, if you care about accuracy you use timers directly. If you don't, a wait will suffice.

When you become very good with vJass, you will find yourself using fewer and fewer waits, simply because you need precision. Some people get the idea that all waits are bad (which is false), and avoid every wait (even [ljass]call TriggerSleepAction(0)[/ljass] when you simply need to update an item position after the item drops from a unit, or something similar).

Generally you will find all of your functions are run immediately, on events or timer expire events, simply because that's the common way for games to work.
 

polo2005

Wana start playing LoL? http://tinyurl.com/369as27
Reaction score
97
and still isn't worth it imo since then you would need to make another trigger... :p

well you could say the same thing about jass, if you have learned it, its easier than gui...

edit: wow you wrote alot :p
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
and still isn't worth it imo since then you would need to make another trigger... :p

well you could say the same thing about jass, if you have learned it, its easier than gui...

If you're making a spell in GUI, you're going to need another trigger, as it will be noticably laggy-looking if you simply use waits. I was talking purely about JASS though, not GUI.
 

Chaos_Knight

New Member
Reaction score
39
This is what i wanted, a Wait that is MUI, But isnt
Trigger:
  • Wait "whatever" seconds

Is this possible?
 

polo2005

Wana start playing LoL? http://tinyurl.com/369as27
Reaction score
97
you could use locals too.. that is imo easier to get a grip on.
 

polo2005

Wana start playing LoL? http://tinyurl.com/369as27
Reaction score
97
well thats true but 3-4 custom scripts isn't that much ether
 

Skippy

Active Member
Reaction score
39
You can't use locals in GUI functions. So if you use locals, you have to convert every GUI function that uses local variable to jass. That would be much more than 3-4 scripts.
 

polo2005

Wana start playing LoL? http://tinyurl.com/369as27
Reaction score
97
noo?... it will not?
Code:
Lazer
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Laza
    Actions
        Custom script:   local unit t = GetSpellTargetUnit()
        Game - Display to (All players) the text: IM A FIRE MY LAZA!
        Wait 3.00 seconds
        Custom script:   set udg_Temp_unit = u
        Unit - Cause (Triggering unit) to damage Temp_unit, dealing 500.00 damage of attack type Spells and damage type Normal

2 scripts for each thing that must be transported over...
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Oh, GOD JESUS !
If you're wondering about what's faster/better in terms of alternatives in GUI to make spells MUI, JUST LEARN JASS !!!!

It's isn't that hard !

And if you should use locals, it's simply easier to just code the whole thing in JASS as otherwise you'll just have to set the locals to globals and stuff just to make it work in GUI...2

There are plenty of good JASS tutorials out there, just pick one or pick the good stuff out of each :p

But I think we've gone a bit off topic here though XD
 

polo2005

Wana start playing LoL? http://tinyurl.com/369as27
Reaction score
97
well think the last 15psot have been offtopic :p

btw is there any "tool" for wc3 that allowes c# or c++ coding?
 

polo2005

Wana start playing LoL? http://tinyurl.com/369as27
Reaction score
97
daim^^ could have sold my soul to the devil for one =)
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Yes there is ?!

Reinventing the Craft, which has just been "relaunched" allows for programming in WC3 :D
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top