Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-19-2007, 10:58 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Client <-> Serverside Function Caller

This is a set of functions I made after waitfor() was implemented.
The notification functions, which I made for my information system so the gui would open after the information was gotten and not before. Its used for the client and server function triggers to make the script wait until you've got the return of the function.
PHP Code:
// This was placed in a weapon named System.
public function waitForNotify(objactiontime) {
  return 
waitfor(obj"Notify" actiontime);
}
public function 
notifyClient(objenametime) {
  
triggerClient("gui"name"notify"objenametime);
}
public function 
notifyServer(objenametime) {
  
scheduleEvent(0"ActionServerSide"objenametime);
}
public function 
clientFunction(fobjfnamefparams) {
  
temp.out 0;

  
client.temp.(@ "clientfunction_" fname) = null;
  
triggerClient("gui"name"clientfunction"fnamefparamsfobj);
  
waitForNotify(name"ClientFunctionEnd"5);
  
out client.temp.(@ "clientfunction_" fname);
  
client.temp.(@ "clientfunction_" fname) = null;
  return 
out;
}
function 
onActionServerSide() {
  switch (
params[0]) {
    case 
"notify":
      
makevar(params[1]).scheduleEvent(params[3], "Notify" params[2], null);
      break;
    case 
"serverfunction":
      
temp.0;
      
temp.fn params[1];
      
      
makevar(params[3] @ "." params[1])(params[2][0], params[2][1], params[2][2], params[2][3], params[2][4], params[2][5]);
      
client.temp.(@ "serverfunction_" fn) = r;
      
notifyClient(name"ServerFunctionEnd"0);
      break;
  }
}
//#CLIENTSIDE
function onActionClientSide() {
  switch (
params[0]) {
    case 
"notify":
      
makevar(params[1]).scheduleEvent(params[3], "Notify" params[2], null);
      break;
    case 
"clientfunction":
      
temp.0;
      
temp.fn params[1];
      
      
makevar(params[3] @ "." params[1])(params[2][0], params[2][1], params[2][2], params[2][3], params[2][4], params[2][5]);
      
client.temp.(@ "clientfunction_" fn) = r;
      
notifyServer(name"ClientFunctionEnd"0);
      break;
  }
}
public function 
waitForNotify(objactiontime) {
  return 
waitfor(obj"Notify" actiontime);
}
public function 
notifyServer(objenametime) {
  
triggerServer("gui"name"notify"objenametime);
}
public function 
notifyClient(objenametime) {
  
scheduleEvent(0"ActionClientSide""notify"objenametime);
}
public function 
serverFunction(fobjfnamefparams) {
  
temp.out 0;
  
  
client.temp.(@ "serverfunction_" fname) = null;
  
triggerServer("gui"name"serverfunction"fnamefparamsfobj);
  
waitForNotify(name"ServerFunctionEnd"5);
  
out client.temp.(@ "serverfunction_" fname);
  
client.temp.(@ "serverfunction_" fname) = null;
  return 
out;

Obviously, to use this correctly the object containing the function you're calling must have an identifier, the name variable.

And here is the script I used to test it:
PHP Code:
function onCreated() {
  
with (findPlayer("Inverness")) {
    echo(
System.clientFunction("InverTest","clientFunction"null));
  }
}
//#CLIENTSIDE
public function clientFunction() {
  return 
"OOGLEBOOGLESMORF";

Which worked obviously.

I don't know how this would affect script performance or anything, I just did it because using triggerServer() and triggerClient() and previously triggerAction() has always irritated me.
__________________
Reply With Quote
  #2  
Old 04-19-2007, 11:42 PM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Oooh, really nice Inver. Tho I doubt I may use these they seem to be really useful!

Rep++ 4 u!
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #3  
Old 04-19-2007, 11:49 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Well just think, if you have this around you don't need to use triggerServer() or triggerClient() anymore unless its some special case or so. And it would work for anything that has an identifier.

Hmm I just realized that since I'm using makevar() for triggering the function that I could probably just include the object identifier as part of the function name rather than separate

Edit: Its not working for some reason *sulk*
__________________

Last edited by Inverness; 04-20-2007 at 12:07 AM..
Reply With Quote
  #4  
Old 05-02-2007, 11:41 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Here are some changes I did shortly afterwards.

Changes: Added serverFunction2() and clientFunction2() these functions continue the script rather than waiting that 0.05 second for a returned variable from the distant function.

Also made it so if you leave the object null it will call the function realative to the system, meaning it can call globals. So on clientside you could do: System.serverFunction(null, "addweapon", "WeaponName");
PHP Code:
public function waitForNotify(objactiontime) {
  return 
waitfor(obj"Notify" actiontime);
}
public function 
notifyClient(objenametime) {
  
triggerClient("gui"name"notify"objenametime);
}
public function 
notifyServer(objenametime) {
  
scheduleEvent(0"ActionServerSide"objenametime);
}
public function 
clientFunction(fobjfnamefparams) {
  
temp.out 0;
  
  
client.temp.(@ "clientfunction_" fname) = null;
  
triggerClient("gui"name"clientfunction"fnamefparamsfobj);
  
waitForNotify(name"ClientFunctionEnd"5);
  
out client.temp.(@ "clientfunction_" fname);
  
client.temp.(@ "clientfunction_" fname) = null;
  return 
out;
}
public function 
clientFunction2(fobjfnamefparams) {
  
triggerClient("gui"name"clientfunction"fnamefparamsfobj);
}
function 
onActionServerSide() {
  switch (
params[0]) {
    case 
"notify":
      
makevar(params[1]).scheduleEvent(params[3], "Notify" params[2], null);
      break;
    case 
"serverfunction":
      
temp.0;
      
temp.fn params[1];
      
      if (
params[3] != null)
        
makevar(params[3] @ "." params[1])(params[2][0], params[2][1], params[2][2], params[2][3], params[2][4], params[2][5]);
      else 
        
makevar(params[1])(params[2][0], params[2][1], params[2][2], params[2][3], params[2][4], params[2][5]);
      
client.temp.(@ "serverfunction_" fn) = r;
      
notifyClient(name"ServerFunctionEnd"0);
      break;
    case 
"serverfunction2":
      if (
params[3] != null)
         
makevar(params[3] @ "." params[1])(params[2][0], params[2][1], params[2][2], params[2][3], params[2][4], params[2][5]);
      else 
        
makevar(params[1])(params[2][0], params[2][1], params[2][2], params[2][3], params[2][4], params[2][5]);
      break;
  }
}
//#CLIENTSIDE
function onActionClientSide() {
  switch (
params[0]) {
    case 
"notify":
      
makevar(params[1]).scheduleEvent(params[3], "Notify" params[2], null);
      break;
    case 
"clientfunction":
      
temp.0;
      
temp.fn params[1];
      
      if (
params[3] != null)
        
makevar(params[3] @ "." params[1])(params[2][0], params[2][1], params[2][2], params[2][3], params[2][4], params[2][5]);
      else 
        
makevar(params[1])(params[2][0], params[2][1], params[2][2], params[2][3], params[2][4], params[2][5]);
      
client.temp.(@ "clientfunction_" fn) = r;
      
notifyServer(name"ClientFunctionEnd"0);
      break;
    case 
"clientfunction2":
      if (
params[3] != null)
        
makevar(params[3] @ "." params[1])(params[2][0], params[2][1], params[2][2], params[2][3], params[2][4], params[2][5]);
      else 
        
makevar(params[1])(params[2][0], params[2][1], params[2][2], params[2][3], params[2][4], params[2][5]);
  }
}
public function 
waitForNotify(objactiontime) {
  return 
waitfor(obj"Notify" actiontime);
}
public function 
notifyServer(objenametime) {
  
triggerServer("gui"name"notify"objenametime);
}
public function 
notifyClient(objenametime) {
  
scheduleEvent(0"ActionClientSide""notify"objenametime);
}
public function 
serverFunction(fobjfnamefparams) {
  
temp.out 0;
  
  
client.temp.(@ "serverfunction_" fname) = null;
  
triggerServer("gui"name"serverfunction"fnamefparamsfobj);
  
waitForNotify(name"ServerFunctionEnd"5);
  
out client.temp.(@ "serverfunction_" fname);
  
client.temp.(@ "serverfunction_" fname) = null;
  return 
out;
}
public function 
serverFunction2(fobjfnamefparams) {
  
triggerServer("gui"name"serverfunction2"fnamefparamsfobj);

__________________
Reply With Quote
  #5  
Old 10-25-2007, 12:18 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Trimmed the extra things. Also made it so the parameters weren't in array.
PHP Code:
public function clientFunction(fobjfnamep0p1p2p3p4p5p6p7p8p9) {
  
temp.out 0;

  
triggerclient("gui"name"clientfunction"fobjfnamep0p1p2p3p4p5p6p7p8p9);
  
waitfor(this"ClientFunctionEnd"5);
  
out this.cfreturn;
  
this.cfreturn null;
  return 
out;
}
public function 
clientFunction2(fobjfnamep0p1p2p3p4p5p6p7p8p9) {
  
triggerclient("gui"name"clientfunction2"fobjfnamep0p1p2p3p4p5p6p7p8p9);
}
function 
onActionServerSide() {
  if (
params[0] == "end") {
    
this.cfreturn params[1];
    
trigger("ClientFunctionEnd"null);
  }
  else if (
params[0] == "serverfunction") {    
    if (
params[1] != null)
      
triggerclient("gui"name"end"makevar(params[1] @ "." params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12]));
    else 
      
triggerclient("gui"name"end"makevar(params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12]));
  }
  else if (
params[0] == "serverfunction2") {
    if (
params[1] != null)
      
makevar(params[1] @ "." params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12]);
    else 
      
makevar(params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12]);
  }
}
//#CLIENTSIDE
function onActionClientSide() {
  if (
params[0] == "end") {
    
this.sfreturn params[1];
    
trigger("ServerFunctionEnd"null);
  }
  else if (
params[0] == "clientfunction") {    
    if (
params[1] != null)
      
triggerserver("gui"name"end"makevar(params[1] @ "." params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12]));
    else 
      
triggerserver("gui"name"end"makevar(params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12]));
  }
  else if (
params[0] == "clientfunction2") {
    if (
params[1] != null)
      
makevar(params[1] @ "." params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12]);
    else 
      
