Making a Wait Without Waits...

Sevion

The DIY Ninja
Reaction score
413
EGUI does not crash maps... It's the end-user fucking up that crashes maps... Besides, ATM, parts of EGUI aren't compatible atm.

(BTW, latest EGUI will have locals in GUI.)
 

polo2005

Wana start playing LoL? http://tinyurl.com/369as27
Reaction score
97
EGUI does not crash maps... It's the end-user fucking up that crashes maps... Besides, ATM, parts of EGUI aren't compatible atm.

(BTW, latest EGUI will have locals in GUI.)

It's the end-user... i lol'd ^^

haven't sued EGUI myself even once i dont really know, just heared what others have said...

And whati could understand EGUI is like a more advanced up to date version of WEU?
 

Bogrim

y hello thar
Reaction score
154
Chaos_Knight, what defines whether a trigger is MUI or not is how it handles the variable data. Are you storing data for a single unit or are you accounting for multiple units? Waits are a classic example of what typically breaks a trigger's MUI ability because waits almost always introduce the possibility of an event firing in the time period and altering the trigger's variable data. For example:

An ability does X damage to the target after 10 seconds. Unit A casts the spell and the target is saved as SingleUnitVariable and after 5 seconds, Unit B casts the same spell on a different unit and that target now overwrites the previous target in SingleUnitVariable. After another 5 seconds the second target receives damage from the first spell, making the trigger work differently than intended (a bug).

In that example, a simple use of local variables would avoid the conflict. The point in using local variables/hashtables/indexing systems/timers/jass is to make sure the unit stays the same by saving data for which instance the unit was handled in. Again, the easiest way to learn this is simply to learn the different methods of doing MUI triggers as each method has its limits and advantages.
 

13lade619

is now a game developer :)
Reaction score
398
JASS:
//Read from the bottom up.

struct data //Struct to store data into.
    integer store
endstruct

function SampleTimerCallback takes nothing returns boolean
    local data d = KT_GetData() //KT's syntax for retrieval.
    
    call BJDebugMsg("After 5 seconds, Retrieved Integer: "+I2S(d.store)) //Display retrieved data..
    
    call d.destroy() //Cleanup.
    return true
endfunction

function Trig_Sample_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'ANab'
endfunction

function Trig_Sample_Actions takes nothing returns nothing
    local integer i = GetRandomInt(1,100)
    local data d = data.create() //Create the struct.
    
    set d.store = i //Set the data for the struct.
    call BJDebugMsg("Stored Integer: "+I2S(i))
    
    call KT_Add(function SampleTimerCallback, d, 5) //Set the timer with a duration and set what function as callback.
endfunction

//===========================================================================
function InitTrig_Sample takes nothing returns nothing
    set gg_trg_Sample = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Sample, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Sample, Condition( function Trig_Sample_Conditions ) )
    call TriggerAddAction( gg_trg_Sample, function Trig_Sample_Actions )
endfunction


There's a sample of a wait without using TriggerSleepAction.
Using Jesus4Lyf's KeyTimer (KT), well there are other Timer Attachment Systems out there but this is for the example.

Basiclly, the principle is:

Have a struct to store data into.
and then pass the struct into the callback function.
so that you can retrieve what data you stored and use it again after the duration.
 

Curo

Why am I still playing this game...?
Reaction score
109
As a GUI user who experienced similar problems, I can tell you this:

First off, if you don't know GUI well yet, stop. STOP. Right now. Instead of learning GUI, learn JASS. I wish I had. GUI is pointless, and different. If you learn GUI well like I did, you won't want to learn JASS. And you will suffer.

Second, as someone said, most of the time waits work fine. The biggest flaw is they don't work if you have an ability cast, then cast again before the duration/effect of the first cast is up. In this case you will want to make a hashtable. By combining hashtables with unit groups, you can save the data for any specific unit. You can store damage amounts, effect duration, unit counts, etc. You usually use them with a periodic timer that updates the data for each individual unit. Read a hashtable tutorial for a better explanation.

Third, to those bickering about stuff here, don't argue with someone in a thread (especially over something stupid like why people don't learn JASS). If you want a solution, try and listen to what people say. If you don't like what they say, just say "thanks but no thanks" and leave it. If you argue in a thread, you are likely to both get neg repped and make enemies. Both of these things will reduce the amount of help you get. And seeing as this is a helper forum, that's not something you want here.
 

Chaos_Knight

New Member
Reaction score
39
As a GUI user who experienced similar problems, I can tell you this:

First off, if you don't know GUI well yet, stop. STOP. Right now. Instead of learning GUI, learn JASS. I wish I had. GUI is pointless, and different. If you learn GUI well like I did, you won't want to learn JASS. And you will suffer.

Second, as someone said, most of the time waits work fine. The biggest flaw is they don't work if you have an ability cast, then cast again before the duration/effect of the first cast is up. In this case you will want to make a hashtable. By combining hashtables with unit groups, you can save the data for any specific unit. You can store damage amounts, effect duration, unit counts, etc. You usually use them with a periodic timer that updates the data for each individual unit. Read a hashtable tutorial for a better explanation.

