• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Snippet] Constant Timer Loop 32

You have not "completely shortened" the modules, because you still have those useless "return false" things in there.

Keep in mind that "returns nothing" no longer crashes Mac computers (tested on OS X Snow Leopard). This "returns nothing" fix probably happened when Macs started using Intel chipset.

Also keep in mind that a huge amount of Mac users have switched to Lion now, and WarCraft III doesn't even run on Lion.

"returns nothing" is perfectly fine to use with boolexprs.

Sources:

http://www.wc3c.net/showthread.php?t=110483
http://forums.battle.net/thread.html?topicId=27813861503&sid=3000
 
I prefer to keep with better coding practices

You can't honestly use that argument, unless you want to go back to using names for your variables, and stop caring about meaningless efficiency things like "0 == i".

It's been tested pretty extensively as well. So far, it just acts the exact same as "return false". The only thing left to do is the benchmark.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
It's been tested pretty extensively as well. So far, it just acts the exact same as "return false". The only thing left to do is the benchmark.

Yea, but I don't know what it's doing behind the scenes... when something is supposed to return something and it doesn't, I don't know how wc3 handles that. It could leak, I don't know >.>.


The main issue here isn't speed or anything, it's the fact that Conditions, Filters, and etc are supposed to return booleans and I don't know how wc3 handles them if they don't return booleans. The only way I'd be willing to change it is if you could, without a doubt, tell me how it handled them.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Well.. I could update this to just run completely off of Timer Tools, but that'd be semi silly ^)^.

It'd just be CTM module with a constant timeout, lol... the new version I'm working on is very good..

Also, I found out that TimerUtils is crap. I already made a much faster version for 1 shot timers.. TimerUtils is slower than standard timers >.>., it's just bad.

edit
yea, this just needs to be gy'd.
 
Last edited:
I have an idea, keep this library for backwards compatibility and use static ifs to check if TimerTools is in the map.
If it is, you would generate wrappers called CTL, CTLExpire, CTLNull, CTLEnd, CT32 and CT32End that would wrap the TimerTools module implementations, else, you'd use those modules to wrap the CTM code.

This shouldn't be graveyarded, I already have approximately 80 libraries in my map that use it, and a bunch of public resources that use it too D:

But if you really want to graveyard it, you should ask all the people who uploaded spells and systems that use CTL prior to August 2011 to make updates.

Which solution sounds more tempting to you? Backwards compatibility, or a spells/systems section full of spells that no longer compile? :p
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
I have an idea, keep this library for backwards compatibility and use static ifs to check if TimerTools is in the map.
If it is, you would generate wrappers called CTL, CTLExpire, CTLNull, CTLEnd, CT32 and CT32End that would wrap the TimerTools module implementations, else, you'd use those modules to wrap the CTM code.

This shouldn't be graveyarded, I already have approximately 80 libraries in my map that use it, and a bunch of public resources that use it too D:

But if you really want to graveyard it, you should ask all the people who uploaded spells and systems that use CTL prior to August 2011 to make updates.

Which solution sounds more tempting to you? Backwards compatibility, or a spells/systems section full of spells that no longer compile? :p

thing is, this is written incorrectly atm... if I were to correct it, it would be almost an exact clone of Timer Tools.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Yea, maybe - but I'd vote for Maggy's suggestion (if possible) :)

Updating this is pointless work that I'm not going to do ^)^

edit
What I can do is add a constant merge module that specially works with constant low period timeouts ^)^. I can also add a constant timeout module. These will increase the speed of creation/destruction a little bit.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Well, looks like I'll have to give that monster, on thread below a try. Fortunately it's just a few hundreds of triggers I'll have to go through and modify if I want to gain extra performance.

don't modify if you don't want to >.>.


This still works I believe, so you can just use this if you like.


edit
Yea, this has faster expiration, creation, and destruction and still works just fine, so just use this. No reason to change if ur already using this.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
And CTTC from Timer Tools supports exactly what this does with very minor loss in speed from create/destroy and very minor loss in speed in expiration (negligible). Furthermore, CTTC merges with timers from anywhere else in the system (CTM timer with a .1 timeout would merge with CTTC module with .1 timeout). Therefore, the CTTC module beats this module out :\, hence why I say it's deprecated ;D. Furthermore, CTTC supports any timeouts that will have a constant merge, not just .03125 ; P.

I'm not saying to graveyard this at this point, I'm just saying that this should be marked as deprecated so that people don't use it in the future ; ).


I obviously don't recommend its use over the CTTC module from Timer Tools ; P.

If you want methods where you can create your own loops, Timer Tools has the functions to do that.
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
does this support arrayed members?, coz in my code i tried to put arrayed units and reals, like...
JASS:
private struct SE
   unit array bombs[500]
   real array gap[500]

and distributed it this way in the creation method...
JASS:
loop
   exitwhen i==maxbombs
   set .bombs[i] = CreateUnit(p,BOMB_ID,0,0,0)
   call SetUnitFlyHeight(.bombs[i], 0,0)
   call UnitAddAbility(.bombs[i], DUMMY_SPELL_ID)
   call SetUnitAbilityLevel(.bombs[i],DUMMY_SPELL_ID, lvl)
   set .gap[i] = g
   set g = g + gapdist
   set i = i + 1
endloop

only the first cast does well, the rest not, meaning NOT MUI, on the other hand, I've converted it to T32 and works fine...why is this happening?...
 
Level 16
Joined
Aug 7, 2009
Messages
1,403
Yea, I was kinda confused too, but I couldn't reply when I saw your post. >.>

So simply moving stop (and possibly start too) is enough. I've actually done it when the bug was fixed, but only now crossed my mind to actually post the suggestion here.
 
Top