 |
cosine_omerta Wanderer
Joined: 14 Oct 2007 Posts: 50
|
Posted: Sat Jun 14, 2008 8:14 am
Changing exits output |
Hi. Does anybody have a set of triggers and what not that will change the way exits are setup from sentence form to just an array type look?
From:
You see exits leading north, east and down.
To:
[Exits: n e d ]
The mud is Achaea, and I'm using zmud.
Any help or advice is appreciated. |
|
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sat Jun 14, 2008 5:46 pm |
#trigger {You see exits leading (*).} {ShortExits = %replace(%replace("%1"," and ", ", "),", ","|");#forall @shortexits {#case %ismember(%i,"master list of exits possibilities") {shortexits = %replaceitem(see helpfile for parameters, recreate this code block for each direction in the master list of exits)}};#sub {%concat("[Exits: ",%replace(@ShortExits,"|"," "),"]")}}
|
|
_________________ EDIT: I didn't like my old signature |
|
|
 |
cosine_omerta Wanderer
Joined: 14 Oct 2007 Posts: 50
|
Posted: Sun Jun 15, 2008 7:28 am |
Thank you for the information. I'm sorry I've never used replaceitem, and I don't see what should go in the 'see helpfile...' area. I've looked at the helpfile for it and see that it will replace something in the list but I don't understand how to make it work. Could you please give me an example of what should be going there?
Thank you. |
|
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Jun 15, 2008 4:36 pm |
| Quote: |
Syntax: %replaceitem(s,n,list)
Replaces the nth item in list with s.
|
s = the new string you want
n = the stringlist element number of the item you want to replace
list = name of the stringlist variable you want to save the results to
%replaceitem("n", 1, @shortexits)
Your specific solution will be something like %replaceitem("n", %ismember("north", @shortexits), @shortexits), and you would duplicate this for all your directions replacing the n/north with the appropriate versions of each direction:
{shortexits = %replaceitem("n", %ismember("north", @shortexits), @shortexits)} {shortexits = %replaceitem("s", %ismember("south", @shortexits), @shortexits)} {shortexits = %replaceitem("e", %ismember("east", @shortexits), @shortexits)} {etc, etc, and so on} |
|
_________________ EDIT: I didn't like my old signature |
|
|
 |
|
|
|
|
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
|
|