|
PHLN Adept
Joined: 30 Dec 2001 Posts: 220 Location: Canada
|
Posted: 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? |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Thu Apr 20, 2006 4:43 am |
%replace( "string to search", "naughty word", "")
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
PHLN Adept
Joined: 30 Dec 2001 Posts: 220 Location: Canada
|
Posted: 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? |
|
|
|
Vodoc Apprentice
Joined: 11 Apr 2003 Posts: 119 Location: Sweden
|
Posted: 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. |
|
|
|
PHLN Adept
Joined: 30 Dec 2001 Posts: 220 Location: Canada
|
Posted: 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. |
|
|
|
Vodoc Apprentice
Joined: 11 Apr 2003 Posts: 119 Location: Sweden
|
Posted: 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?
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
|
Vodoc Apprentice
Joined: 11 Apr 2003 Posts: 119 Location: Sweden
|
Posted: Sun Apr 23, 2006 7:28 am |
You can do it simpler than that:
Code: |
#TRIGGER {naughty word} {#SUB ""} |
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
|
Vodoc Apprentice
Joined: 11 Apr 2003 Posts: 119 Location: Sweden
|
Posted: 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.
|
|
|
|
|
|