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 05-24-2009, 09:12 PM   #31
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

Channel and cast are pretty much the same thing as far as I know.
__________________
Anitarf is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 07-07-2009, 04:51 AM   #32
Bobo_The_Kodo
oO
 
Bobo_The_Kodo's Avatar
 
Join Date: Jul 2008
Posts: 580

Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)

Default

_CHANNEL -> cast time -> _CAST -> cast point -> _EFFECT -> cast backswing -> _FINISH
Bobo_The_Kodo is offline   Reply With Quote
Old 07-07-2009, 10:38 AM   #33
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

Curiously, FlameStrike doesn't work this way as it appears to be hardcoded to treat casting time differently than any other spell for some reason, but I have been able to confirm what you said by giving a casting time to a normal spell. Since SPELL_CHANNEL does not appear to be useless afterall, I added it to the library. Thanks for the report.
__________________
Anitarf is offline   Reply With Quote
Old 07-10-2009, 08:54 AM   #34
Bobo_The_Kodo
oO
 
Bobo_The_Kodo's Avatar
 
Join Date: Jul 2008
Posts: 580

Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)

Default

How does blink work? It doesn't use the normal cast point for heroes either
Bobo_The_Kodo is offline   Reply With Quote
Old 07-16-2009, 08:00 PM   #35
Themerion
Brahms-fan
 
Themerion's Avatar
 
Join Date: Jan 2006
Posts: 641

Submissions (2)

Themerion has a spectacular aura about (110)Themerion has a spectacular aura about (110)Themerion has a spectacular aura about (110)Themerion has a spectacular aura about (110)

Default

What I really don't like about your system, Anitarf, is that it tend to do to much in the majority of cases. Add some optimization possibilities, and I shall bow before you.

Some suggestions (which would be compatible with your current syntax):

First suggestion is to make a struct-like function from two arrays. Storing boolean wantStruct and function pointer Response. Then we link table to the "struct" instead of the response ability (enabling us to bypass the struct population if it isn't needed).

Collapse JASS:
set SpellEvent_wantStruct=false
call RegisterSpellEffectResponse('PHAT',Lewt)

Collapse JASS:
globals
    private integer array $name$N
    private wantStruct array $name$wantStruct
    private Response array $name$Response
endglobals

function RegisterSpell$name$Response takes integer spellId, Response r returns nothing
        if spellId==0 then
            set $name$CallList[$name$CallCount]=r
            set $name$CallCount=$name$CallCount+1
        else
          set $name$N=$name$N+1
      // from global variable
          set $name$wantStruct[$name$N]=wantStruct
          set wantStruct=false
          set $name$Response[$name$N]=r
            set $name$Table[spellId]=$nameN$
        endif
    endfunction

Second suggestion is to be able to turn off the global events. All maps don't have use for them ( <=> there is at least one map which doesn't :)

Collapse JASS:
// And what about the global...

private constant boolean USE_ALL_SPELL_EVENTS

// for avoiding the zero-looping. It will get inlined away (I hope!?)

Collapse On Run:
function $NAME$WhateverSpellEffectIsTriggering takes nothing returns nothing
local integer N = $NAME$table[GetSpellAbilityId()]
if $NAME$wantStruct[N] then
    // do init structs
endif
if USE_ALL_SPELL_EVENTS then
   // Do the loop in the 'zero-list'.
endif
call $NAME$responses[N].execute()
 // Perhaps execute instead? :)
 // Just a suggestion.
endfunction
__________________
Submissions::
(v)JASS Tutorial
Covers how to make fast and safe coding for common tasks in vJASS/JASS.
Creep Respawn System
It has never been easier to respawn creep groups...

Last edited by Themerion : 07-16-2009 at 08:19 PM.
Themerion is offline   Reply With Quote
Old 07-16-2009, 10:40 PM   #36
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

The benefit of having all spell event responses available on all spell events is significant, the speed gained by removing it is not.

I could write another paragraph on why the feature shouldn't be optional, but since the speed gain is not significant in the first place, I don't see a reason to spend more time explaining this.

Besides, the bj_wantDestroyGroup-esque syntax is ugly.

If your particular map doesn't require this feature then you can always delete the event responses code from the library yourself, nobody is forcing you to only use the code as provided.

The second optimization you suggested is meaningless, an if statement isn't faster than an exitwhen statement in any meaningful way.
__________________
Anitarf is offline   Reply With Quote
Old 07-17-2009, 09:15 AM   #37
Themerion
Brahms-fan
 
Themerion's Avatar
 
Join Date: Jan 2006
Posts: 641

Submissions (2)

Themerion has a spectacular aura about (110)Themerion has a spectacular aura about (110)Themerion has a spectacular aura about (110)Themerion has a spectacular aura about (110)

