Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
cosine_omerta
Wanderer


Joined: 14 Oct 2007
Posts: 50

PostPosted: 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.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: 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
Reply with quote
cosine_omerta
Wanderer


Joined: 14 Oct 2007
Posts: 50

PostPosted: 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.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: 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
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net