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 > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 08-23-2009, 06:46 PM   #1
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 lambda?

meh so with time you grow tired of writing enum functions, meh:

problem is how to fit this with the syntax
Collapse JASS:
function err takes nothing returns nothing
    call ForGroup(meh, call KillUnit(GetEnumUnit () ) )
endfunction


becomes:

Collapse JASS:
function err__1 takes nothing returns nothing
     call KillUnit(GetEnumUnit () )
endfunction

function err takes nothing returns nothing
    call ForGroup(meh, function err__1 )
endfunction


?
Possibly working like that with set and return

if you manage to invent something that would also work with functions with arguments (so they become function pointers instead of code, that would be awesome.
__________________
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 08-23-2009, 07:00 PM   #2
Deaod
User
 
Join Date: Jan 2007
Posts: 542

Submissions (11)

Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)

Default

Collapse JASS:
globals
    unit B=CreateUnit(/* ... */)
endglobals

function A takes nothing returns nothing
local unit b=CreateUnit(/* ... */)
    call ForGroup(G, function KillUnit(B))
    call ForGroup(G, function KillUnit(b))
endfunction
becomes:
Collapse JASS:
globals
    unit B=CreateUnit(/* ... */)
unit ___jasshelper_argument_unit1
endglobals

function prototype_001 takes nothing returns nothing
   call KillUnit(___jasshelper_argument_unit1)
endfunction

function A takes nothing returns nothing
local unit b=CreateUnit(/* ... */)
    set ___jasshelper_argument_unit1=B
    call ForGroup(G, function prototype_001)
    set ___jasshelper_argument_unit1=b
    call ForGroup(G, function prototype_001)
endfunction
__________________
Deaod is offline   Reply With Quote
Old 08-23-2009, 09:28 PM   #3
Seshiro
User
 
Seshiro's Avatar
 
Join Date: Aug 2008
Posts: 158

Submissions (1)

Seshiro is on a distinguished road (20)

Default

LAMBDA!

A hug and love to Vex plz! <3
Seshiro is offline   Reply With Quote
Old 08-23-2009, 09:36 PM   #4
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 Seshiro
A hug and love to Vex plz! <3
Not without optional requirements/code.
Oh, and spell olympics judging. :P
__________________
Anitarf is offline   Reply With Quote
Old 08-23-2009, 10:47 PM   #5
Fledermaus
default string
 
Fledermaus's Avatar
 
Join Date: May 2006
Posts: 704

Submissions (1)

Fledermaus is a jewel in the rough (194)Fledermaus is a jewel in the rough (194)Fledermaus is a jewel in the rough (194)

Send a message via MSN to Fledermaus
Default

Wouldn't that just kill 1 unit rather than doing something to all units in the group Deaod?
Fledermaus is offline   Reply With Quote
Old 08-23-2009, 10:47 PM   #6
Strilanc
User
 
Strilanc's Avatar
 
Join Date: Jun 2007
Posts: 917

Submissions (4)

Strilanc has a spectacular aura about (131)

2008 Spell olympics - Fire - Gold

Default

How about.... lambda.

Collapse JASS:
call ForGroup(meh, lambda
                       call KillUnit(GetEnumUnit())
                   endlambda)
__________________
Don't pay attention to this signature, it's self-contradictory.

Last edited by Strilanc : 08-23-2009 at 10:48 PM.
Strilanc is offline   Reply With Quote
Old 08-23-2009, 11:06 PM
Toadcop
This message has been deleted by Vexorian. Reason: fuck these morons
Old 08-23-2009, 11:39 PM   #7
TriggerHappy
 
Join Date: Feb 2008
Posts: 405

Submissions (2)

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

Default

How about multiple arguments?

Collapse JASS:
    function omgwtf takes nothing returns nothing
        //some shit
        call ForGroup(group, doshit1::doshit2::doshit3)
    endfunction

Will probably need a better syntax.

Last edited by TriggerHappy : 08-23-2009 at 11:40 PM.
TriggerHappy is offline   Reply With Quote
Old 08-24-2009, 02:11 AM   #8
Deaod
User
 
Join Date: Jan 2007
Posts: 542

Submissions (11)

Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)

Default

Fledermaus, thats the point. I personally have no need for writing code this short. Passing arguments to code vars, however is a different story.
__________________
Deaod is offline   Reply With Quote
Old 08-24-2009, 02:42 AM   #9
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

Quote:
Originally Posted by Strilanc
How about.... lambda.

Collapse JASS:
call ForGroup(meh, lambda
                       call KillUnit(GetEnumUnit())
                   endlambda)
I'd rather keep it for one liner functions.

Or maybe extend deaod's idea and go back to this idea:

http://www.wc3c.net/showthread.php?p...7&postcount=24
__________________
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 08-24-2009, 02:01 PM   #10
Cheezeman
User
 
Cheezeman's Avatar
 
Join Date: Apr 2009
Posts: 179

Cheezeman has little to show at this moment (1)

Default

I'd really prefer the idea of pasing on parameters to a custom function rather than a native, like in that link you added.
Maybe it's easier to manage using a global hashtable with the group's handle-id as parentkey, and the parameter 'number' as childkey?
I have no idea how optimized or buggy this will be though...
__________________
I have no signature yet

Last edited by Cheezeman : 08-24-2009 at 02:02 PM.
Cheezeman is offline   Reply With Quote
Old 08-24-2009, 02:03 PM   #11
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

It sounds slower than the function call, that's for sure.

I could probably not be bullet -proof. Hmnn, did anybody ever try to nest two ForGroups using the same group (but different functions) ? I think wc3 allows it.

Now that I think of it, it is not even possible, there is no GetEnumGroup() native.
__________________
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
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 08:07 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