Third, to those bickering about stuff here, don't argue with someone in a thread (especially over something stupid like why people don't learn JASS). If you want a solution, try and listen to what people say. If you don't like what they say, just say "thanks but no thanks" and leave it. If you argue in a thread, you are likely to both get neg repped and make enemies. Both of these things will reduce the amount of help you get. And seeing as this is a helper forum, that's not something you want here.

Im learning JASS, vJASS actually.
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
I just want to correct a state from the third page:

"Waits are fine if you are okay with the inaccuracy."
This is just a lie! Waits cause nasty bugs other than their inaccuracy. Do not use them if you know exactly what you are doing.
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
I just want to correct a state from the third page:

"Waits are fine if you are okay with the inaccuracy."
This is just a lie! Waits cause nasty bugs other than their inaccuracy. Do not use them if you know exactly what you are doing.

Really? And what might these bugs be?

Generally, the only problem with Waits is that they are inaccurate. It's not a big deal if you're just waiting on player input or something similar.
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
Really? And what might these bugs be?

Generally, the only problem with Waits is that they are inaccurate. It's not a big deal if you're just waiting on player input or something similar.
Waits can interfere with each other, making some waits fire instantly, although they should have a duration. Waits also bug up inside loops and certain conditions. Waits also bug certain functions that rely on waits internally (Like transmissions and such).
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Waits can interfere with each other, making some waits fire instantly, although they should have a duration. Waits also bug up inside loops and certain conditions. Waits also bug certain functions that rely on waits internally (Like transmissions and such).

Never heard of Waits interfering with others or firing instantly. I've heard of them "bugging" inside a loop, but that's not necessarily a problem with waits - Callback function used as loops and conditions are supposed to be instant, so a wait would understandably cause problems.

For you GUI people, basically Waits cause problems in Pick every group in ... type functions because each iteration is actually a function call. Each one is done in the order they are stored in the group. A wait could result in the group being changed, and wouldn't result in all of the instances being run at the same time. I'm not sure how callbacks are written in the underlying wc3 engine, but in inherently prevents this problem, as it simply terminates the function when it comes to a wait.
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
Never heard of Waits interfering with others or firing instantly. I've heard of them "bugging" inside a loop, but that's not necessarily a problem with waits - Callback function used as loops and conditions are supposed to be instant, so a wait would understandably cause problems.
I remember that back to the days where I was a bloody noob in coding and didn't use any JASS, I had lots of trouble with waits either fireing instantly or blocking each other in parallel running triggers.
Don't know if that was an issue of that early game patches or not.

I also had the problem that when I fired a transmission, the duration of that transmission changed entirely depending on the number of players in the game.
It was some kind of a trauma for me and taught me to never use TSA ever again.


But that was some years ago. Might be possible that Blizzard remastered the TSA. Would be good, because for cinematics, it really sucks to use timers.
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
I remember that back to the days where I was a bloody noob in coding and didn't use any JASS, I had lots of trouble with waits either fireing instantly or blocking each other in parallel running triggers.
Don't know if that was an issue of that early game patches or not.

I also had the problem that when I fired a transmission, the duration of that transmission changed entirely depending on the number of players in the game.
It was some kind of a trauma for me and taught me to never use TSA ever again.


But that was some years ago. Might be possible that Blizzard remastered the TSA.

Doubtful that they would have remastered it, though it's possible. However, TriggerSleepAction is synced across the game, and so having more players could cause a higher fluctuation in the time.
 

Seprest

New Member
Reaction score
15
just because


it's been said thousands of times in this thread, apparently they don't take very precise input or sumtin, what did ppl say they have (+-)~.2s time?
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
Why are Waits inaccurate?
Waits use your internal CPU time and split your trigger into multiple threads and thus return other values for every player, depending on what the CPU is calculating at the moment.
To handle this, the time values for waits have to be synced, which involves passing data from one player to another one.
Thats why waits are lag dependand.

Timers are different, as they use game time. That's why they need more processing time in general (getting a programs internal time measurement requires more operations than just comparing system time), but are almost 100% accurate.


I'm not sure about this, but it seems logical to me.
 

Curo

Why am I still playing this game...?
Reaction score
109
So where do we sit on periodic time events (every 1 second of game time)? Would you guys class those with timers?
 

tooltiperror

Super Moderator
Reaction score
231
Just a thought, you may use timers instead of waits for periodic effects.
 

PrisonLove

Hard Realist
Reaction score
78
And the advantage would be...? Aside from being able to turn them off.

The problem with using waits in a loop is that with waits functions like [ljass]GetSpellTargetLoc() GetSpellTargetUnit()[/ljass]... basically anything except for [ljass]GetTriggerUnit()[/ljass] can bug using a wait. If you use a wait those functions named before cannot be referenced, hence the need for variable declarations. You CAN use waits for periodic events and such, but there are many more advantages to using timers. Timers are more accurate, can be paused, destroyed, restarted, anytime you want, and if using JASS, often do not require multiple triggers, only a callback function, in addition to avoiding the bugs I mentioned before, and are better for MUI capability.
 

Curo

Why am I still playing this game...?
Reaction score
109
I must have misinterpreted what ToolTip said. I was asking about using the "Event - every 1 second of game time" function. Is it more comparable to a timer or a wait, in its accuracy, speed, etc.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • 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 Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top