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
➜ Lua
➜ Some questions that I'm sure are rather simple
Some questions that I'm sure are rather simple
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Rivius
(99 posts) Bio
|
Date
| Fri 24 Sep 2010 09:38 PM (UTC) Amended on Fri 24 Sep 2010 10:23 PM (UTC) by Rivius
|
Message
| In my MUDs I use a lot of notes in various colours in order to keep proper track of everything that comes up and help me mentally filter out those things that really don't matter.
I use colournote to do that. However, I was wondering if there was a way to bold specific words in a colournote. Like say I wanted to send:
"John casts the GREEN spell, use the BLUE spell"
I might want to make "GREEN" and "BLUE" bold. How would I go about doing this?
Also, while this is of little importance to me, I'll ask it anyway in hopes that I can get an answer:
I have a trigger than takes a string from the game, let's say
You recovered balance of your * arm.
I'd like to format it, so that the word starts with a capital, so when I sent my custom note I could say something more like
"Left arm back!"
rather than
"left arm back!"
Also, one final question:
How do you send an alias via a script? I know you can use Send("") but that sends a command directly to the world. What if I want to send an alias defined in mushclient?
| Top |
|
Posted by
| Worstje
Netherlands (899 posts) Bio
|
Date
| Reply #1 on Fri 24 Sep 2010 10:01 PM (UTC) Amended on Fri 24 Sep 2010 10:02 PM (UTC) by Worstje
|
Message
| Funny, never heard that request before. I don't believe you can do bolding in combination with ColourNote(). If you are content sticking to the pure ANSI colours, you can probably use the ANSI function to some degree, or if you are using MXP, you can probably use one of those MXP tags to achieve what you need.
Did you try to combine ColourTell()s with ColourNote()s of different colours? That way you might not need bold - just make the coloured bits stand out against a duller colour.
Now, the formatting thing... that is pretty simple if you think about it. All you need is to realize you need the first letter upcased. E.g.
function UpperFirstLetter(text)
return text:sub(1,1):upper() .. text:sub(2)
end
-- Test it.
Note(UpperFirstLetter("this sentence begins with an uppercase letter."))
And finally, your last request... have a look into the Execute() command. That command tests against aliases and such, which is what you need, or if there is no such alias, it will cause it to be sent to the world.
If you aren't sure you need to call an actual alias, I would recommend you just call the script involved with an alias. Triggers/Aliases/Timers can point to scripts seperately from the 'Send to: Script' behaviour (which I personally prefer to use), but you could also simply call another function you create from your trigger, and call that at both places. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #2 on Fri 24 Sep 2010 10:21 PM (UTC) |
Message
|
Rivius said:
I use colournote to do that. However, I was wondering if there was a way to bold specific words in a colournote. Like say I wanted to send:
"John casts the GREEN spell, use the BLUE spell"
I might want to make "GREEN" and "BLUE" bold. How would I go about doing this?
Combine that with ColourTell and ColourNote.
For example:
ColourTell ("cyan", "", "John casts the ")
NoteStyle (1) -- bold
ColourTell ("green", "", "GREEN")
NoteStyle (0) -- normal
ColourTell ("cyan", "", " spell, use the ")
NoteStyle (1) -- bold
ColourTell ("blue", "", "BLUE ")
NoteStyle (0) -- normal
ColourNote ("cyan", "", "spell")
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Worstje
Netherlands (899 posts) Bio
|
Date
| Reply #3 on Fri 24 Sep 2010 10:29 PM (UTC) |
Message
| I totally missed that one... despite looking for it. I feel like an idiot. Thanks for the correction, Nick. :) | 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.
16,683 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top