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 04-13-2009, 07:43 PM   #31
Flame_Phoenix
retired coder | real ilfe
 
Flame_Phoenix's Avatar
 
Join Date: Mar 2007
Posts: 2,208

Submissions (10)

Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)

Send a message via MSN to Flame_Phoenix
Default

Quote:
Damn... I'll check this night. (extremely weird I have to say.)
I am confused Moyack. Do you plan to "mix" TimedLightnings with TimedEffects in one single library? Will we have all those weird functions in the suggestions posts here too?
__________________
Check out my tutorials at:
1-Creating a Hero Tavern
2-Complete Icon Tutorial - ALL about Icons
3-Making a spell in vJass - Practice Session 1
Check out all my current spells at here
Finally, check my project:
Castle vs Castle Flame Edition
Flame_Phoenix is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 04-13-2009, 08:19 PM   #32
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

I plan something better, this library as a base to create extended structs based on it (I'm in love of extended structs BTW), and I plan to make it a dependency of LightningUtils.
moyack is offline   Reply With Quote
Old 04-14-2009, 12:20 AM   #33
TriggerHappy
 
Join Date: Feb 2008
Posts: 405

Submissions (2)

TriggerHappy will become famous soon enough (43)TriggerHappy will become famous soon enough (43)

Default

If you want a timed handles script, I made one..

Check the submissions forum.

Yours also seems a little to similar to mine -_-

Last edited by TriggerHappy : 04-14-2009 at 12:37 AM.
TriggerHappy is offline   Reply With Quote
Old 04-14-2009, 02:40 AM   #34
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

WEll, I posted it first, so yours is very similar to mine....
moyack is offline   Reply With Quote
Old 04-14-2009, 02:53 AM   #35
TriggerHappy
 
Join Date: Feb 2008
Posts: 405

Submissions (2)

TriggerHappy will become famous soon enough (43)TriggerHappy will become famous soon enough (43)

Default

Actually, I posted my TimedHandles script before you posted this.

Anyways, I'd rather not get into a silly argument over this.
TriggerHappy is offline   Reply With Quote
Old 04-14-2009, 04:21 AM   #36
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

I'd rather too.

At last, something that actually works.

Collapse JASS:
library TimedEffects requires TimerUtils

private struct data
    timer t
    static method create takes nothing returns data
        local data dt = data.allocate()
        set dt.t = NewTimer()
        call SetTimerData(dt.t, integer(dt))
        return dt
    endmethod
endstruct
//! textmacro AddTimedHandle takes HANDLE, NAME, DESTRUCTOR
private struct $NAME$ extends data
    $HANDLE$ h
    static method create takes $HANDLE$ h returns $NAME$
        local $NAME$ H = $NAME$.allocate()
        set H.h = h
        return H
    endmethod
endstruct

function StopTimed$NAME$ takes integer index returns nothing
    call $DESTRUCTOR$($NAME$(index).h)
    call ReleaseTimer($NAME$(index).t)
    call $NAME$(index).destroy()
endfunction

private function DestroyTimed$NAME$ takes nothing returns nothing
    call StopTimed$NAME$(GetTimerData(GetExpiredTimer()))
endfunction

function StartTimed$NAME$ takes $HANDLE$ f, real dur returns integer
    local $NAME$ d = $NAME$.create(f)
    call TimerStart(d.t, dur, false, function DestroyTimed$NAME$)
    return integer(d)
endfunction
//! endtextmacro

//! runtextmacro AddTimedHandle( "effect", "Effect", "DestroyEffect" )
//! runtextmacro AddTimedHandle( "lightning", "Lightning", "DestroyLightning" )

endlibrary

Expand example:



EDIT: Bah!!!! this is nice as a coding exercise, but extending this to other handles in this generalized way is just a necessity created. Actually Effects are the only handles which only need this textmacro-tized structure, other handles definitely need custom extensions in order to get all the needs satisfied.

Therefore this is not the latest version of this script.

Last edited by moyack : 04-14-2009 at 01:15 PM.
moyack is offline   Reply With Quote
Old 11-21-2011, 01:14 PM   #37
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

Syntax error in first library... you forgot to add this method to it:

Collapse JASS:
function StopTimedEffect takes integer index returns nothing
    call DestroyEffect(data(index).f)
    call ReleaseTimer(data(index).t)
    call data(index).destroy()
endfunction

(found that method from an earlier post of yours on HiveWorkshop).

The data.create() method could also get inlined into the DestroyEffectTimed function, to minimize the system code.
Bribe is offline   Reply With Quote
Old 11-22-2011, 03:54 AM   #38
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

Quote:
Originally Posted by Bribe
Syntax error in first library... you forgot to add this method to it:

Collapse JASS:
function StopTimedEffect takes integer index returns nothing
    call DestroyEffect(data(index).f)
    call ReleaseTimer(data(index).t)
    call data(index).destroy()
endfunction

(found that method from an earlier post of yours on HiveWorkshop).

The data.create() method could also get inlined into the DestroyEffectTimed function, to minimize the system code.
Fixed in the first post. Thanks for the check and suggestion
moyack 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 09:34 AM.


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