|
Anthalas Newbie
Joined: 17 Dec 2009 Posts: 7
|
Posted: 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! |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4715 Location: Pensacola, FL, USA
|
Posted: 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 |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4715 Location: Pensacola, FL, USA
|
Posted: 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 |
|
|
|
Anthalas Newbie
Joined: 17 Dec 2009 Posts: 7
|
Posted: 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! |
|
|
|
Anthalas Newbie
Joined: 17 Dec 2009 Posts: 7
|
Posted: 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?
|
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4715 Location: Pensacola, FL, USA
|
Posted: 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 |
|
|
|
Anthalas Newbie
Joined: 17 Dec 2009 Posts: 7
|
Posted: Sat Apr 18, 2020 9:15 am |
Thank you, that helps!
|
|
|
|
|
|