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
moksha
Novice


Joined: 13 Oct 2002
Posts: 37
Location: United Kingdom

PostPosted: Sat Mar 15, 2003 12:10 pm   

%replace syntax help
 
Hi again,

I need a little help removing unwanted text from a variable and turning all the items into a stringlist. I know I need to use %replace but I'm having trouble with the syntax.

Sample mud output:

You are carrying:
the sword, the axe, the chest, the beef and the book.


What I want to do is put all the items into a string list, and remove all occurences of "the" and "and" and all spaces and punctuation.

So far I have:

Trigger:
^You are carrying~:$(*).$

Pattern:
#VAR carry "";#ADDITEM carry %line

Should the #additem bit look something like this?

#additem carry %replace( %replace( %replace( %replace( %line), " ", "|"), "the", ""), ",", ""), "and", "")

Please, Someone tell me where I'm going wrong.

Moksha
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Mar 15, 2003 7:58 pm   
 
#ADDITEM is for adding individual (non-duplicate) items one at a time. You want to start with the entire line, then remove things from the variable. Therefore, #ADDITEM isn't appropriate.

#TR {^You are carrying~:$(*).} {#VAR carry {%replace( %replace( "%1", ",", ""), " ", "|")};#DELITEM carry the;#DELI carry and;#DELI carry a;#DELI carry an}

LightBulb
Advanced Member
Reply with quote
moksha
Novice


Joined: 13 Oct 2002
Posts: 37
Location: United Kingdom

PostPosted: Sat Mar 15, 2003 9:15 pm   
 
Lightbulb,

Thankyou, it works perfectly.

Moksha
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