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


Joined: 04 Oct 2001
Posts: 43
Location: Canada

PostPosted: Thu Jan 29, 2004 9:49 pm   

RP script help?
 
Hi all!

I'm hoping someone can help with this little problem. I need a script to change the text I'm writing when I "say" or "tell" someone on my MUSH something.... here's an example of what I mean.

Raw Text say It's a pleasure to meet you.

MUSH/MUD Output Bob says It's a pleasurrrre to mmmeet you. Mmmm?

Essentially I want any instance of the letter "R" or "M" to be replicated randomly to 3 or 4 extra letters in a word and always finishing off the line with "Mmmm?".

The Reason Smile

I would have to be flying a complex ship and responding to orders in character. Having to manually type out the extra "r"s, "m"s and the "Mmmm?" takes up valuable time I need to respond.

Yeah, I know, maybe I shouldn't have made a character with a speech impediment, but I know that already and it's too late. Very Happy


Thanks in Advance,

Tygerhart
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Thu Jan 29, 2004 10:14 pm   
 
Something like this might work:

The talk alias replaces the appropiate letters with the "extra letters" by using the translate function.
#ALIAS talk {#show %concat(%subregex( %0, "(r|R)|(m|M)", "@translate(~%0, %random(3,4))"), " Mmmm?"}

The translate function builds up a string with a specific letter repeated a specific amount of times.
%1: Letter to be repeated
%2: Amount of repeats.
#VARIABLE translate {%if( %2>0, %concat( %1, @translate(%1, %eval(%2-1))), "")}

Edit: If you want it to translate "Many things happening" -> "Mmmany things..." instead of "MMMany things ..." use this code for the translate function:
%if( %2>0, %concat( @translate(%1,%eval(%2-1) ), %if( %2>1, %lower( %1), %1)), "")

Have fun roleplaying Very Happy
Reply with quote
Tygerhart
Novice


Joined: 04 Oct 2001
Posts: 43
Location: Canada

PostPosted: Fri Jan 30, 2004 12:24 am   
 
quote:
Originally posted by Rorso

Something like this might work:


Thanks Rorso!

It worked with some jinking around. Now I just need some fine tuning. Maybe you or someone else can help me tweak it a bit.

Here's how it's working now

#ALIAS t

tt {
%subregex( %0, "(r|R)|(m|M)", "@translate(~%0, %random(3,4))")
} Mmmmm?

This works well but here's where I need the tweak...

#ALIAS tt ("tt" is the MUSH command for "table talk", it only accepts "tt".)

~tt {
%subregex( %0, "(r|R)|(m|M)", "@translate(~%0, %random(3,4))")
} Mmmmm?


Can you see the problem? I tried using the tilde (~) in front of the value's "tt", but that shuts the whole thing off. Any suggestions how to just shut the "tt" off in the value and not the entire value? (Hope this makes sense.) Very Happy


Thanks again,
Tygerhart
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Fri Jan 30, 2004 12:45 am   
 
#ALIAS tt {~tt %concat(%subregex( %0, "(r|R)|(m|M)", "@translate(~%0, %random(3,4))"), " Mmmm?"}

Move the ~tt inside the {}
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Jan 30, 2004 4:03 am   
 
Also %0 is not supported and may not work in future versions. Use %-1 instead.
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