Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-14-2007, 10:17 PM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
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?
Reply With Quote
  #2  
Old 02-14-2007, 10:20 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
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.
Reply With Quote
  #3  
Old 02-14-2007, 11:12 PM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
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.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #4  
Old 02-15-2007, 01:17 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
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).
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 05:34 AM.


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