Raised This Month: $ Target: $400
 0% 

Calling a function by string


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
PreDominance
Member
Join Date: Jul 2014
Old 08-10-2014 , 00:32   Calling a function by string
Reply With Quote #1

Greetings,
In making my warcraft mod, I'm stuck with "how do I call a player's race_attack skill, with abstraction as key?". The easiest way would be to have the player's race_attack skill have a specific format (#RACENUM#_skill_attack_#NUM#), and then call that function via a formatted string.

The only way I know to call a function via a formatted string is by set_task. However I need to execute that function immediately, not 0.1 seconds after (0.1 seconds is fine for spawn-related functions, but I need immediate results when it comes to player_hurt).

So, how do I do something like the following:
PHP Code:
new fncCall[20];
...
format(fncCallcharsmax(fncCall), "%s""myFunc");
callFunc(fncCallargs[]);
...
public 
myFunc(args[]) {} 
My other option is to loop through every race, comparing the user's race id and then executing the correct one, but I'd rather not do that on every player attack.

Last edited by PreDominance; 08-10-2014 at 01:27.
PreDominance is offline
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:58.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode