Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Function parameters Problem Oo (https://forums.graalonline.com/forums/showthread.php?t=72196)

projectigi 02-14-2007 10:17 PM

Function parameters Problem Oo
 
Hi

now this doesn't work:
PHP Code:

//#CLIENTSIDE
function onPlayerChats()
  {
  
getMailContent);
  }
function 
getMailContent()
  {
  
player.chat "Ll: "@params[0];
  } 


but this does:
PHP Code:

//#CLIENTSIDE
function onPlayerChats()
  {
  
getMailContent);
  }
function 
getMailContent(rawr)
  {
  
player.chat "Ll: "@rawr;
  } 

why?

Gambet 02-14-2007 10:20 PM

Because you're sending params to the function, and thus, you must define them in the function itself.


function Blah(params)
{
}

In the second case, you stated that rawr would equal the information that you sent, thus why it worked.

For the first example, you havn't assigned any params.

napo_p2p 02-14-2007 11:12 PM

The params[] array is not available when you call a function. It is only available for things like:
triggeraction
triggerserver
callnpc, etc
Where params are passed by a command.

Admins 02-15-2007 01:17 AM

Right, params[] always contains the parameters for the event (onActionClientServer etc.) or when you call a function of another object (basicly the parameters for the first function called).


All times are GMT +2. The time now is 10:21 PM.

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