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.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Lua ➜ Help with syntax

Help with syntax

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


Posted by DanaLea73   USA  (9 posts)  Bio
Date Sat 11 Jun 2011 06:47 PM (UTC)
Message
I'm using Nick's code from here http://www.gammon.com.au/forum/?id=8847 and modifying it for my own.. He's got lines like this in his code..

k = { range = "+32 to +41", colour = "darkmagenta", },

but the colors I want to use are in RGB format, can I change it to this?

k = { range = "+32 to +41", colour = 255,255,255 },



-- also --

I want to change the message the mud gives me completely, from:
MobName would crush you like a bug!
to:
MobName is 21 - 32 levels higher then you.
with a specific color, in this case, "255,192,0".

It won't let me post all the code, says this message is too long.

This is a work in progress.. but I don't know where to find the info I need. The Lua site to too much information, and if it's here I can't find it.


Yes I'm a girl. Yes I play muds. Get over it.
Top

Posted by Fiendish   USA  (2,535 posts)  Bio   Global Moderator
Date Reply #1 on Sat 11 Jun 2011 06:57 PM (UTC)

Amended on Sat 11 Jun 2011 06:59 PM (UTC) by Fiendish

Message
you want to use something like (this example is blue)

k = { range = "+32 to +41", colour = RGBColourToName(0xFF0000) }

where the hexadecimal value (indicated by the leading 0x) is in this case 255 BLUE (FF), 0 GREEN (00), 0 RED (00) in that order. So whatever color values you want between 0 and 255, convert those numbers to hex and then lump them together in BGR order.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by DanaLea73   USA  (9 posts)  Bio
Date Reply #2 on Sat 11 Jun 2011 07:01 PM (UTC)

Amended on Sun 12 Jun 2011 12:35 AM (UTC) by DanaLea73

Message
that's easy enough, there are many converters on the web to change the RGB to hexadecimal. (for that matter, I could have found a converter for the names..hmm)

how about subbing my text for the mud output?

Yes I'm a girl. Yes I play muds. Get over it.
Top

Posted by Fiendish   USA  (2,535 posts)  Bio   Global Moderator
Date Reply #3 on Sat 11 Jun 2011 07:14 PM (UTC)
Message
substitution is typically done by omitting from output and then doing a colournote

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #4 on Sun 12 Jun 2011 01:58 AM (UTC)
Message
DanaLea73 said:

He's got lines like this in his code..

k = { range = "+32 to +41", colour = "darkmagenta", },

but the colors I want to use are in RGB format, can I change it to this?

k = { range = "+32 to +41", colour = 255,255,255 },



The simplest change is to use the "HTML" colours which can be used where colour names are used. For example:


k = { range = "+32 to +41",     colour = "#A1B2FF", },


Where in this case A1 is the red component, B2 is the green component and FF is the blue component. The "#" is what distinguishes it from a name lookup.

If you want to see all the inbuilt colour names and what their codes are (apart from using the colour picker), type this in the scripting Immediate window:


Debug "colours"


That also shows the associated colour in the output window.

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


15,597 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.