Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   Scripting Ideas (https://forums.graalonline.com/forums/showthread.php?t=42113)

Python523 01-20-2003 06:11 AM

Scripting Ideas
 
Here are some ideas I think would be good to add to graal scripting (please don't tell me to
tell stefan just because I have debug access, he told me to only tell things that are changes to the scripting engine and to post general changes here)

1.)
synxtax: stripcharacters(character,text);

used: serverside & clientside

example of usage: stripcharacters(«,#s(this.text))

why this would be useful:
in my example it would look at the string #s(this.text) and replace all the « character's with a space
I can't use tokenize2 because tokenize2 is for an ADDITIONAL delimeter, so if I used tokenize2 on the script I needed it for, it would also divide things that are normally spaced into tokens
I would prefer having this than doing what I made as a replacement;
NPC Code:

for(i=0;i<strlen(#s(this.temp));i++){
if(strequals(#e(i,1,#s(this.temp)),‡)){
setstring this.temp,#e(0,this.lastpos,#s(this.temp))#e(this. lastpos,i-this.lastpos,#s(this.temp)) #e(i+1,-1,#s(this.temp));
addstring this.temp2,#e(this.lastpos,i-this.lastpos,#s(this.temp));
this.lastpos = i;
}
}


there are probably other ways to do this but wouldnt a script command/function that did this require less processing time?

EDIT: stefan reminded me that I can use indexof for this :) new replacement
NPC Code:

while(indexof(‡,#s(this.temp)) > -1){
this.index = indexof(‡,#s(this.temp));
setstring this.temp,#e(0,this.index,#s(this.temp)) #e(this.index+1,-1,#s(this.temp));
}


so I don't really need this anymore ^_^

2.)

syntax:var = getnearesttile(type);

used: serverside

example of usage: i = getnearesttile(8);

why this would be useful:
pretend in the example, 8 is water type, the script would automatically find the closest water tile and make i = 0/{x,y,z}, replccing each letter with the correct axis, could be used
for things like pets if you want to get the nearest water tile, again i could do a loop but what would require less processing time ??

3.)

syntax: with(getlevel(levelname))

used: serverside

example of usage: with(getlevel(onlinestartlocal.nw))

why this would be useful:
it could be used to get all the players, npcs, and the tileset board of another levelwithout actually warping to the level

4.)

syntax: showonplayerlist;

used: serverside on database npcs

example of usage: see syntax

why this would be useful:
they could recieve if(pm) as an action as well, it would be fun to add npcs to the playerlist and why bother having the Control-NPC recieve even more actions than it already does
and take up more proccessing time by making it into an FAQ bot when you can do it withanother npc??

5.)

syntax: deletestrings stringstart,begin index,end index;

used: clientside and serverside

example of useage: deletestrings this.item,0,100;

why this would be useful:
the example will delete #s(this.item0), #s(this.item1), all the way to #s(this.item100)
I think this would take less processing time than
for(i=0;strlen(#s(this.item#v(i))) > 0;i++) setstring this.item#v(i),;

6.)
a way to define if something you draw with showpoly gets filled or not x.x

if I think of more ideas I will reply and post them or edit this post

also, don't say that accessing / editing files on the server's ftp would also be useful, Stefan has already said he will add this later

CheeToS2 01-20-2003 07:19 AM

Re: Scripting Ideas
 
Quote:

Originally posted by Python523
moo
I like those ideas.. but.. for #2, what if you're directly in between 4 water tiles? wouldn't it cause some kind of error? x.x

Python523 01-21-2003 05:33 AM

Re: Re: Scripting Ideas
 
Quote:

Originally posted by CheeToS2


I like those ideas.. but.. for #2, what if you're directly in between 4 water tiles? wouldn't it cause some kind of error? x.x

if that was the case, it would probably set the array to whatever tile it finds first in whatever it uses to detect tiles

tlf288 01-21-2003 05:42 AM

Re: Re: Scripting Ideas
 
Quote:

Originally posted by CheeToS2


#2, what if you're directly in between 4 water tiles? wouldn't it cause some kind of error? x.x

Mayb another param in which direction it checks first?

Jasen 01-24-2003 11:59 PM

Too confusing for me. o.o
*Runs away*

Com013 01-25-2003 04:20 PM

Re: Scripting Ideas
 
Quote:

Originally posted by Python523
syntax: with(getlevel(levelname))

used: serverside

example of usage: with(getlevel(onlinestartlocal.nw))

why this would be useful:
it could be used to get all the players, npcs, and the tileset board of another levelwithout actually warping to the level

I know you didn't want to warp, but wouldn't this be the same?

NPC Code:

setstring this.oldlvl,#L;
warpto somewhere.nw,x,y;
...
warpto #s(this.oldlvl),x,y;


tlf288 01-25-2003 04:35 PM

Re: Re: Scripting Ideas
 
Quote:

Originally posted by Com013


I know you didn't want to warp, but wouldn't this be the same?

NPC Code:

setstring this.oldlvl,#L;
warpto somewhere.nw,x,y;
...
warpto #s(this.oldlvl),x,y;


I think your missing the point. The NPC would still have to go to the level for the string to set. getlevel() would be used for in serverside to get the attributes of a level.

Jeff 01-25-2003 09:03 PM

Only database NPCs can warpto.

Any NPC could getlevel, as it would access the players, npcs, board, and level variables of the level without needing to warp a database NPC into the level to bounce things back, a relatively inefficient process.

I have a secret project for which something like this would be most useful...


All times are GMT +2. The time now is 04:20 AM.

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