Default

Quote:
Originally Posted by Anitarf
The benefit of having all spell event responses available on all spell events is significant, the speed gained by removing it is not.

I'm not quite sure if you mean variables or callback-functions. If you mean that I benefit from having the target unit on spell finish [for spell x], when [spell x] only use spell cast, then you are simply wrong. If you thought that I wanted you to remove a callback-function (such as spell finish), then you are wrong as well :)

Quote:
Originally Posted by Anitarf
I could write another paragraph on why the feature shouldn't be optional, but since the speed gain is not significant in the first place, I don't see a reason to spend more time explaining this.

Well. The speed gain is not significant, and it might never matter, BUT IT FEELS BAD WITH ALL THIS STUFF RUNNING WHEN I DON'T NEED IT TO!

Quote:
Originally Posted by Anitarf
If your particular map doesn't require this feature then you can always delete the event responses code from the library yourself, nobody is forcing you to only use the code as provided.

Some of the spells in map might need to have event response variables at spell finish, for them I want struct population. But certainly most of my spells won't (which is why I want to be able to bypass the struct in those cases).

Quote:
Originally Posted by Anitarf
Besides, the bj_wantDestroyGroup-esque syntax is ugly.

Yeah, but I wanted to make a suggestion that allows you to keep your current syntax (I hate when people tell me: Do that, and that! But not how it's actually supposed to happen).

Quote:
Originally Posted by Anitarf
The second optimization you suggested is meaningless, an if statement isn't faster than an exitwhen statement in any meaningful way.

I even wrote that it should be inlined/optimized away/whatever you will call it. I just assumed that if VexMapOptimizer finds if false then, it will remove that statement.
__________________
Submissions::
(v)JASS Tutorial
Covers how to make fast and safe coding for common tasks in vJASS/JASS.
Creep Respawn System
It has never been easier to respawn creep groups...

Last edited by Themerion : 07-17-2009 at 10:40 AM.
Themerion is offline   Reply With Quote
Old 07-17-2009, 10:08 AM   #38
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

Quote:
Originally Posted by Themerion
Well. The speed gain is not significant, and it might never matter, BUT IT FEELS BAD WITH ALL THIS STUFF RUNNING WHEN I DON'T NEED IT TO!
Your bad feelings have no relevance to the objective worth of this proposed optimization. It remains worthless. Even if it were significant, I have good reasons to insist that all code using this library uses it's event responses. Again, if you disagree, feel free to add the optimization to your own map yourself.

Quote:
I'm not quite sure if you mean variables or callback-functions. If you mean that I benefit from having the target unit on spell finish, when I only use spell cast, then you are simply wrong. If you thought that I wanted you to remove a callback-function (such as spell finish), then you are wrong as well :)
Quote:
Some of the spells in map might need to have event response variables at spell finish, for them I want struct population. But certainly most of my spells won't (which is why I want to be able to bypass the struct in those cases).
Emphasis mine. Your statements contradict each other. Please revise your message so it is internally consistent.

Quote:
I even wrote that it should be inlined/optimized away/whatever you will call it. I just assumed that if VexMapOptimizer finds if false then, it will remove that statement.
One if statement vs no if statement is still insignificant. This isn't a physics system, please stop asking that it be optimized as one.
__________________
Anitarf is offline   Reply With Quote
Old 07-17-2009, 10:16 AM   #39
Themerion
Brahms-fan
 
Themerion's Avatar
 
Join Date: Jan 2006
Posts: 641

Submissions (2)

Themerion has a spectacular aura about (110)Themerion has a spectacular aura about (110)Themerion has a spectacular aura about (110)Themerion has a spectacular aura about (110)

Default

Quote:
Originally Posted by Anitarf
Emphasis mine. Your statements contradict each other. Please revise your message so it is internally consistent.

If you mean that I benefit from having the target unit on spell finish for spell X, when spell X only use spell cast, then you are simply wrong.

Some of the spells in map might need to have event response variables at spell finish , for them I want struct population. But certainly most of my spells won't (which is why I want to be able to bypass the struct in those cases).

Quote:
Originally Posted by Anitarf
One if statement vs no if statement is still insignificant. This isn't a physics system, please stop asking that it be optimized as one.

I see opportunity for less code to be run, and I think it would be a good thing. You have good reasons for not sharing my opinion, so I shall just drop this. Sorry to have been bothering you.

Quote:
Originally Posted by Anitarf
Again, if you disagree, feel free to add the optimization to your own map yourself.

Good point.

This might be the wrong place to post this, but what the hell :P Feel free to remove CastEvent from the submissions.
__________________
Submissions::
(v)JASS Tutorial
Covers how to make fast and safe coding for common tasks in vJASS/JASS.
Creep Respawn System
It has never been easier to respawn creep groups...

Last edited by Themerion : 07-17-2009 at 10:44 AM.
Themerion is offline   Reply With Quote
Old 07-17-2009, 12:57 PM   #40
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

Quote:
Originally Posted by Litany
One suggestion Ani: you really should initialize some of the struct variables to null or 0. If I target, say, an item or destructable with one ability, then that event instance gets recycled by another ability that targets a unit, the unit-targeted ability will still return the previous target item or destructable. This probably won't matter for the ability's registered event--after all, why would someone check the target item of an ability that targets units?--but events registered to id 0, which run for all abilities, might make such checks.
Ouch, that's what I get for maintaining two copies of the script during early development. I definitely fixed this bug before (I even posted about it) but somehow the fix got lost between updates. Will correct this immediately.

Quote:
It might also be worth initializing TargetX/Y to the caster for abilities that take no target, although in the case of summons they should really be initialized to the summoned unit.
I noticed during my testing that some no-target abilities (like thunder clap) actually do give the caster's coordinates as the target point, while others don't (they return a null location which then translates into coordinates 0,0; I wonder how the new natives in 1.24 work in such situations; I should eventually port this to use them), so maybe this distinction would represent meaningful information to events registered to id 0. That and the problem with summons are the reasons why I didn't bother implementing something like this.
__________________
Anitarf is offline   Reply With Quote
Old 07-17-2009, 10:14 PM   #41
Themerion
Brahms-fan
 
Themerion's Avatar
 
Join Date: Jan 2006
Posts: 641

Submissions (2)

Themerion has a spectacular aura about (110)Themerion has a spectacular aura about (110)Themerion has a spectacular aura about (110)Themerion has a spectacular aura about (110)

Default

Quote:
Originally Posted by Litany
But I can already imagine some yokel whining about this being a performance issue even though it isn't, so you're probably right to just leave it out.

*sarcasm detected*

If it isn't a performance issue and never will be, then he can just as well put it in. It might even be a good idea.
__________________
Submissions::
(v)JASS Tutorial
Covers how to make fast and safe coding for common tasks in vJASS/JASS.
Creep Respawn System
It has never been easier to respawn creep groups...
Themerion is offline   Reply With Quote
Old 07-29-2009, 12:10 PM   #42
Themerion
Brahms-fan
 
Themerion's Avatar
 
Join Date: Jan 2006
Posts: 641

Submissions (2)

Themerion has a spectacular aura about (110)Themerion has a spectacular aura about (110)Themerion has a spectacular aura about (110)Themerion has a spectacular aura about (110)

Default

I'm not sure if this is something which should belong to this system or not, but perhaps it could be a good idea to implement some kind of Get/SetSpellData function (for convenience).

Collapse JASS:
private struct MyData
    unit myUnit
// constructor... blah, blah...
endstruct

function OnChannel
    call SetSpellData( MyData.create(CreateUnit(...)) )
endfunction

function OnFinish
    call RemoveUnit( MyData(GetSpellData()).myUnit )
endfunction
__________________
Submissions::
(v)JASS Tutorial
Covers how to make fast and safe coding for common tasks in vJASS/JASS.
Creep Respawn System
It has never been easier to respawn creep groups...

Last edited by Themerion : 07-29-2009 at 12:12 PM.
Themerion is offline   Reply With Quote
Old 07-31-2009, 10:57 AM   #43
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

Well, you should have your data in local variables by then, also, the data isn't really lost until another channel event recycles the index. I'm not sure whether ordering a unit to cast a spell also triggers the spell event instantly, I guess I should test it.
__________________
Anitarf is offline   Reply With Quote
Old 08-10-2009, 09:28 PM   #44
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

Hmm, I suppose I should have passed the struct to the response function as an argument instead of a global variable. I'd like to maintain backwards compatibility so I can't change that, unless I add another function interface and another set of event register functions on top of it all.

That extra effect event for morph spells could actually be a big issue if the unit is channeling a spell at the time it unmorphs. I really should fix that regardless of how obscure it is.

For now, though, here's an updated version that uses the new 1.24 spell target X/Y natives instead of GetSpellTargetLoc.

Edit: Okay, I also fixed the issue with the extra effect event, now it is ignored. Thanks for reporting it.
__________________

Last edited by Anitarf : 08-10-2009 at 09:40 PM.
Anitarf is offline   Reply With Quote
Old 10-11-2009, 03:19 PM   #45
Troll-Brain
User
 
Join Date: Oct 2006
Posts: 1,490

Submissions (1)

Troll-Brain has a spectacular aura about (134)

Default

Inside the onDestroy method you should set to null all widgets and not only the member CastingUnit.
Regardless this little thing, it seems very good.
Troll-Brain 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:16 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