|
Belmyrddyn Magician
Joined: 17 Oct 2001 Posts: 371 Location: USA
|
Posted: Mon Dec 10, 2001 1:24 pm
String Manipulation |
In my ever driving quest to get the automapper to work with Dragonrealms, I am now turning to string manipulation to find all the damned exits (all in one place), put them in an array, and then search through the array and get the short direction name, and pass it to the %roomexit function. In the mud, the exits are always displayed as follows;
Obvious paths: north, west, in, out, northwest, southeast, east, south.
Now, how would I take that, and be able to put each individual exit into a seperate array slot?
Example;
Dirs.1 = north
Dirs.2 = west
Dirs.3 = in
and so on?
Belmyrddyn |
|
|
|
Palomar Apprentice
Joined: 11 Oct 2000 Posts: 138 Location: Portugal
|
Posted: Mon Dec 10, 2001 1:49 pm |
Here goes a fastly brewed up solution.
Trigger:^Obvious paths:(*).
Script:Dirs=%replace(%1,",","|")
This replaces every "," with the list separator char "|". So now you have a list of dirs... voilá
p.s: you should also trim the spaces in the directions. I will leave that to you.
Palomar |
|
|
|
Belmyrddyn Magician
Joined: 17 Oct 2001 Posts: 371 Location: USA
|
Posted: Mon Dec 10, 2001 10:20 pm |
Okay, I tried that example, but for some reason, when I use this function,
#VAR Dirs %replace(%1,",","|")
It turns out that @Dirs = north.
It forgets all the directions after the first comma.
Another question, I want to turn this into a string list, so how do I do that? (Using Beta 6.22). When I try and add the quotes that the Variable Overview asks, like this,
#Var Dirs %replace(%1,",","~"|~"")
zMUD wants to read that comma after the tilde mark as being the comma to close that parameter of the function, and won't read until the fourth quote.
Are these bugs, or am I just an ignoramus?
Belmyrddyn |
|
|
|
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: Mon Dec 10, 2001 10:33 pm |
change this:
#var Dirs %replace(%1,",","|")
to this:
#var Dirs %replace("%1",",","|")
and you should get the variable palomar suggested
Emit |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|