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
PHLN
Adept


Joined: 30 Dec 2001
Posts: 220
Location: Canada

PostPosted: Thu Apr 20, 2006 3:58 am   

%replace, I tried to figure out, but failed
 
I can't seems to understand how to use this function in zMUD. I tried going through the helpfile, forum, but still no luck.

What I am trying to do, is remove all of the naughty_word. But still keep everything else in tact.

I tried making a trigger, naughtyword, then tried using weird combination of %replace or #remove, but I can't seem to figure out how from looking at the example.

Why doesn't, %replace ("",naughty_word,"") work?
_________________
zMUD General Discussion: All the power you'll ever need.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4682
Location: Pensacola, FL, USA

PostPosted: Thu Apr 20, 2006 4:43 am   
 
%replace( "string to search", "naughty word", "")
_________________
Discord: Shalimarwildcat
Reply with quote
PHLN
Adept


Joined: 30 Dec 2001
Posts: 220
Location: Canada

PostPosted: Thu Apr 20, 2006 11:35 am   
 
What do you mean when you enter the value string to search? But then won't that mean it won't be as dynamic instead of a trigger of the naughty word then just basically removing it?

I tried using that #SHOW example and it does work, but it look like it only work when its a pre-set line?
_________________
zMUD General Discussion: All the power you'll ever need.
Reply with quote
Vodoc
Apprentice


Joined: 11 Apr 2003
Posts: 119
Location: Sweden

PostPosted: Thu Apr 20, 2006 1:31 pm   
 
You have to tell the function which string to search. You can do it statically like this:
Code:
#show %replace("How are you?", "are", "")

Or you can do it dynamically via different variables, including built in like %1 etc from triggers.
Code:
#var test "How are you?"
#show %replace(@test, "are", "")

Hope that clear things up.
Reply with quote
PHLN
Adept


Joined: 30 Dec 2001
Posts: 220
Location: Canada

PostPosted: Sat Apr 22, 2006 8:44 pm   
 
Ah, ok, so its basically impossible to make a filter then using zMUD in its current form.

Thanks for the reply. I guess that is why it didn't work, caused zMUD didn't have that option yet to just delete a word but not delete the whole line kind of deal.
_________________
zMUD General Discussion: All the power you'll ever need.
Reply with quote
Vodoc
Apprentice


Joined: 11 Apr 2003
Posts: 119
Location: Sweden

PostPosted: Sat Apr 22, 2006 9:53 pm   
 
What exactly are you trying to do? zMUD can filter stuff just fine, I just don't understand what you are up to... It does sound like you are looking for a substitution trigger or am I completely off base?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Apr 22, 2006 11:39 pm   
 
He's wanting trigger substitution. It appears he's misinterpreted the intended function of %replace(), thinking it does the same thing as #SUBSTITUTE or #PSUB. Try this out, PHLN:

#trigger {*(naughty word)*} {#PSUB "" %x1}

I think I got the syntax right on that, but doesn't hurt to check out the helpfile for #PSUB anyways.
_________________
EDIT: I didn't like my old signature
Reply with quote
Vodoc
Apprentice


Joined: 11 Apr 2003
Posts: 119
Location: Sweden

PostPosted: Sun Apr 23, 2006 7:28 am   
 
You can do it simpler than that:
Code:
#TRIGGER {naughty word} {#SUB ""}
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Apr 23, 2006 10:52 pm   
 
Hmm, so you can...could've sworn #SUB worked on the entire line...
_________________
EDIT: I didn't like my old signature
Reply with quote
Vodoc
Apprentice


Joined: 11 Apr 2003
Posts: 119
Location: Sweden

PostPosted: Mon Apr 24, 2006 7:30 am   
 
Nah, but it substitutes the entire pattern which is not always what you want to do and thus we also have PSUB.
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