Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   We need some shortcut commands.. (https://forums.graalonline.com/forums/showthread.php?t=28138)

Frolic_RC2 04-28-2002 12:18 AM

We need some shortcut commands..
 
Heh, sometimes it gets tiring scripting things like "playernear" and such...

It should be integrated into graal, shortening our scripts and making it easier...

Post what commands should be integrated to make things easier here.

My suggestion is playnear...

playernear(x,y,radius(from x,y));

So you could do...

if (playernear(10,10,2)) {
message Hey;
}else{
message ;
}

If the player is within the radius given, from the point 10,10, the NPC will say Hey. As long as he is in that location, it will continue to say Hey. Once he leaves, it will no longer...

Heh, just post your shortcut commands here anyway ;)

Tyhm 04-28-2002 03:51 AM

if(((playerx-x)^2)+((playery-y)^2)<(radius^2))

Pythagorean theorem.

Falcor 04-28-2002 04:44 AM

nearestplayer variable is in the next version (player index it returns i thinks)

Spanko 04-28-2002 05:45 PM

I just wish it'd allow us to create custom functions like that, along with global custom NPC-Server functions.

Like:
NPC Code:
if (created) {
this.dist=GetDist(x,y,playerx,playery);
}
function GetDist(a,b,c,d) {
this.temp=((c-a)^2+(d-b)^2)^0.5;
return this.temp;
}


Falcor 04-28-2002 11:20 PM

Stefan said that would be quite imposible. I asked him if we could have function arguments and functions that return values other than void every time. He said Gscript wasn't object oriented or something. *shrugs* don't hink it will happen any time soon. But there is always hope.

Frolic_RC2 04-29-2002 08:40 PM

Quote:

Originally posted by Tyhm
if(((playerx-x)^2)+((playery-y)^2)<(radius^2))

Pythagorean theorem.

Gah....need shortcuts...

Saga2001 04-29-2002 11:17 PM

Quote:

Originally posted by Tyhm
if(((playerx-x)^2)+((playery-y)^2)<(radius^2))

Pythagorean theorem.

<3

Falcor 04-30-2002 10:43 AM

Distance Formula:

((x2-x1)^2 + (y2-y1)^2)^.5

(yes, to the 1/2 power = square rt. )

BBflat 05-04-2002 06:19 AM

Quote:

Originally posted by Falcor
Stefan said that would be quite imposible. I asked him if we could have function arguments and functions that return values other than void every time. He said Gscript wasn't object oriented or something. *shrugs* don't hink it will happen any time soon. But there is always hope.
Graal isn't object oriented? It sure as hell should be. I tried to ask Stefan to let user-defined funtions pass arguments and return values, too, but I could never find him. That would be SO useful in Graal scripting. There should also be different variable-types (int, double, float, string, char, bool, etc...) and user-defined types. Object-oriented programming (OOP) is a programming thing (Graal script is not programming) that lets the user make complex data structures like classes, and allows the user to do a LOT more. Graal NEEDS these things!

I like Fermat's Last Theorem better, but Pythagorus is cool, too.


All times are GMT +2. The time now is 05:43 AM.

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