Register forum user name Search FAQ

Gammon Forum

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.
 Entire forum ➜ MUSHclient ➜ General ➜ Simulate color

Simulate color

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


Posted by Renz   (1 post)  Bio
Date Fri 10 Jul 2009 08:21 AM (UTC)
Message
How do I use Simulate in Lua to output coloured text? Also, can it output italicized or bolded text?
Top

Posted by Nick Gammon   Australia  (23,121 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 10 Jul 2009 08:40 AM (UTC)

Amended on Fri 10 Jul 2009 08:42 AM (UTC) by Nick Gammon

Message
Don't use Simulate, use AnsiNote:

http://www.gammon.com.au/scripts/doc.php?function=AnsiNote

And for just coloured output, the easiest is ColourNote, which lets you use any RGB colour, not just the 16 ANSI ones.

http://www.gammon.com.au/scripts/doc.php?function=ColourNote

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Teapot   Australia  (9 posts)  Bio
Date Reply #2 on Sat 25 Jul 2009 05:28 AM (UTC)

Amended on Sat 25 Jul 2009 05:29 AM (UTC) by Teapot

Message
This is a bit of a late reply, but I was just wondering how to do this myself.

If you're using Simulate() to test triggers rather than add a note (for which, like Nick said, it's easier to use a note function), you can insert ANSI sequences to add colour and other ANSI-ish-things. This is very useful when testing colour triggers.

The easiest way to insert ANSI sequences in MUSHclient is to use its ANSI() function. For instance, to test bold green text:
Simulate (ANSI(1,32) .. "Hello!  I'm bold green.\n" .. ANSI(0))


See http://www.gammon.com.au/scripts/doc.php?function=ANSI for for more information and the ANSI colour codes.
Top

Posted by Nick Gammon   Australia  (23,121 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 25 Jul 2009 06:16 AM (UTC)
Message
Quote:

Also, can it output italicized or bolded text?


In my earlier reply I had forgotten about NoteStyle - this lets you do italic, bold, inverse and underlined text for the next note (until the end of the current line).

http://www.gammon.com.au/scripts/doc.php?function=NoteStyle

You are right, Simulate is appropriate for testing triggers (or you can use the Game menu -> Test Trigger dialog).

To simply display coloured text (eg. in a trigger) it is better to use ColourNote, Note, ColourTell, in conjunction with NoteStyle if required.

- 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.


14,396 views.

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

Go to topic:           Search the forum


[Go to top] top

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