Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ multiple aliases on one line
|
multiple aliases on one line
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Crimson_mordum
(4 posts) Bio
|
| Date
| Fri 24 Mar 2006 08:02 PM (UTC) |
| Message
| i am trying to set up an alias to color certain words.. however, at the moment, i canot ge tit to color more then a single thing on a line... as an example,
*kuvoc* sends %1&09K&00&01u&16v&00&01o&09c&16%2
*solbet* sends %1&00&12S&00&04o&00&03l&00&00&11b&00&12e&00&04t&00&16%2
but if i have both words on the same line, i can only get it to color one of them. I have tried fixing it, but it has yet to work. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Fri 24 Mar 2006 10:05 PM (UTC) Amended on Fri 24 Mar 2006 10:38 PM (UTC) by Nick Gammon
|
| Message
| You need to do the replacements in a single alias. You can set "keep evaluating" but that would result in multiple sends. Using a bit of Lua scripting you can achieve that. I assume the line itself can be identified in some way (eg. chat xxx). This example assumes the line starts with "chat" but you can change that to whatever it is. Then inside the script we do a lookup of the words we want to do the replacement on. To expand the replacements, simply add to the table in the format shown.
<aliases>
<alias
match="chat *"
enabled="y"
send_to="12"
sequence="100"
>
<send>
replacements = {
["*kuvoc*"] = "&09K&00&01u&16v&00&01o&09c&16",
["*solbet*"] = "&00&12S&00&04o&00&03l&00&00&11b&00&12e&00&04t&00&16",
}
Send ("chat " .. string.gsub ("%1", "%%*%%a+%%*",
function (str) return replacements [str] or str end ))
</send>
</alias>
</aliases>
I assumed the asterisks were part of it, if not use this:
<aliases>
<alias
match="chat *"
enabled="y"
send_to="12"
sequence="100"
>
<send>
replacements = {
kuvoc = "&09K&00&01u&16v&00&01o&09c&16",
solbet = "&00&12S&00&04o&00&03l&00&00&11b&00&12e&00&04t&00&16",
}
Send ("chat " .. string.gsub ("%1", "%%a+",
function (str) return replacements [str] or str end))
</send>
</alias>
</aliases>
Don't be put off by all the & above - that is just part of the way the & symbol is represented in the XML code. Once you copy and paste it into your alias list, the replacement text will look like how you had it.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Crimson_mordum
(4 posts) Bio
|
| Date
| Reply #2 on Fri 24 Mar 2006 11:28 PM (UTC) Amended on Fri 24 Mar 2006 11:33 PM (UTC) by Crimson_mordum
|
| Message
| | downside, i know nothing about using the scripts >.<.. the asterisks are the default variable characters... thus on the return, i had %1 and %2 to match text before and after | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Sat 25 Mar 2006 01:20 AM (UTC) |
| Message
| You don't really need to know scripting. Copy that second example I gave and paste into your alias list. See this post for how that works:
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4777
That refers to triggers, but aliases are the same technique.
Then enable scripting (world configuration, scripting tab), and make sure the language is set to Lua.
Then the alias should just work, amending it slightly if necessary to change "chat" to whatever sort of line you are matching on. Then add more words to the list following the format in the alias. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Stern
(1 post) Bio
|
| Date
| Reply #4 on Wed 29 Mar 2006 02:31 PM (UTC) |
| Message
| I am very unexperienced with MUSHclient but I have been trying to make it colour different words on the same line. Is there an option or something I can tick so that it allows other triggers to be put in the same line? for example I have one trigger that colours "bodyguard" to orange, and another that triggers "samurai" to orange. But if there is a line that says
"A bodyguard and a samurai are standing here"
the only one that gets coloured is the one thats higher up in my triggers list. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #5 on Thu 30 Mar 2006 12:28 AM (UTC) |
| Message
| | Check "keep evaluating" for both triggers. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
21,623 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top