Graal Forums  

Go Back   Graal Forums > Development Forums > Future Improvements
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-20-2001, 06:34 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
New Script features!

Ok, If any of you know JavaScript ud understand this..

You know how functions() are called like that. Well if you didnt already know this. fuctions can contain objects!!!! Yes its true people.. But this is disabled in Graal I was hoping stefan could ad this...
'
Simple Explanation
NPC Code:

function funcName(argument1,argument2,etc)
{ statements; }



and then

NPC Code:

funcName(value1,value2,ect)



============================

MoreBiggernier Explanation

Ok. Well Function Arguments or Objects are like when you put an argument into a command. For example..

message text;

text is the 1 argument in that commandline

Now Functions are made to take in objects and spit out results...

Example..
NPC Code:

cut_out_token_one(Call me Cool)



And the function

NPC Code:

function cut_out_token_one(message) {
tokenize #o(message); /*Im using #o cuz of strings. in
javaScript strings are set with "" not setstring.*/
for(i=0;i<tokenscount;i++;) {
if (i!=1) {
setstring result,#T(#s(result) #t(i));
}
}
return;
}



So it would return in the string
result

and have the value = Call Cool;

I hope that explains function aguments or objects ^^;

Adn calling then for you information...

A function waits in the wings until it is called onto the stage. You call a function simply by specifying its name followed by a parenthetical list of arguments, if any:


clearPage();
cut_out_token_one(Call me Cool);
Functions which return a result should be called from within an expression:


total=raiseP(2,8);
if (raiseP(tax,2)<100) ...


__________________

subliminal message: 1+1=3

Last edited by Falcor; 06-20-2001 at 09:59 AM..
Reply With Quote
  #2  
Old 06-20-2001, 08:38 AM
Spearman Spearman is offline
Registered User
Join Date: Mar 2001
Location: Indiana, USA
Posts: 498
Spearman is on a distinguished road
Send a message via ICQ to Spearman Send a message via AIM to Spearman
Good idea, I have seen functions and stuff before like in javascripts and whatnot and I'm not that great of a scripter, but I was wondering why graal didn't have something like that in their functions
__________________


Reply With Quote
  #3  
Old 06-20-2001, 06:04 PM
grim_squeaker_x grim_squeaker_x is offline
Retired Oldbie
grim_squeaker_x's Avatar
Join Date: Mar 2001
Posts: 3,084
grim_squeaker_x will become famous soon enough
In the debugger it already says something along these lines actually... Perhaps it's worth experimenting to see if there's already something like that?
__________________

Reply With Quote
  #4  
Old 06-21-2001, 09:35 PM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
*Staying alive*
__________________

subliminal message: 1+1=3
Reply With Quote
  #5  
Old 06-21-2001, 09:41 PM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Nah, args and returns have not yet been implemented.
Reply With Quote
  #6  
Old 06-21-2001, 11:49 PM
grim_squeaker_x grim_squeaker_x is offline
Retired Oldbie
grim_squeaker_x's Avatar
Join Date: Mar 2001
Posts: 3,084
grim_squeaker_x will become famous soon enough
That's too bad... It could be a perfect script shortener in some cases.
__________________

Reply With Quote
  #7  
Old 06-21-2001, 11:51 PM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Variables:

param1
param2
param3
return

Sure, they're not perfect but what is?
Reply With Quote
  #8  
Old 06-21-2001, 11:53 PM
grim_squeaker_x grim_squeaker_x is offline
Retired Oldbie
grim_squeaker_x's Avatar
Join Date: Mar 2001
Posts: 3,084
grim_squeaker_x will become famous soon enough
Well yes you're right, although in the case of a function which has a chance of calling itself it should actually be a couple of arrays.
__________________

Reply With Quote
  #9  
Old 06-21-2001, 11:54 PM
AlexH AlexH is offline
Have A Drink On Me
AlexH's Avatar
Join Date: Jun 2001
Location: Somewhere In Time
Posts: 7,442
AlexH is on a distinguished road
Send a message via AIM to AlexH Send a message via MSN to AlexH
*reads the first post*
*thinks*
*looooooooooong silence*
*looks puzzle*
*runs away*
__________________
QUICK LOOK BUSY JESUS IS COMING!
Reply With Quote
  #10  
Old 06-21-2001, 11:55 PM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Nurk! I hate recursion anyway...
Reply With Quote
  #11  
Old 06-21-2001, 11:57 PM
grim_squeaker_x grim_squeaker_x is offline
Retired Oldbie
grim_squeaker_x's Avatar
Join Date: Mar 2001
Posts: 3,084
grim_squeaker_x will become famous soon enough
Well it sometimes (very rarely) necesarry.
__________________

Reply With Quote
  #12  
Old 06-21-2001, 11:59 PM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
True, I've had to use it once myself. I didn't want to, but life's a beach.
Reply With Quote
  #13  
Old 06-24-2001, 03:32 PM
Solareon Solareon is offline
Registered User
Solareon's Avatar
Join Date: Jun 2001
Location: In a corn field
Posts: 548
Solareon is on a distinguished road
Send a message via AIM to Solareon
just do the following....

do something along to the lines of

function ProcessParam();
if (multicasevar="value for action to be called") {
Script functions here
}
if (multicasevar="value for different action") {
Script Functions here
}


not sure if that is proper graal script but that would be somethign similar (don't want to open up commands.rtf and read through all the things for it.

then to call the function do the following

setstring multicasevar,#s(variable)
ProcessParam()

it is similar in effect but you just have to have the varibles preset before you call them. In VB this is called Select Case (although VB handles variables passed to functions normally)

few extra lines of code but for the extra script functions you can have in a shorter space. If you wanted to you could change the Script Functions here part to call another Function (shortens script so you can have a parser function and then actually script functions that do something.

Defitions of variables:
multicasevar, set this to what the case is you want to call a certain function or set of script commands.
variable, this is the text tat is passed to the parser
the things in quotes change that to something to match a varible the multicasevar may be set to.

if someone would translate this to mroe of a graal script that would be most appreciated.
__________________
-Solareon Doll, thanks to BirdBird_0 for making it
-
First person to choke on a gummi bear and cough it up =)

AIM: SolareonX
flame me 24/7 roffel
-- l33t
JubieSaotomeX < Me
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 11:31 PM.


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