Raised This Month: $ Target: $400
 0% 

plugin-to-plugin communication


Post New Thread Reply   
 
Thread Tools Display Modes
MagicShot
Senior Member
Join Date: Mar 2004
Location: MN
Old 03-30-2004 , 18:10   Hrm...
Reply With Quote #11

What kinda things is this usefull for?
__________________
|v|agic$hot
.
Without a Sound
MagicShot is offline
Send a message via MSN to MagicShot Send a message via Yahoo to MagicShot
BAILOPAN
Join Date: Jan 2004
Old 03-30-2004 , 18:24  
Reply With Quote #12

if you have to ask you don't know ;]

<serious> it's useful for calling arbitrary functions that you do not know the name for.

for example, PHP has this ability:
$x = "myfunction"
$x(); //This will call "myfunction" if it exists

same thing in C:

int myfunc(void);

int (*func)(void) = myfunc;
(*func)();
__________________
egg
BAILOPAN is offline
MagicShot
Senior Member
Join Date: Mar 2004
Location: MN
Old 03-30-2004 , 18:55   ?
Reply With Quote #13

Does the "callfunc_begin" execute the public fuction in the plugin also?
__________________
|v|agic$hot
.
Without a Sound
MagicShot is offline
Send a message via MSN to MagicShot Send a message via Yahoo to MagicShot
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 03-31-2004 , 07:39   Re: ?
Reply With Quote #14

Quote:
Originally Posted by MagicShot
Does the "callfunc_begin" execute the public fuction in the plugin also?
What? The callfunc_end does the actual execution
__________________
hello, i am pm
PM is offline
MagicShot
Senior Member
Join Date: Mar 2004
Location: MN
Old 03-31-2004 , 11:58   oh
Reply With Quote #15

yeah sorry PM.. thats what i meant but when You execute it it will run what evers in that public command?
__________________
|v|agic$hot
.
Without a Sound
MagicShot is offline
Send a message via MSN to MagicShot Send a message via Yahoo to MagicShot
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 03-31-2004 , 12:21  
Reply With Quote #16

i don't really understand you so i'll make an example

plugin1
Code:
// other code (plugin_init etc)... public the_function(paramint, &paramintref, paramstr[]) {    log_amx("the_function called. paramint = %d, paramintref = %d, paramstr = %s", paramint, paramintref, paramstr);    paramintref++;    paramstr[0] = '[';    return 100; } // other code...

plugin2
Code:
// in a function new intVar = 8; new strVar[] = "(:" log_amx("Will call the_function in plugin1.amx; the int param is 4, the intrf Param is 8, the str param is ^"(:^""); callfunc_begin("the_function", "plugin1.amx"); callfunc_push_int(4); callfunc_push_intrf(intVar); callfunc_push_str(strVar); new retVal = callfunc_end(); log_amx("Called it. Return value: %d; the int var is %d and the str var is %s", retVal, intVar, strVar);

The output should be:
Code:
Will call the_function in plugin1.amx; the int param is 4, the intrf Param is 8, the str param is "(:"

the_function called. paramint = 4, paramintref = 8, paramstr = (:

Called it. Return value: 100; the int var is 9 and the str var is [:
Not tested tho
__________________
hello, i am pm
PM is offline
Reply



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 15:47.


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