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-31-2011, 05:43 PM   #166
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

Quote:
Originally Posted by Anitarf
I fixed the code in the first post, it should compile now.
I think that ReleaseTimer() should return the data attached to the timer, or at least provide a ReleaseTimerEx() function which does so (and would be a "counterpart" of NewTimerEx()).

Also, do humanity a favor and do a ninja-fix in the ARGBRecolor module as well (and possibly some improvements in ARGB's overall math and overflow-handling).

Last edited by BBQ : 10-31-2011 at 05:46 PM.
BBQ is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 10-31-2011, 07:24 PM   #167
Magtheridon96
User
 
Join Date: Feb 2011
Posts: 7

Magtheridon96 has little to show at this moment (0)

Default

ReleaseTimerEx() isn't needed.
ReleaseTimer should return the timer data though.

NewTimerEx() is useful for shortening code:

Collapse JASS:
local thistype this = recycler[0]
local timer t = NewTimer()

if this == 0 then
    set instances = instances + 1
    set this = instances
else
    set recycler[0] = recycler[this]
endif

call SetTimerData(t, this)
call TimerStart(t, 0.5, true, function thistype.run)

set t = null

->

Collapse JASS:
local thistype this = recycler[0]

if this == 0 then
    set instances = instances + 1
    set this = instances
else
    set recycler[0] = recycler[this]
endif

call TimerStart(NewTimerEx(this), 0.5, true, function thistype.run)

Now tell me. Which one of those snippets is better?
See why a NewTimerEx would be useful?
Magtheridon96 is offline   Reply With Quote
Old 10-31-2011, 07:27 PM   #168
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

Quote:
Originally Posted by Magtheridon96
See why a NewTimerEx would be useful?
And who said that it wouldn't be...
BBQ is offline   Reply With Quote
Old 10-31-2011, 07:57 PM   #169
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

Nestharus.
Bribe is offline   Reply With Quote
Old 11-18-2011, 05:03 PM   #170
Magtheridon96
User
 
Join Date: Feb 2011
Posts: 7

Magtheridon96 has little to show at this moment (0)

Default

Vexorian, you know what could be useful? The ability to attach a handle to the timer ;)

I find it tedious to use a Table instance everytime there's this little piece of data I want to attach to a timer.

You can add these:

Collapse JASS:
function SetTimerHandle takes timer t, handle h returns nothing
function GetTimerHandle takes timer t returns handle


edit
Also, can you please make ReleaseTimer return the integer data? :/

Last edited by Magtheridon96 : 11-18-2011 at 05:08 PM.
Magtheridon96 is offline   Reply With Quote
Old 11-18-2011, 08:06 PM   #171
Anitarf
Procrastination Incarnate


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

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

I really see no use for Set/GetTimerHandle functions.
__________________
Anitarf is offline   Reply With Quote
Old 11-18-2011, 10:41 PM   #172
Magtheridon96
User
 
Join Date: Feb 2011
Posts: 7

Magtheridon96 has little to show at this moment (0)

Default

Come to think of it, I may need to store more than one handle so I guess you're right Anitarf.

I still think ReleaseTimer should return the data though.

It won't break backwards compatibility and it could make our lives easier.

Collapse JASS:
local timer t = GetExpiredTimer()
local integer i = GetTimerData(t)

call ReleaseTimer(t)

// bla bla bla

set t = null

->

local integer i = ReleaseTimer(GetExpiredTimer())

Last edited by Magtheridon96 : 11-18-2011 at 10:41 PM.
Magtheridon96 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 07:20 PM.


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

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