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