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
Anthalas
Newbie


Joined: 17 Dec 2009
Posts: 7

PostPosted: Thu Apr 16, 2020 6:32 am   

Zmud Trigger Help
 
Hi guys,

Some 20 years ago, I created a trigger that helped me remember the names of characters in a mud that I play. Back then, I was kinda in to learning how to code so it was actually easy. Now that I've moved on to a different skillset, I cannot for the life of me, remember how the heck I managed to make such a script.

The function is fairly simple, I know what I want, I just don't remember how to get there and I would appreciate your help.

In the mud I play, character names are not displayed, only their descriptions. I used this trigger as a way to remember names.

So this is how it worked:

The mud gives this text:
A bald guy is here.

I want it to show this:
(Baldie) A bald guy is here.

The trigger basically appends the character's name in parenthesis before the triggering string.

I cannot, for the life of me remember how I did it before and any help would be greatly appreciated.

Thank you!
Reply with quote
shalimar
GURU


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

PostPosted: Thu Apr 16, 2020 2:32 pm   
 
This is a simple database variable substitution.

First, you need to populate the database of known people

#ADDKEY friends {A bald guy} {Baldie}

Then you need your substitution trigger

#TR {({@friends})} {#SUB {%concat( "(", %db(@friends, %1), ") ", %1)}}
_________________
Discord: Shalimarwildcat
Reply with quote
shalimar
GURU


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

PostPosted: Thu Apr 16, 2020 2:35 pm   
 
Oh, that's a CMUD answer...

for zMUD you have to be a bit more direct:

#TR {(A bald guy is here.)} {#SUB {%concat( "(Baldie) ", %1)}}
_________________
Discord: Shalimarwildcat
Reply with quote
Anthalas
Newbie


Joined: 17 Dec 2009
Posts: 7

PostPosted: Fri Apr 17, 2020 2:39 am   
 
These are awesome!

I appreciate both the CMUD and Zmud solutions. I cannot remember how I came to doing this myself some 18 years ago. (Just realized that I found that mud in 2002 and made the trigger about the same time)

Thank you so much!
Reply with quote
Anthalas
Newbie


Joined: 17 Dec 2009
Posts: 7

PostPosted: Fri Apr 17, 2020 6:25 am   
 
Quick question. If I wanted to color the name in the parenthesis different from the line, how would I do that?
Reply with quote
shalimar
GURU


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

PostPosted: Fri Apr 17, 2020 1:15 pm   
 
I would use some MXP tags.
Code:
%concat( "(<color red>Baldie</color>) ", %1)

Or insert some ansi
Code:
%concat( "(%ansi(red)Baldie%ansi(reset)) ", %1)
_________________
Discord: Shalimarwildcat
Reply with quote
Anthalas
Newbie


Joined: 17 Dec 2009
Posts: 7

PostPosted: Sat Apr 18, 2020 9:15 am   
 
Thank you, that helps!
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