Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Brief explanations about some new features: (https://forums.graalonline.com/forums/showthread.php?t=47663)

GoZelda 09-17-2003 05:48 PM

Re: Brief explanations about some new features: (NEW SCRIPT ENGINE)
 
Quote:

Originally posted by Python523
The new features
Mh, i really need to read the functions stuff more careful because variable passing is a bit unclear to me. Or i think XD does it work like this:

NPC Code:

if (playerenters){
a=10;
b=10;
c=7;
multiply_em(a,b,c);
}
function multiply_em(d,e,f){
g=d*e;
h=g*f;
message #v(h);
}
//very simple, lol.


i should get as outcome (10*10)*7 (=700), right...?

Also, can we do this:

Is there a way to use a "message" that uses a function? I mean like this (Javscript):
NPC Code:

alert("You have" + getcash(client.taxreturn,client.salary) "dollars!);
function getcash(x,y){
this.cash=x*y;
return this.cash;
}


GoZelda 09-17-2003 05:51 PM

Quote:

Originally posted by adam



Becouse there isn't one dedicated tutorial maker among us.

*ahem ahem* *points at self* I made a new commands.rtf ... This sounds fun XD Sorry for double post B.T.W.
Also, tutorials and stuff:
http://www.freewebs.com/graaleditor

Admins 01-31-2004 11:45 PM

There is more in the new scripting engine though:

1. Compatible to old scripts
2. Object-oriented with variant variables
3. Easier access to variables
4. Powerful GUI
5. Additional functions for catching and invoking events
6. Loading and saving files

And more...

adam 01-31-2004 11:51 PM

Ok, thats' just mean. Telling us about all the things we cannot have. ;)

And clear your pm box already. hehe.

Termina_Owner 02-01-2004 12:21 AM

Holy ****! Object-Oriented? That's just awesome!

I haven't been using object-oriented things for a long time, but they were awesome... Erm, for you who don't know... How can I explain:

Object Oriented is something that you can somewhat have a whole new ****load of arrays in a variable, along with it's own function set and all!

As in PHP:
NPC Code:

class dog{
var health;
function bark(){
setcharprop #c,Woof Woof!;
}
function whimper(){
setcharprop #c,Err... Err...!;
}
function attack(otherdog){
otherdog->hurt(5);
}
function hurt(damage){
health = health - 5;
if (health <= 0)
setcharprop #c, Arg... I'm dead;
}
}
if (playerenters){
dog = new dog(10);
healthydog = new dog(100);
healthydog-> bark();
dog-> whimper();
healthydog-> attack(dog);
dog-> attack(healthydog);
healthydog-> attack(dog);
}



Erm... Yea, that seems right... :) It's having a whole basin of function into a variable... It's basically like classes, but much easier to control... Perhaps in a hat shop, you could have One NPC having control of all the hats there, instead of all the hats having itself as a class...

Say, could we do:
NPC Code:

if (playerenters){
npcs[index].OBJECT-> Function(data1,data2);
}


?
It would be awesome if we could... Anyhow! When is the new engine planned to be released? You got me anxious (Well, more then I actually am).

ZeLpH_MyStiK 02-01-2004 04:42 AM

Wow old gscript was so much easier. I think i'll just stick to the old gscript unless certain new features don't work the old way.

Python523 02-01-2004 05:12 AM

Quote:

Originally posted by Termina_Owner

<stuff>

It isn't really anything like php's version of OOP

Thought 02-01-2004 05:40 AM

Function parameters -- can you pass by reference?

xManiamaNx 02-01-2004 07:06 AM

Quote:

Originally posted by ZeLpH_MyStiK
Wow old gscript was so much easier. I think i'll just stick to the old gscript unless certain new features don't work the old way.
I dont see anything harder about the new engine. I just see many new features that will make it better than the old one.

GoZelda 02-01-2004 05:14 PM

The new engine isn't there to make it harder, dudes.

ZeLpH_MyStiK 02-01-2004 07:50 PM

Quote:

Originally posted by xManiamaNx


I dont see anything harder about the new engine. I just see many new features that will make it better than the old one.

Look at the syntax for the for loops, it's more confusing.
(Sounds like Python: for i in range(1,5):)

Admins 02-02-2004 01:23 PM

Quote:

Originally posted by Termina_Owner

As in PHP:
NPC Code:

if (playerenters){
dog = new dog(10);
healthydog = new dog(100);
healthydog-> bark();
dog-> whimper();
}



It would be awesome if we could... Anyhow! When is the new engine planned to be released? You got me anxious (Well, more then I actually am).

You can call functions of other npcs if they are declared public (public function ...).
The class system is the same like the old Graal class system, except that you can join and leave at any time you want. You can do things like

myvar = "test";
myvar.join("dogs");
myvar.whimper();

which is then using the dogs class

GoZelda 02-02-2004 05:54 PM

Quote:

Originally posted by Stefan


You can call functions of other npcs if they are declared public (public function ...).

That's pretty cool :eek: This could be an alternative for a lot of sets, triggeractions etc...h


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

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