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
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      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