Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Question (https://forums.graalonline.com/forums/showthread.php?t=72688)

Switch 03-09-2007 01:59 AM

Question
 
What's a param(eter)? I keep seeing these in scripts and such but I have no idea what exactly it is...

Gambet 03-09-2007 02:20 AM

It's just a value or an object that you use when you want to transfer information across a system/system(s). They are passed through a function.


On Graal, params are read as an array of values, of which the first value in the sent function would be params[0], the second params[1], etc...

Kristi 03-09-2007 04:30 AM

In all languages, when you call a funciton or procedure, you give them arguments
EG

this = that(var1,var2);

var1 and var2 are arguments

in a declaration, they are called paramaters

function that(passed1,passed2) {
whatever;
}

passed1 and passed2 are parameters.


When using triggeraction in gs2, you trigger something on the serverside, then the serverside function has

function onActionServerside(passed1,passed2) {
whatever;
}

however, in the case of a triggered function ONLY, you do not have to define the parameters, so if you did

function onActionServerside() {

and triggered it with parameters, since they were never given name, they will be referred to as param[0], param[1], etc

Gambet 03-09-2007 05:01 AM

Quote:

Originally Posted by Kristi (Post 1286594)
When using triggeraction in gs2, you trigger something on the serverside, then the serverside function has

function onActionServerside(passed1,passed2) {
whatever;
}

however, in the case of a triggered function ONLY, you do not have to define the parameters, so if you did

function onActionServerside() {

and triggered it with parameters, since they were never given name, they will be referred to as param[0], param[1], etc


You don't need to define any parameters when calling the serverside action (in the actual function, I mean, not the trigger), which is what it is -- an action. When you trigger, you trigger to action functions that in turn read any information you sent over as parameters.


All times are GMT +2. The time now is 02:51 AM.

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