makevar(params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12]);
  }
}
public function 
serverFunction(fobjfnamep0p1p2p3p4p5p6p7p8p9) {
  
temp.out 0;
  
  
triggerserver("gui"name"serverfunction"fobjfnamep0p1p2p3p4p5p6p7p8p9);
  
waitfor(this"ServerFunctionEnd"5);
  
out this.sfreturn;
  
this.sfreturn null;
  return 
out;
}
public function 
serverFunction2(fobjfnamep0p1p2p3p4p5p6p7p8p9) {
  
triggerserver("gui"name"serverfunction2"fobjfnamep0p1p2p3p4p5p6p7p8p9);

__________________
Reply With Quote
  #6  
Old 08-12-2008, 04:48 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Having temp. makes variable lookup faster.
PHP Code:
public function clientfunction(fobjfnamep0p1p2p3p4p5p6p7p8p9) {
  
triggerclient("gui"this.name"clientfunction"temp.fobjtemp.fnametemp.p0temp.p1temp.p2temp.p3temp.p4temp.p5temp.p6temp.p7temp.p8temp.p9);
  
waitfor(this"ClientFunctionEnd"5);
  
temp.out thiso.cfreturn;
  
thiso.cfreturn null;
  return 
temp.out;
}
public function 
clientfunction2(fobjfnamep0p1p2p3p4p5p6p7p8p9) {
  
triggerclient("gui"this.name"clientfunction2"temp.fobjtemp.fnametemp.p0temp.p1temp.p2temp.p3temp.p4temp.p5temp.p6temp.p7temp.p8temp.p9);
}
public function 
clientfunction3(wtimefobjfnamep0p1p2p3p4p5p6p7p8p9) {
  
triggerclient("gui"this.name"clientfunction"temp.fobjtemp.fnametemp.p0temp.p1temp.p2temp.p3temp.p4temp.p5temp.p6temp.p7temp.p8temp.p9);
  
waitfor(this"ClientFunctionEnd"temp.wtime);
  
temp.out thiso.cfreturn;
  
thiso.cfreturn null;
  return 
temp.out;
}
public function 
npcfunction(p0p1p2p3p4p5p6p7p8p9) {
  
temp.obj findlevel(temp.p0);
  for (
temp.iobj.npcs) {
    if (
temp.i.id == temp.p1) {
      return 
temp.i.(@ temp.p2)(temp.p3temp.p4temp.p5temp.p6temp.p7temp.p8temp.p9);
    }
  }
}
function 
onActionServerSide() {
  if (
params[0] == "end") {
    
thiso.cfreturn params[1];
    
trigger("ClientFunctionEnd"null);
  }
  else if (
params[0] == "serverfunction") {    
    if (
params[1] != null)
      
triggerclient("gui"this.name"end"makevar(params[1] @ "." params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12]));
    else 
      
triggerclient("gui"this.name"end"makevar(params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12]));
  }
  else if (
params[0] == "serverfunction2") {
    if (
params[1] != null)
      
makevar(params[1] @ "." params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12]);
    else 
      
