WC3Jass.com Forum Index WC3Jass.com
"The Jass Vault"
 
 FAQ   Search   Memberlist   Usergroups   Register 
 Profile   Log in to check your private messages   Log in  
 Forum   Scripts   Files   Chat   Pastebin   Function finder  
Affiliates
The HIVE Workshop Games Modding
The Hubb Wc3Campaigns
WC3-Mapping.net

ExecuteFunc: How to use
Goto page Previous  1, 2
 
Post new topic   Reply to topic    WC3Jass.com Forum Index -> Tutorials
View previous script :: View next script  

Author
KaTTaNa
Site Admin

Joined: 04 Apr 2005
Posts: 655
Back to top
Message
PostPosted: Wed Dec 20, 2006 9:27 pm    Post subject: Reply with quote

Let me try and rewrite the code for you:
Code:
// From inv100
call ExecuteFunc(get_session_param("fs_module") + "_ClickHandler")

// Re-written, but still the same
local string funcName = get_session_param("fs_module") + "_ClickHandler"
call ExecuteFunc( funcName )


get_session_param is just a function that returns a string. For example, let's say it returns "Foo". Then funcName = "Foo" + "_ClickHandler" = "Foo_ClickHandler". ExecuteFunc then calls the function called "Foo_ClickHandler" with no parameters. You can build the string however you like, but it does not affect how the function is called, only what function is called.
View user's profile Send private message Send e-mail Visit poster's website

Author
Mapz_Maker


Joined: 25 Nov 2006
Posts: 178
Back to top
Message
PostPosted: Wed Dec 20, 2006 9:28 pm    Post subject: Reply with quote

ok, so would you like me to delete the inv100 file or is it ok?
View user's profile Send private message

Author
KaTTaNa
Site Admin

Joined: 04 Apr 2005
Posts: 655
Back to top
Message
PostPosted: Wed Dec 20, 2006 9:49 pm    Post subject: Reply with quote

No no don't worry about that.
View user's profile Send private message Send e-mail Visit poster's website

Author
PurplePoot


Joined: 20 Dec 2005
Posts: 272
Back to top
Message
PostPosted: Thu Dec 21, 2006 2:32 am    Post subject: Reply with quote

*bump* my questions? Very Happy
View user's profile Send private message

Author
KaTTaNa
Site Admin

Joined: 04 Apr 2005
Posts: 655
Back to top
Message
PostPosted: Thu Dec 21, 2006 10:15 am    Post subject: Reply with quote

Hehe, sorry Purple.
Quote:
A) Does that mean that functions like GetEnumUnit() and GetTriggerUnit() are passed through when creating a new thread?

Yes.

Quote:
B) Can you pass local variables in some manner or other as well?

You can use global variables to pass them over, or you can put them in a game cache. See the Jump script and the comments where I explained how to do it with bj_ globals.
View user's profile Send private message Send e-mail Visit poster's website

Author
PurplePoot


Joined: 20 Dec 2005
Posts: 272
Back to top
Message
PostPosted: Wed Jan 10, 2007 1:13 pm    Post subject: Reply with quote

Aight, late answer, but thanks

I know about GCs already, but they're so damn slow that I was *hoping* for an alternative Confused

And I personally try to avoid BJ globals as much as possible, since whenever I tend to make maps I tend to do them with someone else, and if that person uses any triggers [GUI] with Get Last Created Unit, etc, in them, they map have unforseen consequences Razz
View user's profile Send private message

Author
phyrex1an


Joined: 28 Jun 2005
Posts: 68
Back to top
Message
PostPosted: Wed Jan 10, 2007 7:44 pm    Post subject: Reply with quote

There is many bj_ globals that are only for temporary use or arrays where all indexes are never used.

Unit -> array bj_ghoul
People usually use index 100 but just anything that size and above is safe.

Integer -> bj_groupCountUnits
and more.

String -> I don't know if there is any safe to use strings but if you need one then you can do this:

Code:
local string temp = bj_lastPlayedMusic
call ExecuteFunc("DoNothing")
set bj_lastPlayedMusic = temp


group -> bj_groupAddGroupDest
and more.

And so on. Look in blizzard.j for more variables.
View user's profile Send private message

Author
Silvenon


Joined: 07 Mar 2007
Posts: 162
Back to top
Message
PostPosted: Mon Apr 16, 2007 5:58 pm    Post subject: Reply with quote

So that way event responses can be used from another function? Cool..........uhmm, I didn't understand the part about TriggerSleepAction, so when I have this:

Code:
function DisplayText takes nothing returns nothing
    call TriggerSleepAction(2)
    call BJDebugMsg("hi")
endfunction

function CallingFunc takes nothing returns nothing
    call ExecuteFunc("DisplayText")
    call BJDebugMsg("hello")
endfunction


"hello" will display before "hi"?
_________________
To much JASS for me........
View user's profile Send private message MSN Messenger

Author
KaTTaNa
Site Admin

Joined: 04 Apr 2005
Posts: 655
Back to top
Message
PostPosted: Mon Apr 16, 2007 9:56 pm    Post subject: Reply with quote

That's right. Though I thought you said you didn't understand it Smile
View user's profile Send private message Send e-mail Visit poster's website

Author
HINDYhat(guest)
Guest



Back to top
Message
PostPosted: Tue Jul 24, 2007 3:18 pm    Post subject: Reply with quote

Hmm, can I use timers with this? IE:
Code:
function TimerBlah takes nothing returns nothing
//  ...whatever stuff...
endfunction

function TimerInit takes nothing returns nothing
    local unit u=GetEnumUnit()
    local timer t=CreateTimer()
    call SetHandleHandle(t,"unit",u)
    call TimerStart(t,0.1,true,function TimerBlah)
    set u=null
endfunction

function ExecTimer takes nothing returns nothing
    call ExecuteFunc(TimerInit)
endfunction

function GroupSkill takes group g returns nothing
    call ForGroup(g,function ExecTimer)
    call DestroyGroup(g)
    set g=null
endfunction


It didn't work when I tried... Sorry if I'm noob. Please help lol.

Author
HINDYhat


Joined: 11 Jul 2007
Posts: 22
Back to top
Message
PostPosted: Tue Jul 24, 2007 3:19 pm    Post subject: Reply with quote

Oops I forgot to add the quotes in the ExecuteFunc, but that doesn't matter, they're in my real script... Should it work?
View user's profile Send private message Visit poster's website MSN Messenger

Author
HINDYhat


Joined: 11 Jul 2007
Posts: 22
Back to top
Message
PostPosted: Thu Jul 26, 2007 5:08 pm    Post subject: Reply with quote

Can't anyone tell me if it's possible to use this along with timers??

Right now I'm using sloppy TriggerSleepActions... they work but they are slow and not precise..
View user's profile Send private message Visit poster's website MSN Messenger

Author
KaTTaNa
Site Admin

Joined: 04 Apr 2005
Posts: 655
Back to top
Message
PostPosted: Thu Jul 26, 2007 5:30 pm    Post subject: Reply with quote

I see nothing wrong with the code you posted, apart from the missing quotes you mentioned yourself. But it's a crude example too, since you might as well replace ExecuteFunc("TimerInit") with call TimerInit(), and it should do the same thing. If your code doesn't work, something else must be wrong.
View user's profile Send private message Send e-mail Visit poster's website

Display posts from previous:   
Post new topic   Reply to topic    WC3Jass.com Forum Index -> Tutorials All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


FSDark by SkaidonDesigns
Powered by phpBB © 2001, 2002 phpBB Group