Cannot view wiki page
#6

CallRemoteFunction


Calls a public function from within the entire server, this doesn't have to be defined in any way.


Important note: This calls the public function from all of the scripts loaded into the server.


Parameters:
(const format[], {Float,_}:...)
function[] Public functions' name.
format[] Tag/format of each variable
{Float,_}:... 'Indefinite' number of arguments of any tag
This returns the value that the last public function returned.


Format Strings
Placeholder Meaning
c Inserts a single character.
d, i Inserts an integer (whole) number
x Inserts a number in hexadecimal notation.
f Inserts a floating point number.
s Inserts a string.

The values for the placeholders follow in the exact same order as parameters in the call.

Код:
forward callMe(const string[]);
public callMe(const string[])
{
  printf("callMe> %s", string);
  return 86;
}
 
/* Somewhere... in another file prehaps? */
CallRemoteFunction("callMe", "s", "OHAI THAR BAGPUSS!!11");
CallLocalFunction


Calls a public function from within the same virtual engine, which is basically the GM or FS that the public is located in.


Important note: This calls the public function from its own script loaded into the server.


Parameters:
(const format[], {Float,_}:...)
function[] Public functions' name.
format[] Tag/format of each variable
{Float,_}:... 'Indefinite' number of arguments of any tag
This returns the value that the only public function returned.


Format Strings
Placeholder Meaning
c Inserts a single character.
d, i Inserts an integer (whole) number
x Inserts a number in hexadecimal notation.
f Inserts a floating point number.
s Inserts a string.

The values for the placeholders follow in the exact same order as parameters in the call.


A non-working example.

Код:
/* File1 */
forward callMe(const string[]);
public callMe(const string[])
{
  printf("callMe> %s", string);
  return 86;
}
 
/* File2 */
CallLocalFunction("callMe", "s", "OHAI THAR BAGPUSS!!11");
  /* This one wouldn't work because the public 'callMe' is not defined in
    File2, you would need to use CallRemoteFunction for that. */
A working example.

Код:
/* File1 */
forward callMe(const string[]);
public callMe(const string[])
{
  printf("callMe> %s", string);
  return 86;
}
 
CallRemoteFunction("callMe", "s", "OHAI THAR BAGPUSS!!11");
  /* This one would work because this function is defined in
    the same file as this callback is. */
Reply


Messages In This Thread
Cannot view wiki page - by yezizhu - 02.02.2009, 04:58
Re: Cannot view wiki page - by LarzI - 02.02.2009, 04:59
Re: Cannot view wiki page - by yezizhu - 02.02.2009, 05:04
Re: Cannot view wiki page - by LarzI - 02.02.2009, 05:06
Re: Cannot view wiki page - by yezizhu - 02.02.2009, 05:12
Re: Cannot view wiki page - by SilentMouse - 02.02.2009, 10:49
Re: Cannot view wiki page - by yezizhu - 02.02.2009, 11:08

Forum Jump:


Users browsing this thread: 3 Guest(s)