Snippet GUI-Friendly Double Click

tooltiperror

Super Moderator
Reaction score
231
Updated to 1.2, removed unneeded variables, now says GDC instead of MS, and documentation and post updated, woo hoo, small optimizations.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
// select GDC_Event as the real, and change "0.00" to "1.00".
Why? Leaving it at "0.00" works fine, since you change its value away from 0 beforehand, and it's (slightly) less work for the mapper if they just leave it at the default value of "0.00".

You might want to mention in the documentation that you can use "Triggering Unit" and "Triggering Player".

JASS:
[...]
         loop
             call TriggerRegisterPlayerUnitEvent(t,Player(index-12),EVENT_PLAYER_UNIT_SELECTED,null)
             set index=index+1
             exitwhen index==23
         endloop
That's silly. :p Just set index back to 0 before the 2nd loop, sparing 12 subtraction operations, plus it's easier to figure out when reading it.

[/picky]
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
quick question (for learning purposes)
why loop again for TriggerRegisterPlayerUnitEvent?
The timer system is based on having the timers' handle IDs all be sequential, eg. 16842, 16843, 16844, so you can just subtract the first handle ID from all the rest and end up with a player number. TriggerRegisterPlayerUnitEvent creates a handle, so it can't be in the loop with the timer creation, or the timer IDs would be spaced 2 apart.
 

tooltiperror

Super Moderator
Reaction score
231
Weep, wouldn't I then need to change the order of setting to 0 and then 1?
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Nope, because the event is "becomes equal to". If you set it to 1, then to 0, events will run when it changes from 1 to 0. It's how it works in GDD. ;) If you reversed them, the first time a double-click event happens, it would fail, because it would be setting it from the default value of 0, to 0 (which is not a change), then to 1 - none of which will run the event "becomes equal to".
 

tooltiperror

Super Moderator
Reaction score
231
Precisely why I didn't want to change it :)
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Precisely why I didn't want to change it :)
Huh?

I'm saying that your code, as written, works fine with the event "becomes equal to 0.00", so why instruct people to make it "becomes equal to 1.00"?
 

tooltiperror

Super Moderator
Reaction score
231
Because I'm too lazy to reupload > >

Oh well, I'll get around to changing it eventually.
 

tooltiperror

Super Moderator
Reaction score
231
Updated and the proper demo map is uploaded.

Anything else?
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Anything else?
JASS:
[indenting!]
             set udg_GDC_Event=0            
             set udg_GDC_Event=1

Why'd you reverse that? As it is now, the first double-click event gets ignored. It was correct being set to 1 first, then to 0, and using "becomes equal to 0" as the event.

I thought that was clear from the previous 4 posts. :confused:
 

tooltiperror

Super Moderator
Reaction score
231
You're starting to really get everything jumbled up.

You told me not to make it run at 1.00, because that was more work for the mapper. If I made it run at 1 and set it to 1 first and then 0, it would work fine, which it was before you told me to change it.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
You told me not to make it run at 1.00, because that was more work for the mapper. If I made it run at 1 and set it to 1 first and then 0, it would work fine, which it was before you told me to change it.
-_-

What I've been trying, and apparently failing, to say: it also works fine if you make it run at 0 and set it to 1 first and then 0. The event works both as 1 or 0 when the code sets the value to 1 first and then 0. The code didn't need changing, just the instructions, because if both values work for the event with the same code, you might as well tell people to use the one that's a little easier to set up.
 

tooltiperror

Super Moderator
Reaction score
231
Bah, let's all give up english and write a bytecode language that's easier to understand (and interpret lolol programming jokes.)

I'll change it tonight.
 

sentrywiz

New Member
Reaction score
25
Is this system better than the one used by Blizzard in their map :banghead: what was the name... Halloween 2004 I think?
 
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