mIRC Homepage
Posted By: RusselB Colours in ini file - 12/08/08 06:57 AM
I've been doing a bit of testing with this, and can't seem to find how to do it. I have messages that I want stored in an ini file, but some of the messages have colour codes in them. Right now the messages are stored in separate text files, and they handle colour codes with no problem.

Is it possible to store the messages in ini format and maintain the colour codes, or is there an alternative that I'm missing.

I'm trying to reduce the number of text files that have to be transferred/updated when I send a copy of the bot to one of the backups.
Posted By: maroon Re: Colours in ini file - 12/08/08 07:24 AM
I've seen this issue come up before.
https://forums.mirc.com/ubbthreads.php?ubb=showflat&Number=176128
I'm afraid the only way you can safely put colorcodes into ini's is to either $encode them before writing, or do a search+replace to change them into values that can be written yet won't be appearing in the strings you'll be writing.
Posted By: Pivo Re: Colours in ini file - 12/08/08 12:53 PM
You don't actually have to use characters that won't appear in the string... and I guess thats not even possible, since text messages from other chatters are not calculable. (I suppose those messages are individually editable? :P)
But if you escape that escaping-character, too, there won't be any problems...
Code:
var %encode = $replacex($1-,&,&1,$chr(3),&2,$chr(15),&3)
var %decode = $replacex($1-,&3,$chr(15),&2,$chr(3),&1,&)
Posted By: RusselB Re: Colours in ini file - 12/08/08 10:42 PM
Thanks for the replies. Looks like I might go with $encode/$decode method, as the information is stored on a bot, and, currently, only two people have authorization to change the information.. The channel founder and myself, the bot 'runner'.
© mIRC Discussion Forums