Changing text colours (one for you clever cloggses out there but I bet it's not as easy as it looks)


I was recently shown how to tweak the ui.js file to include other colours so I could have a play… and very good it is too!

But I can’t seem to get this combination to work - and I don’t *think* that it is just me being rubbish… but you never can tell…

I’m using the colour in [brackets] as an example but…

1234567890 ======> 1234567890


[red] 1234567890 [red] ======> 1234567890 (red!)


1234567890 helppp! 0987654321 =========> 1234567890 help! 0987654321

all work ok…


[red] 1234567890 [/red] helppp! 0987654321 =========> 1234567890 (red!)

has the “help! 0987654321” missing???!

but what is weirder is that if I remove the bold - and add a different colour after then it works… well, kinda - I just get the second text in the CS “standard” non-added black

[red] 1234567890 [/red] helppp! [green] 0987654321 [/green] =========> 1234567890 (red!) help! 0987654321 (normal cs black)

however when I try to do more text in the same line without it being in a different colour, ie:

[red] 1234567890 [/red] helppp! [green] 0987654321 [/green] =========> 1234567890 (red!)

then “with help! 0987654321” gets missed off again!

Now I’m no CS uber skiller - but does this not seem odd? I mean it either works or it doesn’t… but this seems to jump all over the place… It may just mean that I can’t have the “1234567890” bit in BOLD AND COLOUR… if I want something to come after it on the same line thassall… but if anyone knows a fix it would be mightily appreciated!

(edit) ACTUALLY… [red] text one [/red] [red] text two [/red] gets my desired results of text one (colour+bold) and text two (normal colour)… but seriously though… weird!


AHEM, Nevermind.


EDIT: Vanilla forum formatting GRRR!!! :@

Can you link me to your game? I want to look at how all the HTML is parsing.
It might also help to copy and paste your ui.js edits here?



msg = (msg+"").replace(/&/g, ‘&’)
.replace(/</g, ‘<’)
.replace(/>/g, ‘>’)
.replace(/"/g, ‘"’)
.replace(/\[b\\]/g, ‘’)
.replace(/\[\/b\]/g, ‘
.replace(/\[pad\]/g, ‘’)
.replace(/\[\/pad\]/g, ‘</span’)
.replace(/\[col\]/g, ‘’)
.replace(/\[\/col\]/g, ‘</span’)
.replace(/\[mail\]/g, ‘’)
.replace(/\[\/mail\]/g, ‘</span’)
.replace(/\[nav\]/g, ‘’)
.replace(/\[\/nav\]/g, ‘</span’)
.replace(/\[cpu\]/g, ‘’)
.replace(/\[\/cpu\]/g, ‘</span’)
.replace(/\[off\]/g, ‘’)
.replace(/\[\/off\]/g, ‘</span’)
.replace(/\[ryyl\]/g, ‘’)
.replace(/\[\/ryyl\]/g, ‘</span’)
.replace(/\[i\\]/g, ‘’)
.replace(/\[\/i\]/g, ‘

edit This doesn’t look right in the forum - even with the pre /pre bits… it’s correct in my ui.js file