Some questions that I'm sure are rather simple

Posted by Rivius on Fri 24 Sep 2010 09:38 PM — 4 posts, 20,978 views.

#0
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?
Amended on Fri 24 Sep 2010 10:23 PM by Rivius
Netherlands #1
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.
Amended on Fri 24 Sep 2010 10:02 PM by Worstje
Australia Forum Administrator #2
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?


Template:function=NoteStyle
NoteStyle

The documentation for the NoteStyle script function is available online. It is also in the MUSHclient help file.



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")

Netherlands #3
I totally missed that one... despite looking for it. I feel like an idiot. Thanks for the correction, Nick. :)