makevar(params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12]);
  }
}
//#CLIENTSIDE
function onActionClientSide() {
  if (
params[0] == "end") {
    
thiso.sfreturn params[1];
    
trigger("ServerFunctionEnd"null);
  }
  else if (
params[0] == "clientfunction") {    
    if (
params[1] != null)
      
triggerserver("gui"this.name"end"makevar(params[1] @ "." params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12]));
    else 
      
triggerserver("gui"this.name"end"makevar(params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12]));
  }
  else if (
params[0] == "clientfunction2") {
    if (
params[1] != null)
      
makevar(params[1] @ "." params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12]);
    else 
      
makevar(params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12]);
  }
}
public function 
npcfunction(p0p1p2p3p4p5p6p7p8p9) {
  return 
findnpcbyid(temp.p0).(@ temp.p1)(temp.p2temp.p3temp.p4temp.p5temp.p6temp.p7temp.p8temp.p9);
}
public function 
serverfunction(fobjfnamep0p1p2p3p4p5p6p7p8p9) {
  
triggerserver("gui"this.name"serverfunction"temp.fobjtemp.fnametemp.p0temp.p1temp.p2temp.p3temp.p4temp.p5temp.p6temp.p7temp.p8temp.p9);
  
waitfor(this"ServerFunctionEnd"5);
  
temp.out thiso.sfreturn;
  
thiso.sfreturn null;
  return 
temp.out;
}
public function 
serverfunction2(fobjfnamep0p1p2p3p4p5p6p7p8p9) {
  
triggerserver("gui"this.name"serverfunction2"temp.fobjtemp.fnametemp.p0temp.p1temp.p2temp.p3temp.p4temp.p5temp.p6temp.p7temp.p8temp.p9);
}
public function 
serverfunction3(wtimefobjfnamep0p1p2p3p4p5p6p7p8p9) {
  
triggerserver("gui"this.name"serverfunction"temp.fobjtemp.fnametemp.p0temp.p1temp.p2temp.p3temp.p4temp.p5temp.p6temp.p7temp.p8temp.p9);
  
waitfor(this"ServerFunctionEnd"temp.wtime);
  
temp.out thiso.sfreturn;
  
thiso.sfreturn null;
  return 
temp.out;

__________________
Reply With Quote
  #7  
Old 08-15-2008, 01:08 PM
Dan Dan is offline
Daniel
Join Date: Oct 2007
Posts: 383
Dan is an unknown quantity at this point
Send a message via MSN to Dan
I'm using 20 different params and it doesn't work :S what now? [/lol]
__________________
Reply With Quote
  #8  
Old 08-15-2008, 01:28 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Couldn't you just put the parameters in an array? =o
Reply With Quote
  #9  
Old 08-15-2008, 02:45 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Hmmm Can't you just use params[] ? When you call a function of another object then the parameters are put in params[] (params[] always contains the parameters of the first function called).
Reply With Quote
  #10  
Old 08-15-2008, 06:40 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Dan View Post
I'm using 20 different params and it doesn't work :S what now? [/lol]
:P

Well, some examples would be nice Invern

Btw, here are some:

PHP Code:
join("triggercontrol");

public function 
foo(baz) {
  echo(
baz);
  return 
"bar";
}

//#CLIENTSIDE
function onCreated() {
  echo(
serverfunction(this"foo""abc"));

Basically this will echo "abc" in RC and "bar" in F2 on client

---------------

PHP Code:
join("triggercontrol");

public function 
echo2(bazabc) {
  echo(
baz @" -> "abc);
}

//#CLIENTSIDE
function onCreated() {
  
serverfunction2(this"echo2""foo""bar");

This will echo "foo -> bar" in RC

---------------

PHP Code:
join("triggercontrol");

function 
onCreated() {
  
temp."You just got poisoned by a";
  
temp.@= randomstring({"n Apple"" Script"});
 
  
/* clientfunction/2/3 needs to be in the scope of
      an object (preferebly a player) */
  
with (findplayer("Chompy")) {
    
clientfunction2(this.name"f2message"temp.a);
  }
}

//#CLIENTSIDE
public function f2message(msg) {
  echo(
msg);

This will echo "You just got poisoned by an Apple" or "You just got poisoned by a Script" in F2 messages

---------------

PHP Code:
/*-- SERVERSIDE --*/

/*
  How clientfunction works is that it allows to get data from the clientside.
  Pretty neat feature I must say. Check out first example above.  */
clientfunction(
  
fobj// string or null as value, string if the function is in another wnpc (example of a string is 'this.name')
  
fname// function name
  
p0// params0
  
p1// params1 ETC
);

/*
  clientfunction2 is different from clientfunction, because clientfunction2
  because it's only job is to trigger the function on client, not to return
  any data back home to the serverside.  */
clientfunction2(
  
fobj// string or null as value, string if the function is in another wnpc (example of a string is 'this.name')
  
fname// function name
  
p0// params0
  
p1,  // params1 ETC
);

/*
  clientfunction3 is almost the same as clientfunction, but with a little
  twist. clientfunction will only wait max 5 seconds before it continues,
  wheter or not if it has got the data back from the clientside.

  Basically what's different is the wtime argument. */
clientfunction3(
  
wtime// specifies how long the function will wait for data from the clientside
  
fobj// string or null as value, string if the function is in another wnpc (example of a string is 'this.name')
  
fname// function name
  
p0// params0
  
p1,  // params1 ETC
);

/* npcfunction is to trigger an NPC in a said level with a said id. */
npcfunction(
  
p0// the level to check in
  
p1// the id of the npc to check fo
  
p2// function name to trigger
  
p3// param0
  
p4,  // param1 ETC
);


/*
  Note: When using any of the clientfunction* functions, if it's not working,
          try it within a scope.

          with(findplayer("Chompy")) {
            clientfunction2(...);
          }
          */

/*-- SERVERSIDE END --*/


/*-- CLIENTSIDE --*/

/* serverfunction is used exactly like clientfunction, but to return data from
    the serverside to the clientside. */
serverfunction(
  
fobj// string or null as value, string if the function is in another wnpc (example of a string is 'this.name')
  
fname// function name
  
p0// params0
  
p1,  // params1 ETC
);

/* serverfunction2 is used to trigger a function on the serverside, but it won't
    return any data from the serverside to the clientside. */
serverfunction2(
  
fobj// string or null as value, string if the function is in another wnpc (example of a string is 'this.name')
  
fname// function name
  
p0// params0
  
p1,  // params1 ETC
);

/* serverfunction3 is used almost exactly like the serverfunction, besides that
    serverfunction only waits a maximum 5 seconds for data from the
    serverside to arrive. */
serverfunction3(
  
wtime// Specifies how long the function should wait from data from the serverside
  
fobj// string or null as value, string if the function is in another wnpc (example of a string is 'this.name')
  
fname// function name
  
p0// params0
  
p1,  // params1 ETC
);

/* npcfunction is used to trigger a function in an NPC with a said ID */
npcfunction(
  
p0// the id of the NPC
  
p1// function name to trigger in the NPC
  
p2// param0
  
p3,  // param1 ETC
};

/*-- CLIENTSIDE END --*/


/* -- GLOSSARY -- */

/*

  wtime = wait time
  fobj = function object
  fname = function name
  p0 = parameter 0 (the first parameter)
  p1 = parameter 1 (the second parameter)

  PS: parameters start at 0

*/

/* -- GLOSSARY END -- */ 
:-)

PS: Might be some spelling mistakes, if there are, my excuse is: I'm Norwegian

If anything is wrong, let me now =o
__________________

Last edited by Chompy; 08-15-2008 at 08:32 PM.. Reason: Fixed some stuff
Reply With Quote
  #11  
Old 08-15-2008, 06:51 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Stefan View Post
Hmmm Can't you just use params[] ? When you call a function of another object then the parameters are put in params[] (params[] always contains the parameters of the first function called).
Ah, why does params[] only work with different objects and not the same one? x-x

I had assumed params[] only worked with events because I couldn't get it to work with two functions in same object, never tried two functions in different objects.

Edit: Chompy, first parameter needs to be a string or null, not an object.
__________________
Reply With Quote
  #12  
Old 08-15-2008, 08:29 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Inverness View Post
Ah, why does params[] only work with different objects and not the same one? x-x

I had assumed params[] only worked with events because I couldn't get it to work with two functions in same object, never tried two functions in different objects.

Edit: Chompy, first parameter needs to be a string or null, not an object.
Works with an object though, did for me :o, but I'll change the post though
__________________
Reply With Quote
  #13  
Old 08-15-2008, 09:27 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Chompy View Post
Works with an object though, did for me :o, but I'll change the post though
It only works with an object because Stefan allows stuff that really shouldn't be allowed.

I think Stefan should make Graal's scripting language Stackless Python .
__________________
Reply With Quote
  #14  
Old 08-15-2008, 10:04 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Inverness View Post
It only works with an object because Stefan allows stuff that really shouldn't be allowed.

I think Stefan should make Graal's scripting language Stackless Python .
hehe
__________________
Reply With Quote
  #15  
Old 08-16-2008, 12:29 AM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Quote:
Originally Posted by Inverness View Post
I think Stefan should make Graal's scripting language Stackless Python .
Nay! GScript's successor will be Lisp. I shall make sure of it post-haste.
Reply With Quote
  #16  
Old 08-16-2008, 01:50 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Function calls take quite a lot of CPU time, thats why params[] is limited and not provided for each function. Also changing the behaviour now would break some stuff. There are e.g. scripts on Kingdoms that read #p() in sub-classes.
Reply With Quote
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 +2. The time now is 01:29 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.