wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Code Resources > Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 10-29-2011, 03:36 AM   #151
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

Updated for 2.0.

(Assuming it compiles), I added NewTimerEx and you should be able to call NewTimer at any init stage.








(Assuming it compiles)
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 10-29-2011, 10:06 AM   #152
Bribe
User
 
Bribe's Avatar
 
Join Date: Mar 2010
Posts: 233

Submissions (1)

Bribe will become famous soon enough (30)Bribe will become famous soon enough (30)

Send a message via AIM to Bribe
Default

Collapse JASS:
                static if( not USE_HASH_TABLE) then
                    debug call BJDebugMsg("In case of errors, please increase it accordingly, or set TimerUtils_USE_HASH_TABLE to true")
                    set tT[0]=CreateTimer()

->>

Collapse JASS:
set tT[0]=CreateTimer()
static if( not USE_HASH_TABLE) then
    debug call BJDebugMsg("In case of errors, please increase it accordingly, or set TimerUtils_USE_HASH_TABLE to true")

This prevents overflow from bugging. The textmacro doesn't need to be there because NewTimer could wrap NewTimerEx by passing the value 0. Thank you for taking some time off to work on this library.
Bribe is offline   Reply With Quote
Old 10-29-2011, 01:37 PM   #153
luorax
User
 
luorax's Avatar
 
Join Date: Oct 2011
Posts: 2

luorax has little to show at this moment (0)

Default

This should also use Table, creating new hashtable is unnecessary.
luorax is offline   Reply With Quote
Old 10-29-2011, 02:07 PM   #154
Bribe
User
 
Bribe's Avatar
 
Join Date: Mar 2010
Posts: 233

Submissions (1)

Bribe will become famous soon enough (30)Bribe will become famous soon enough (30)

Send a message via AIM to Bribe
Default

Table would be slower.
Bribe is offline   Reply With Quote
Old 10-29-2011, 02:32 PM   #155
Magtheridon96
User
 
Join Date: Feb 2011
Posts: 7

Magtheridon96 has little to show at this moment (0)

Default

It's about time Vexorian c:
Time to graveyard TimerUtilsEx at the hive and the helper.
Magtheridon96 is offline   Reply With Quote
Old 10-29-2011, 02:34 PM   #156
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Quote:
Originally Posted by Bribe
Table would be slower.
Oh, no! An additional global variable read! How terrible! :)
__________________
Anitarf is offline   Reply With Quote
Old 10-29-2011, 02:59 PM   #157
Bribe
User
 
Bribe's Avatar
 
Join Date: Mar 2010
Posts: 233

Submissions (1)

Bribe will become famous soon enough (30)Bribe will become famous soon enough (30)

Send a message via AIM to Bribe
Default

I admire the shot.

It's not worth the requirement. TimerUtils is the most common library requirement and to make it require Table on top of that is too much. Even with static if's and as an optional requirement it wouldn't be worth Vexorian's time as he apparently hasn't got the time to see if the update even compiles.

Last edited by Bribe : 10-29-2011 at 03:00 PM.
Bribe is offline   Reply With Quote
Old 10-29-2011, 03:38 PM   #158
Magtheridon96
User
 
Join Date: Feb 2011
Posts: 7

Magtheridon96 has little to show at this moment (0)

Default

Collapse JASS:
            if (not didinit) then 
                //This extra if shouldn't represent a major performance drawback
                //because QUANTITY rule is not supposed to be broken every day. 
                call init.evaluate()
                set tN = tN - 1
            else

Oh my..
Why don't you just use a module initializer?

Also, you could make NewTimer a wrapper for NewTimerEx().

Collapse JASS:
function NewTimer takes nothing returns timer
    return NewTimerEx(0)
endfunction

It looks cleaner that way, and you'll reduce the amount of code.

Last edited by Magtheridon96 : 10-29-2011 at 03:40 PM.
Magtheridon96 is offline   Reply With Quote
Old 10-30-2011, 12:48 PM   #159
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

Using Table to save hashtables would be a big deal only on things that use many instances like a module that creates a new Table for each struct that uses it.


Quote:
Oh my..
Why don't you just use a module initializer?
It looks cleaner that way, and reduces the amount of code. I find it horrible to write a module for something that is not a module, almost as bad as using textmacros for that other thing.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 10-30-2011, 02:08 PM   #160
Bribe
User
 
Bribe's Avatar
 
Join Date: Mar 2010
Posts: 233

Submissions (1)

Bribe will become famous soon enough (30)Bribe will become famous soon enough (30)

Send a message via AIM to Bribe
Default

I agree it does look cleaner, but it does not reduce the amount of compiled code but significantly increase it. JassHelper makes a copy of the init function that returns false, while keeping the original version which returns nothing.

If you make the struct "extend array" then a module init only creates a "constant integer structName".
Bribe is offline   Reply With Quote
Old 10-30-2011, 03:16 PM   #161
watermelon_1234
User
 
Join Date: Oct 2007
Posts: 9

watermelon_1234 has little to show at this moment (4)

Default

The code doesn't compile.

Collapse JASS:
if ( didinit ) then
    return
else
    set didinit = true
endif


I don't understand what you're doing with the textmacro but I assume
Collapse JASS:
call SetTimerData(tT[tN],$VALUE$)
should be
Collapse JASS:
call SetTimerData(tT[tN],value)

Last edited by watermelon_1234 : 10-30-2011 at 03:16 PM.
watermelon_1234 is offline   Reply With Quote
Old 10-31-2011, 04:46 AM   #162
Nestharus
User
 
Join Date: Jul 2007
Posts: 220

Nestharus has little to show at this moment (6)

Default

The NewTimerEx isn't needed. Instead of that, you could just put ur init into a module initializer =).
Nestharus is offline   Reply With Quote
Old 10-31-2011, 11:33 AM   #163
Bannar
User
 
Join Date: Aug 2009
Posts: 9

Bannar has little to show at this moment (4)

Default

Collapse JASS:
// If you like speed and giberish try learning about the other flavors.

I lol'd. This needs optimization. And it's not "giberish" but gibberish ;)

Last edited by Bannar : 10-31-2011 at 11:35 AM.
Bannar is offline   Reply With Quote
Old 10-31-2011, 02:26 PM   #164
BBQ
User
 
Join Date: May 2011
Posts: 85

Submissions (2)

BBQ will become famous soon enough (30)BBQ will become famous soon enough (30)

Default

Expand TimerUtils:

Last edited by BBQ : 10-31-2011 at 02:52 PM.
BBQ is offline   Reply With Quote
Old 10-31-2011, 05:35 PM   #165
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Quote:
Originally Posted by BBQ
Collapse Zinc:
        USE_ARRAY = true,
        USE_TABLE = false
Why use two booleans when two out of four combinations are not useful? A single boolean would suffice.

I identify a potential error in your implementation (likely in the original as well): you assume that the first timer that gets created in the array version of the initializer will get the lowest handle id, which isn't necessarily the case if another library that initialized before this created and then immediately removed some handles in the same order. I know, that's incredibly unlikely, but not impossible.

Also, you need to pick two colours for the names of your flavours, it's tradition! :) It seems your code is the equivalent of the original blue and orange flavours, so something similar to those.

I fixed the code in the first post, it should compile now.
__________________

Last edited by Anitarf : 10-31-2011 at 05:38 PM.
Anitarf is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 11:52 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services