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
Somnium
Beginner


Joined: 15 Nov 2008
Posts: 10

PostPosted: Wed Dec 31, 2008 1:33 pm   

How to capture and replace a single word?!
 
Hi. I am still quite a newbie to zmud.

I am playing MUME which has some colour support for ex .enemies.
Problem is I am trying to replace message when enemy starts casting spells.

Message I recive from MUME whenever mob/player/enemy casts spell is : xxx begins some strange incantations...
I have tried to #GAG that line and using #SH to get the new line: starts ^^^ CASTING ^^^.

Problem with show command is that I need to add , &temp starts casting , to get message to work, but it captures entire line and
the colours for say ENEMY (red) turns to zmud standard colour (white) and the time is expanded from when spell is casted if you use the #gag command it is actually to late to escape the spell.

What I need is to capture a single line from a string of messages and replace with another word.

another ex is from this captured MUME line:
*f CW>west
*XXX the Orc* starts ^^^ CASTING ^^^
(here the zmud halts until you press a key)
a
*f CW>

what i am trying to get is
*f CW>west
*XXX the Orc* starts ^^^ CASTING ^^^
*f CW>

anybody help me out with this IŽd be greatful :D

/ Christian
Reply with quote
calesta
Apprentice


Joined: 07 Dec 2008
Posts: 102
Location: New Hampshire, USA

PostPosted: Wed Dec 31, 2008 5:19 pm   
 
It sounds like you need a trigger something like
Code:
#trigger {^(*) begins some strange incantations...} {#gag;#show %ansi(bold,red)%1 starts ^^^CASTING^^^}

This doesn't capture the color from the MUD (it can be done I believe, but I've never done that before so not sure how), but instead just outputs the line in whatever color you want.

I have no idea what you meant about time being expanded from when the spell is cast if you use the #gag command. If you add another command to flee from the room at the end of the trigger, it should leave the room immediately:
Code:
#trigger {^(*) begins some strange incantations...} {#gag;#show %ansi(bold,red)%1 starts ^^^CASTING^^^;flee}
Reply with quote
Somnium
Beginner


Joined: 15 Nov 2008
Posts: 10

PostPosted: Thu Jan 01, 2009 3:16 pm   
 
Thanks Calesta.
Works a little better, but I was looking for more of a #cw command (that captures a single word and replace/change the word)
If you know what I mean.

Many thanks
/CHristian
Reply with quote
calesta
Apprentice


Joined: 07 Dec 2008
Posts: 102
Location: New Hampshire, USA

PostPosted: Thu Jan 01, 2009 4:45 pm   
 
I guess I'm still not sure what you are trying to do, but if the goal is to replace some text received from the MUD with some other text, you should probably be looking at the #substitute command.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu Jan 01, 2009 6:36 pm   
 
Mmm, #sub is all you need.

#trig {begins some strange incantations...$} {#sub "begins ^^^CASTING^^^"}

and job done.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Somnium
Beginner


Joined: 15 Nov 2008
Posts: 10

PostPosted: Thu Jan 01, 2009 9:25 pm   
 
Thanks alot.
Exactly what I was looking for, work perfect!
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Sun Jan 04, 2009 11:35 pm   
 
OT
Using the ^^^^^ in MUME is like so many subs showing east flees as >>>>>, or You flee as I fled VVVVV South. The game is so painful (and thrilling) everyone serious seems to rewrite the best mud text ever in favor of ascii hieroglyphs. At one point I looked into creating a special MUME font just for such things to use with MXP, it was just a muse. I didn't think wingdings jived well enough. I never did get to that. I wonder...
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