[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Some questions that I'm sure are rather simple
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Some questions that I'm sure are rather simple

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Rivius   (95 posts)  [Biography] 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?
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (21,321 posts)  [Biography] 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?


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


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] 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. :)
[Go to top] 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.


3,513 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]