The online racing simulator
Text Colours?
(21 posts, started )
Text Colours?
Hello All.

I am a Insim Developer. What are ALL the color codes?

I know

^0 = Black
^1 = Red
^2 = Green
^3 = Yellow
^4 = Blue
^5 = Pink
^6 = Light Blue ish...
^7 = White
^8 = Default

What about the OTHER colors as seen on Reality Cruise's Menu Thing?
I Think Just This Colors Exist.
Maybe on Reality Cruise There are buttons?
Quote from marcel1 :I Think Just This Colors Exist.
Maybe on Reality Cruise There are buttons?

I would think so yes. The colors you posted are what Scawen used from the ECMA-48 standard. The other colors your talking about are from buttons, where they use the lowest three bits from BTN's BStyle to select the color you want (A number 1 - 7, 0 for none).
Quote from Dygear :I would think so yes. The colors you posted are what Scawen used from the ECMA-48 standard. The other colors your talking about are from buttons, where use use the lowest three bits from BTN's BStyle to select the color you want (A number 1 - 7, 0 for none).

for none you don't need the ^0
Quote from stuntguy3000 :for none you don't need the ^0

No, no, I was referring to the three lower bits of the InSim packet BTN's BStyle property, not the Text Escape Codes. Anyway, as you said ^0 produces black not no color. Although technicality black is the absence of color, white is the presents of all colors, but that's neither here not there and I digress.

Quote from stuntguy3000 :^6 = Light Blue ish...

That's called Cyan.

Quote from stuntguy3000 :^8 = Default

^8 is default color only, ^9 is default color and code page.
#6 - PoVo
The RC app uses ^8 and C1 button style
Quote from PoVo :The RC app uses ^8 and C1 button style

*facepalm* You know it's not called C1 right. Also adding ^8 to the first two bytes does nothing but take up space on the Msg field?

[Edit]You know what, I'm just going to post a proper explanation that can be used in the LFS Wiki in the InSim section. (In the next 24 - 48 hours.)
The BStyle colors are:

// colour 0 : light grey (not user editable)
// colour 1 : title colour (default:yellow)
// colour 2 : unselected text (default:black)
// colour 3 : selected text (default:white)
// colour 4 : ok (default:green)
// colour 5 : cancel (default:red)
// colour 6 : text string (default:pale blue)
// colour 7 : unavailable (default:grey)

Can you show example, how to send it. In C# or PHP?
I already started working on an example, it's exposed some flaws in PRISM that I'm fixing. I would expect to have a full write up on this, source code for you guys and a new version of PRISM by the end of today.
Quote from misiek08 :Can you show example, how to send it. In C# or PHP?

It's basically just about setting the bits to turn the colours on and off. For instance if you wanted to make a button that was clickable, had a light background and used the title colour (colour 1), you would do this:

BStyle = ISB_CLICK | ISB_LIGHT | [b]1[/b]

Or if you wanted to use the cancel colour (colour 5):

BStyle = ISB_CLICK | ISB_LIGHT | [b]5[/b]

Here is a pyinsim example which sends a button with one of those bits set:

import pyinsim

insim = pyinsim.insim('127.0.0.1', 29999, Admin='', IName='Example')

insim.send(pyinsim.ISP_BTN,
ReqI=255,
ClickID=1,
[b]BStyle=pyinsim.ISB_CLICK | pyinsim.ISB_LIGHT | 5[/b],
T=60,
L=10,
W=40,
H=10,
Text='Button Example')

pyinsim.run()

Which creates a button like below.
Attached images
button_colour.jpg
A little more in-depth example of this would be:


<?php 
php
class colorButtons extends Plugins
{
    const 
NAME 'Color Buttons Example';
    const 
AUTHOR 'Mark \'Dygear\' Tomlin';
    const 
VERSION '1.0.0';
    const 
DESCRIPTION 'Shows how to use colors in buttons with BStyle & Color Escape Codes.';

    public function 
__construct()
    {
        
$this->registerSayCommand('prism help buttons''cmdHelpButtons''Shows an array of buttons with diffent color options enabled.');
    }

    public function 
cmdHelpButtons($cmd$plid$ucid)
    {
        
$X 25;    $W 10;
        
$Y 50;    $H 10;

        
$BTN = new IS_BTN;
        
$BTN->UCID($ucid)->ClickID(0)->W($W)->H($H);

        
# X Axis Header
        
for ($i 0$i <= 9; ++$i)
            
$BTN->ClickID(++$BTN->ClickID)->L($X + ($i $W) + 1)->T($Y - ($H 1))->BStyle(ISB_DARK)->Text("^$i$i")->Send();

        
# Y Axis Header
        
for ($i 0$i <= 7; ++$i)
            
$BTN->ClickID(++$BTN->ClickID)->L($X $W)->T($Y + ($i $H) + 1)->BStyle(ISB_DARK $i)->Text($i)->Send();

        
# Grid Items
        
for ($y 0$y <= 7; ++$y)
        {
            for (
$x 0$i 0$x <= 9; ++$x, ++$i)
                
$BTN->ClickID(++$BTN->ClickID)->L($X + ($x $W) + 1)->T($Y + ($y $H) + 1)->Text("{$y}^$i{$x}")->BStyle(ISB_LIGHT $y)->Send();
        }
    }
}
?>

With the image attached being it's out put.
Attached images
ColorCodes&BStyle.png
Great example, thanks. I didn't know about the colors other than ^1-8.

But maybe developers should allow programmers to send RGB/HSV color code to set it. It would be very helpful in new projects.
Colored Messages in pyinsim
I feel embarrassed asking, but how to you send colored messages?
Doing this:
insim.send(pyinsim.ISP_MST, Msg='^1Red')

Gives me the in-game result:
Host:^1Red

instead of

Host:Red

Based on what I read in LFSLapper, my assumption is that what I did above should work.
#16 - PoVo
Quote from Mountaindewzilla :I feel embarrassed asking, but how to you send colored messages?
Doing this:
insim.send(pyinsim.ISP_MST, Msg='^1Red')

Gives me the in-game result:
Host:^1Red

instead of

Host:Red

Based on what I read in LFSLapper, my assumption is that what I did above should work.

insim.send(pyinsim.ISP_MST, Msg='[B]/msg[/B] ^1Red')

Quote from Mountaindewzilla :I feel embarrassed asking, but how to you send colored messages?
Doing this:
insim.send(pyinsim.ISP_MST, Msg='^1Red')

Gives me the in-game result:
Host:^1Red

instead of

Host:Red

Based on what I read in LFSLapper, my assumption is that what I did above should work.

Yup, that's correct. They are special characters that tell LFS to switch font colour.

Note: this also works in the game itself, in fact back in S1 this was the only way to change the text colour in the game

Quote from PoVo :
insim.send(pyinsim.ISP_MST, Msg='[B]/msg[/B] ^1Red')


The /msg command is optional.
#18 - PoVo
Quote from DarkTimes :The /msg command is optional.

I don't think you understood what he wanted.

Basically if he sends the message without the "/msg " then the message in the server is "host : Red" but he wants it to output "Red", so the "/msg " is essential (unless pyinsim has a feature built in to send the "/msg " automatically before)
Well if that's what he means his post doesn't say that. It says he's getting 'host: ^7red' when he wants 'host: red'.
#20 - PoVo
Quote from DarkTimes :Well if that's what he means his post doesn't say that. It says he's getting 'host: ^7red' when he wants 'host: red'.

Oh never mind, my bad, I read the whole post wrong
Thank you, PoVo and DarkTimes!

Text Colours?
(21 posts, started )
FGED GREDG RDFGDR GSFDG