Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-01-2006, 12:59 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Dynamics

A small concern..
PHP Code:
function onCreated() {
 
temp.func "onTest";
 
temp.paramz = {1,2,3};
 (@
temp.func)(@temp.paramz);
}
function 
onTest(j,e,r) {
 echo(
"Test:" SPC j SPC e SPC r);
}
/*
RC Output:
Test: 1,2,3 0 0
 
Result:
j=1,2,3
e=0
r=0

Desired Result:
j=1
e=2
r=3
*/ 
Is there another way I can workaround this without using else if statements, like in my below example?

PHP Code:
function onCreated() {
 
temp.func "onTest";
 
temp.paramz = {1,2,3};
 if (
temp.paramz.size() == 3) (@temp.func)(temp.paramz[0],temp.paramz[1],temp.paramz[2]);
 else if (
temp.paramz.size() == 2) (@temp.func)(temp.paramz[0],temp.paramz[1]);
 else if (
temp.paramz.size() == 1) (@temp.func)(temp.paramz[0]);
}
function 
onTest(j,e,r) {
 echo(
"Test:" SPC j SPC e SPC r);

__________________
Quote:
Reply With Quote
  #2  
Old 12-01-2006, 01:18 AM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Um, foo({1, 2, 3}); is not the same as foo(1, 2, 3);.

You're giving it an array as the only parameter, therefore you will only get an array.
__________________
Skyld
Reply With Quote
  #3  
Old 12-01-2006, 01:30 AM
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
PHP Code:
function onCreated() {
 
temp.func "onTest";
 
temp.paramz = {123};
 (@
temp.func)(@temp.paramz);

function 
onTest(p) {
 
temp.letters = {NULL"j""e""r"};
 
this.count 0;
 for(
temp.paramtemp.p)
 {
  
this.count++;
  (@ 
temp.letters[this.count]) = temp.param;
 }
 echo(
"Test:" SPC j SPC e SPC r);

Made this fast, dunno if it was something like this
__________________
Reply With Quote
  #4  
Old 12-01-2006, 02:49 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Hmm..
PHP Code:
function onCreated() {
 
temp.func "onTest";
 
temp.paramz = {1,2,3};
 (@
temp.func)(@temp.paramz);
 
/*
 (@temp.paramz) - returns  "1,2,3"   not {1,2,3}
 I see that "1,2,3" would be a string right?
 Would there be a way I could get it recognized as, without using that method Im currently using?
 onText(1,2,3); Is what I would like to acheive.
 If no one gets what Im saying, thanks anyway.
 */

__________________
Quote:
Reply With Quote
  #5  
Old 12-01-2006, 03:25 AM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by fowlplay4 View Post
Hmm..
PHP Code:
function onCreated() {
 
temp.func "onTest";
 
temp.paramz = {1,2,3};
 (@
temp.func)(@temp.paramz);
 
/*
 (@temp.paramz) - returns  "1,2,3"   not {1,2,3}
 I see that "1,2,3" would be a string right?
 Would there be a way I could get it recognized as, without using that method Im currently using?
 onText(1,2,3); Is what I would like to acheive.
 If no one gets what Im saying, thanks anyway.
 */

You're only passing one argument...
(@temp.func)(1,2,3);
It's a variable function name, and as such the parameters are sent just like they would in any other function.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
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 12:58 AM.


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