Text Color 2.05.0

By Jonesy44 on Aug 16, 2008

Latest script.. wanted a text color'er that worked real well and had plenty of options and a dialog so here tis.

To use this script;

  • Paste it into your remotes (ALT+R)
  • Type /colors or right-click - Text-Colors
    Select you style, pick colors (background are allowed, and now, WHITE color is selectable)

MDX
MDX.dll is auto-downloaded when you install this script

v2.05.0
-server specific black/whitelist eg. EzzyChat?#j44 for EzzyChat Specific.

v2.04.0
-added a menu for channels to allow/disallow whitelist/blacklist channels without having to open the dialog. No new screenshot.

v2.03.0
-added channel limits (allow/disallow/all)
-added bold/underline
-bug fix
-faster inputs with regex
Image

v2.02.5 - OLD SCREENSHOT
was requested so here are the updates, bug fixes etc. White color is now allowed and mdx is on a download socket.
Image

; Written by Jonesy44, Download alias structure by "FordLawnmower" & "Imk0tter"
; Version 2.05.0
; First Release: 17th August, 2008
; Updated: 8nd August, 2010
; MDX.dll found at: http://wfs.myartsonline.com/downloads/mdx.dll
menu * {
  Text Colors $chr(9) /colors:colors
}
menu channel {
  $ChannelCheck($chan):ChannelCheck
}
alias ChannelCheck {
  if $isid {
    if !%colors.chans { return }
    elseif %colors.chans == 1 {
      if $findtok(%colors.chans.list,$+($network,?,#),44) { set %colors.cmd remove $+($network,?,#) | return Blacklist # colors on $network }
      else { set %colors.cmd add $+($network,?,#) | return Whitelist # colors on $network }
    }
    elseif %colors.chans == 2 {
      if $findtok(%colors.chans.list,$+($network,?,#),44) { set %colors.cmd remove $+($network,?,#) | return Allow # colors on $network }
      else { set %colors.cmd add $+($network,?,#) | return Disallow # colors on $network }
    }
  }
  else {
    echo -a %colors.cmd
    tokenize 32 %colors.cmd
    if $$1 == add { set %colors.chans.list $+(%colors.chans.list,$chr(44),$$2) }
    elseif $$1 == remove { set %colors.chans.list $remtok(%colors.chans.list,$$2,0,44) }
    if $left(%colors.chans.list,1) == $chr(44) { set %colors.chans.list $right(%colors.chans.list,-1) }
    unset %colors.cmd
  }
}
alias Colors {
  if $MDX == -1 { 
    if $input(To use this script you need MDX.dll - Do you want to download it now?,yq,Download MDX?) == $true { GetMDX }
  }
  else { dialog $iif($dialog(colors),-v,-m) Colors Colors }
}
alias MDX { return $iif($isfile($qt(MDX.dll)),$shortfn($qt(MDX.dll)),-1) }
alias ColorsSecondary return $gettok(%colors.sel,2,44)
dialog Colors {
  title "Color Selector [©J44]"
  size -1 -1 100 70
  option dbu
  radio "All text colored", 100, 3 2 54 10
  radio "First letters", 101, 3 12 54 10
  radio "None", 102, 3 22 54 10
  box "", 103, 60 -10 2 45
  box "", 104, 0 31 100 5
  check "Bold", 105, 3 36 54 9
  check "Underline", 106, 3 44 54 9
  box "", 107, 0 50 100 5
  text "Color Code", 200, 65 2 30 9, center
  edit %colors.sel, 201, 65 11 30 10
  text "", 202, 65 23 30 7, center
  button "Set", 300, 2 56 58 13
  button "Cancel", 301, 62 56 36 13
  button "Options", 302, 62 38 36 13
}
on *:Dialog:Colors:*:*: {
  if $devent == init {
    dll $MDX SetMircVersion $version
    dll $MDX MarkDialog $dname
    did -cf colors $iif(!%colors.setting,102,$iif(%colors.setting = 1,100,101))
    did $iif(%colors.bold,-c,-u) Colors 105
    did $iif(%colors.underline,-c,-u) Colors 106
    var %colors = WHITE BLACK D.BLUE D.GREEN RED BROWN PURPLE ORANGE YELLOW L.GREEN S.BLUE L.BLUE D.BLUE PINK D.GREY L.GREY
    did -rae colors 202 $gettok(%colors,$calc($gettok($did(201).text,1,44) +1),32)
    if !$gettok(%colors.sel,2,44) { dll $MDX SetColor 202 text $color($did(201).text) }
    else {
      dll $MDX SetColor 202 text $color($gettok($did(201).text,1,44))
      dll $MDX SetColor 202 background $color($gettok($did(201).text,2,44))
      dll $MDX SetColor 202 textbg $color($gettok($did(201).text,2,44))
    }
    if (!%colors.setting) did -b colors 201,202
  }
  elseif $devent == sclick {
    if $did == 100 {
      did -e colors 201,202,105,106,302
      did $iif($did(201).text isnum 0-15 || ($gettok($did(201).text,1,44) isnum 0-15 && $gettok($did(201).text,2,44) isnum 0-15),-e,-b) colors 300
    }
    elseif $did == 101 {
      did -e colors 201,202,105,106,302
      did $iif($did(201).text isnum 0-15 || ($gettok($did(201).text,1,44) isnum 0-15 && $gettok($did(201).text,2,44) isnum 0-15),-e,-b) colors 300
    }
    elseif $did == 102 {
      did -b colors 201,202,105,106,302
      did -e colors 300
    }
    elseif $did == 105 { set %colors.bold $iif($did(105).state,1,0) }
    elseif $did == 106 { set %colors.underline $iif($did(106).state,1,0) }
    elseif $did == 300 {
      $iif($did(102).state,unset,set) %colors.setting $iif($did(100).state,1,2)
      if $did(100).state || $did(101).state { set %colors.sel $did(201).text }
      dialog -x colors
    }
    elseif $did == 301 { dialog -x colors }
    elseif $did == 302 { dialog $iif($dialog(ColorsOptions),-v,-m ColorsOptions) ColorsOptions }
  }
  elseif $devent == edit {
    if $did == 201 {
      var %colors = WHITE BLACK D.BLUE D.GREEN RED BROWN PURPLE ORANGE YELLOW L.GREEN S.BLUE L.BLUE D.BLUE PINK D.GREY L.GREY
      if !$regex($did(201).text,$chr(44)) {
        did $iif($did(201).text isnum 0-15,-e,-b) colors 300
        did $iif($did(201).text isnum 0-15,-rae,-rb) colors 202 $gettok(%colors,$calc($did(201).text +1),32)
        dll $MDX SetColor 202 text $color($did(201).text)
        dll $MDX SetColor 202 background reset
        dll $MDX SetColor 202 textbg reset
      }
      else {
        if $gettok($did(201).text,1,44) isnum 0-15 && $gettok($did(201).text,2,44) isnum 0-15 {
          did -e colors 300
          did -rae colors 202 $gettok(%colors,$calc($gettok($did(201).text,1,44) +1),32)
          dll $MDX SetColor 202 text $color($gettok($did(201).text,1,44))
          dll $MDX SetColor 202 background $color($gettok($did(201).text,2,44))
          dll $MDX SetColor 202 textbg $color($gettok($did(201).text,2,44))
        }
        else {
          did -b colors 300
          did -rb colors 202
        }
      }
    }
  }
}
dialog ColorsOptions {
  title "Colors Options [©J44]"
  size -1 -1 100 60
  option dbu
  radio "Allow these channels", 101, 3 2 70 10
  radio "Disallow these channels", 102, 3 12 70 10
  radio "Allow all channels", 103, 3 22 70 10
  edit "", 201, 3 33 94 10
  button "Done", 301, 2 45 58 13
  button "?", 302, 62 45 36 13
}
on *:Dialog:ColorsOptions:*:*: {
  if $devent = init {
    did -ra ColorsOptions 201 %colors.chans.list
    if !%colors.chans { did -c ColorsOptions 103 | did -b ColorsOptions 201 }
    elseif %colors.chans == 1 { did -c ColorsOptions 101 }
    elseif %colors.chans == 2 { did -c ColorsOptions 102 }
  }
  elseif $devent = sclick {
    if $did isnum 101-103 {
      if $did == 101 { set %colors.chans 1 | did -e ColorsOptions 201 }
      elseif $did == 102 { set %colors.chans 2 | did -e ColorsOptions 201 }
      else { set %colors.chans 0 | did -b ColorsOptions 201 }
    }
    elseif $did == 301 {
      if $calc($count($did(201).text,$chr(35)) -1) > $count($did(201).text,$chr(44)) {
        if $input(You have specified more channels than comma spaces. If you're sure it's correct press "Yes'". Else you can edit by pressing "No" $crlf $crlf $+ $&
          Each channel must be seperated by a comma. Eg. $+(#123,$chr(44),#xyz,$chr(44),#nmo),yq) == $false {
          halt
        }
      }
      else { 
        %colors.chans.list = $did(201).text
        dialog -x ColorsOptions
      }
    }
    elseif $did == 302 {
      var %msg = Some channels have more strict rules for the text formatting that is used. $&
        Some don't allow colors / bold / underline / backgrounds or a mixture of all of those. $crlf $crlf $+ $&
        In this case select either only the channels you want to use the colored text on or the channels you don't want the colored text to appear on. $crlf $crlf $+ $&
        For the channels use a COMMA to seperate values. 'EzzyChat?#lobby' for server specific or '#lobby' for non-specific $crlf $crlf $+ $&
        Current network is: $network
      noop $input(%msg,io,Information)
    }
  }
}
on *:INPUT:*: {
  if (!$regex($1,/^\//)) && (c !isincs $chan($chan).mode) {
    if %colors.setting {
      var %allow = 0
      if (!%colors.chans) { %allow = 1 }
      else {
        if $findtok(%colors.chans.list,$chan,44) { var %found = 1 }
        elseif $findtok(%colors.chans.list,$+($network,?,$chan),44) { var %found = 1 }
        if %colors.chans == 1 { var %allow = $iif(%found == 1,1,0) }
        elseif %colors.chans == 2 { var %allow = $iif(%found == 1,0,1) }
      }
    }
    if %colors.setting == 1 && %allow = 1 {
      msg $active $+($iif(%colors.bold,),$iif(%colors.underline,),,$base($gettok(%colors.sel,1,44),10,10,2),$iif($regex(%colors.sel,$chr(44)),$chr(44),),$base($gettok(%colors.sel,2,44),10,10,2),$$1-)
      ;enter a custom regex here if you like
      ;if you still want to use the allow/disallow functions
      ;but not only simple coloring.
      halt
    }
    elseif %colors.setting == 2 && %allow = 1 {
      ;first letter of words only msg
      var %txtColored = $regsubex($$1-,/\W(.)/giS,$+($chr(32),,$base($gettok(%colors.sel,1,44),10,10,2),\t,))
      msg $active $+($iif(%colors.bold,),$iif(%colors.underline,),%txtColored)
      halt
    }
  }
}
; Download the MDX.dll file. 
alias GetMDX {
  noop $input(MDX.dll is now downloading. The color selector will open when the download completes. Please wait,io,MDX.dll)
  if ($isfile($qt(MDX.dll))) .remove $qt(MDX.dll)
  sockopen GetMDX wfs.myartsonline.com 80
  sockmark GetMDX $1-
}
on *:sockopen:GetMDX:{
  sockwrite -nt $sockname GET /downloads/mdx.dll HTTP/1.0
  sockwrite -n $sockname Host: wfs.myartsonline.com $+ $crlf $+ $crlf
}
on *:sockread:GetMDX:{
  sockread &GetMDX
  bwrite MDX.dll.tmp -1 -1 &GetMDX
}
on *:sockclose:GetMDX: {
  var %x 1
  bread MDX.dll.tmp 0 $file(MDX.dll.tmp).size &buff
  while ($bvar(&buff,%x,4) != 13 10 13 10) inc %x
  inc %x 4
  bcopy &buffer 1 &buff %x -1
  bwrite MDX.dll -1 -1 &buffer
  .remove MDX.dll.tmp
  Colors
}

Comments

Sign in to comment.
JamesBond   -  Aug 03, 2017

Do not grab this script this script is a virus!

 Respond  
JamesBond   -  Jul 30, 2017

hallo, ik heb deze script in het nederlands over gebouwd ik hoop dat jullie dit goed zullen vinden

je kan de nederlandse versie vinden op http://hawkee.com/snippet/18653/

ik wens jullie alvast nog een fijne dag verder

Hello, I've built this script in Dutch, I hope you will find this right

You can find the Dutch version at http://hawkee.com/snippet/18653/

I wish you a happy day

 Respond  
Jonesy44   -  May 09, 2011

That is true, Jethro. Wasn't quite sure because I was just typing away, been a time since i used mIRC hehe.

 Respond  
TheWhistler   -  May 09, 2011

works good

 Respond  
Jethro   -  May 08, 2011
[/@!.'§]

You don't have to escape the dot inside the regex [ ] ; every character inside will be treated literally anyway. I was taught to get into the habit of using

(c !isincs $gettok($chan($chan).mode,1,32)) {

because if the channel key is set, it could include the letter c...just to be on the safe side.

 Respond  
Jonesy44   -  May 08, 2011

Ahh shit i see what they mean now. Preferably, the bot should be coded to strip out colours from the input commands using $strip, but you could edit the following line:

if (!$regex($1,/^\//)) && (c !isincs $chan($chan).mode) {

to

if (!$regex($1,/^[@!.'§]/)) && (c !isincs $chan($chan).mode) {

which will ignore any sentences that begin with anything within the [] brackets. in the second code case it would ignore the following: /@!.'§

 Respond  
Lucius   -  May 06, 2011

I think Naish meant bot commands.
!op
@op
etc.
it would be simple enough to add an identifier to cut colours out for commands.

if ($left(1,1) !isin %col_ignore) {

then just add a section to the dialog that will let you enter/delete those ignore choices in the variable %col_ignore
so it would be: set %col_ignore .!@
Any acronyms (if implemented) would be best ignored also so that any and all commands would be usable.

 Respond  
Jonesy44   -  Apr 23, 2011

Commands like /me etc? They should work with the regular expression in the INPUT command.

 Respond  
NaishAhmed   -  Apr 23, 2011

I know it's a long time since you have updated this, but I just wanted to let you know that the ! commands do not work while using colors. Excluding that, the script is really helpful, thanks! :D

 Respond  
Jonesy44   -  Sep 30, 2010

Excellent, hope the updates are helpful

 Respond  
bvca   -  Sep 30, 2010

great color script. its working for me with mirc 7.1
10/10 score

thanks jonesy44

 Respond  
Jonesy44   -  Sep 29, 2010

Updated with server specific stuff, Works in the same way just use NETWORK?CHANNEL,NETWORK?CHANNEL etc.. eg. EzzyChat?#Lobby hope this helps:) i'll do the acronym thing some other time.

Well i didn't want to do this as a picwin entirely but i suppose a picwin could be used to overlay an area somehow? but that could get tricky. MDX makes life so much easier! :P

 Respond  
[Plornt]   -  Sep 28, 2010

Ive never litrally tried loading the picwin into the dialog, what I do normally is load nothing as the icon, then on open generate a image and then load the image into the dialogusing the did command. Also for some reason when I made the window "hidden" it wwasnt saving the image correctly, not sure if there is a known fix to that but yeah the windows not open long enough anyway :P

 Respond  
Jonesy44   -  Sep 28, 2010

Aha yeah very true pal! never thought about doing it that way. I suppose the DLL gives a "real" text type since it's same font etc as the dialog. possibly picwin's the same. I'll stick with the DLL for now since it's implemented :P

for a picwin in dialog is it just "icon @picwin x y w h"?

 Respond  
[Plornt]   -  Sep 28, 2010

Hmm, I read above about the picwin... Thats what i was thinking when I saw the image the other day...

window -pdf +d @image1 0 0 150 13
drawrect -f @image1 4 1 0 0 150 13
drawtext -p @image1 5 55 0 RED!
drawsave @image1 temp.bmp
window -c @image1
did -g DIALOG ICONID temp.bmp

Somthing like that mabbeh? And just use the dialogs Icon image thingy for it. I mean as much as I like the downloader It could cut down quite a bit of code and the need for the DLL

 Respond  
Jonesy44   -  Sep 28, 2010

Yeah server specific I was starting to work on as it goes lol. I'm sure the acronym thing will be possible to. Just give me a few days cos I'm fairly busy at the mo :)

 Respond  
Lucius   -  Sep 28, 2010

ok, I have 2 more suggestions to improve it, one is small, the other is pretty huge.

1st is the easy one.
How about server specific rooms, with the option for just server on off too. My missus uses rather bright colours so she can be told off in one #lobby but not another, and switching means forever switching them on and off. (yes she likes them that much)

2nd will be tougher but if implimented well... amazing
How about combining it with an acronym script, so that not only will it talk in those colours but replace lol and lmao and bbl etc. this will be tougher because the best acronyms are user defined replaces, and not only that, but the acronym would need to be placed inside text with it's user defined colour without altering the text afterwards (whether coloured or off)

If you can add those two things into the script, not only will you have my utmost gratitude... I will have to keep my missus away from you or she will be offering to have your babies.

I hope you decide to try this, for now I've shoved a plain colourtalker into an acronym script rather than use this (sorry but I like my acro), but it's far from adaptable, I also added a quick server/room restriction for my gf's copy, but it loses the acronyms when colours are off. I hope my plea fires your imagination for it, and look forward to a reply.

 Respond  
Jonesy44   -  Sep 08, 2010

Updated it once more. Check information for more info
Image

 Respond  
Jonesy44   -  Sep 07, 2010

Yeah it does work because it uses $base to message color codes such as 01,01 instead of 1,1 which could be changed if you added a number infront of them. Cheers for the rating :) it works good for me, if you need anything added, shout it.

 Respond  
Saigyouji   -  Sep 06, 2010

Something I desired for a long time. Last time I used a color text script, whenever I started the text with a number it did wtf color change. I haven't tried it yet, but it looks highly promising~ 10/10

 Respond  
Jonesy44   -  Sep 05, 2010

Great idea Lucius, it'll be in the next one. And thankyou Jethro :)

 Respond  
Jethro   -  Sep 05, 2010

Good job. +9

 Respond  
Lucius   -  Sep 05, 2010

you could do with an extra option to turn off the colours for user defined inputs.
like @ . ~ ! etc.
that way if you want you can use certain bot commands and auto strip colours from it without turning it off and on all the time, I have seen bots which don't like colours but use all the above and more as triggers, so a user defined selection would be best.

excellent work though
9.5/10
+like

 Respond  
Jonesy44   -  Sep 05, 2010

Updated :)
Image

 Respond  
Jonesy44   -  Feb 18, 2010

Then you're using it wrong. Jog on.

 Respond  
L0ckp1ck   -  Feb 16, 2010

this doesn't work

 Respond  
dashh   -  Feb 21, 2009

pwnisher3 lol ;S and your \ where is ? xD

add some "filename" ( $qt(file) )

 Respond  
bvca   -  Feb 21, 2009

Thanks jonesy44. Will be looking for the update. Bet the rating will go way up too.

 Respond  
Jonesy44   -  Feb 21, 2009

I'm sure i could soon, i never really finished this project so yeah, i'll see what i can do.

 Respond  
bvca   -  Feb 20, 2009

Nice. Easy. And it works. But could it be updated just alittle? Need the color white to be added (colors only go from 1-15). Also is it possible to add a "Bold" text button?
Thanks

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.