messagemode - getting more than 1 argument
I've been using messagemode for a few of my plugins and was wondering if you could use more than 1 argument on the same messagemode?
i.e. custom_colour:255 255 255 For a command that requires 3 arguments won't work. Is there any way around this? |
Re: messagemode - getting more than 1 argument
You could parse the text. But that defeats the point of using message mode, imo. You will need to use some kind of delimiter when separating your arguments. So, it will be nearly just bad as having to go into your console and typing it.
|
Re: messagemode - getting more than 1 argument
So really, if I were to use messagemode then I'd need to use it for each argument... that sucks.
|
Re: messagemode - getting more than 1 argument
Quote:
PHP Code:
|
Re: messagemode - getting more than 1 argument
You could use hex (e.g. White = "FFFFFF"). It's only one argument but you would still need to parse it into decimal of course.
|
Re: messagemode - getting more than 1 argument
Quote:
What is hex for cyan? |
Re: messagemode - getting more than 1 argument
I'm not sure exactly what you're trying to do or if this will apply to messagemode but here's a more efficient way of storing RGB values.
PHP Code:
|
Re: messagemode - getting more than 1 argument
Quote:
EDIT: Google. I don't think I will forget now (for a while). Why not use HSV? Sounds fun. |
Re: messagemode - getting more than 1 argument
Quote:
Quote:
R = (RGB & 0xFF0000) >> 16; G= (RGB & 0xFF00) >> 8; B = RGB & 0xFF; The mistake lies in the use of the bitwise not, as ~0xFF00 is not 0x00FF but 0xFFFF00FF, therefore any error in the encoding would screw things over. |
Re: messagemode - getting more than 1 argument
Quote:
For anyone that is unsure of what is taking place: The RGB holder 1111 1111 1111 1111 1111 1111 R = RGB >> 16 For red we want bits 17 through 24 so a shift of 16 to the right will leave us with only those bits: 0000 0000 0000 0000 1111 1111 G = ( RGB >> 8 ) & ~0xFF00 For green we need bits 9 through 16 so we need to shift right 8 and then the and-not operation to mask bits 9-16. (bits 1-8 now hold green) RGB >> 8 0000 0000 1111 1111 1111 1111 Then do our bitmask, leaving just the green value ( RGB >> 8 ) & ~0xFF00 0000 0000 0000 0000 1111 1111 B = RGB & ~0xFFFF00 For blue we need bits 1-8 only so a bit-mask for bits 9-24 can be used. RGB & ~0xFFFF00 0000 0000 0000 0000 1111 1111 |
| All times are GMT -4. The time now is 22:38. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.