Top

ColorPicker W/Color Dialogs


mIRC Code
+ 0 likes
Please Register to submit score.
Bookmark and Share
Average Score  4.7 (of 3 scores)
Date Added  Apr 23, 2009
Last Updated  Apr 23, 2009
Tags  background  color  dialogs  foreground  icon  window 

Introduction

This script serves a very basic function that is already included in mirc's color dialogs. The basic function of this script is to change your background and foreground(normal text) colors.
The reason I am posting this is to demonstrate how to create a color pallet with mirc's drawfill/drawsave functions, and then use it to spice up your dialogs with a little COLOR :)
The jewel of this script is the MakeColorIcons alias. This alias creates a small bitmap image for each of the 16 colors available in mirc.
If you look at this line - ->
Code:
window  -hBpf +d @MakeColorIcons -1 -1 68 68

The last two numbers determine the size of the bmp. 68 x 68 is equal to 34 x 34 in dialogs.
You can change these two numbers, in conjunction with the last two numbers in the drawfill line, to change the file size/shape.
In addition, you can also use $rgb() in the drawfill line, to create custom colors.
Basically, anything you can draw in a window, can be saved with drawsave and used in dialogs or elsewhere in mirc.
From here you just need to add a icon spot in your dialog and add your color with did -g dialogname N pathtofile\filename.bmp

:)

Grab the Code

alias MakeColorIcons {
  var %c 0
  if (!$isdir($+($mircdir,ColorIcon))) { mkdir ColorIcon }
  while (%c <= 15) {
    if (!$window(@MakeColorIcons)) { window  -hBpf +d @MakeColorIcons -1 -1 68 68 }
    drawfill @MakeColorIcons %c %c 0 0 68 68
    if (!$isfile($+(ColorIcon\,ColorIcon,%c,.bmp))) { drawsave @MakeColorIcons $qt($+($mircdir,ColorIcon\,ColorIcon,%c,.bmp)) }
    inc %c
  }
  window -c @MakeColorIcons
}
alias ColorPicker {
  if (!$dialog(ColorPicker)) { dialog -m ColorPicker ColorPicker }
  else { dialog -v ColorPicker ColorPicker }
}
dialog ColorPicker {
  title "Color Picker"
  size -1 -1 90 88
  option dbu
  icon 1, 2 2 8 8
  icon 2, 13 2 8 8
  icon 3, 24 2 8 8
  icon 4, 35 2 8 8
  icon 5, 46 2 8 8
  icon 6, 57 2 8 8
  icon 7, 68 2 8 8
  icon 8, 79 2 8 8
  icon 9, 2 15 8 8
  icon 10, 13 15 8 8
  icon 11, 24 15 8 8
  icon 12, 35 15 8 8
  icon 13, 46 15 8 8
  icon 14, 57 15 8 8
  icon 15, 68 15 8 8
  icon 16, 79 15 8 8
  button "", 17, 4 4 4 4
  button "", 18, 15 4 4 4
  button "", 19, 26 4 4 4
  button "", 20, 37 4 4 4
  button "", 21, 48 4 4 4
  button "", 22, 59 4 4 4
  button "", 23, 70 4 4 4
  button "", 24, 81 4 4 4
  button "", 25, 4 17 4 4
  button "", 26, 15 17 4 4
  button "", 27, 26 17 4 4
  button "", 28, 37 17 4 4
  button "", 29, 48 17 4 4
  button "", 30, 59 17 4 4
  button "", 31, 70 17 4 4
  button "", 32, 81 17 4 4
  icon 33, 6 36 34 34
  icon 34, 50 36 34 34
  radio "Foreground", 35, 6 24 37 10
  radio "Background", 36, 48 24 37 10
  button "Close", 37, 56 74 29 12, cancel
  button "Accept", 38, 5 74 29 12
}
On *:Dialog:ColorPicker:Close:*: {
  unset %ColorPicker*
}
On *:Dialog:ColorPicker:Sclick:*: {
  if ($did >= 17) && ($did <= 32) {
    if ($did(ColorPicker,35).state == 1) { 
      did -g ColorPicker 33 $+(ColorIcon\,ColorIcon,$calc($did - 17),.bmp)
      set %ColorPickerFG $calc($did - 17)
    }
    if ($did(ColorPicker,36).state == 1) { 
      did -g ColorPicker 34 $+(ColorIcon\,ColorIcon,$calc($did - 17),.bmp)
      set %ColorPickerBG $calc($did - 17)
    }
  }
  if ($did == 38) {
    color normal text %ColorPickerFG
    color background %ColorPickerBG
  }
}
On *:Dialog:ColorPicker:init:*: {
  MakeColorIcons
  var %c = 0
  while %c <= 15 {
    did -g ColorPicker $calc(%c + 1) $+(ColorIcon\,ColorIcon,%c,.bmp)
    inc %c
  }
  did -c ColorPicker 35
  set %ColorPickerFG $color(normal text)
  set %ColorPickerBG $color(background)
  did -g ColorPicker 33 $+(ColorIcon\ColorIcon,$color(normal text),.bmp)
  did -g ColorPicker 34 $+(ColorIcon\ColorIcon,$color(background),.bmp)
}
menu * {
 ColorPicker:ColorPicker
}

Comments

  (13)  RSS
err0r007
Comments: 14
 
mIRC Snippet:  ColorPicker W/Color Dialogs
Posted on Apr 24, 2009 9:26 am
nice job... good example
FordLawnmower
Comments: 412
 
mIRC Snippet:  ColorPicker W/Color Dialogs
Posted on Apr 24, 2009 9:49 am
Thanks err0r007 :)
Aucun50
Comments: 548
 
mIRC Snippet:  ColorPicker W/Color Dialogs
Posted on Apr 24, 2009 11:57 pm
I like how you did this very neat.
FordLawnmower
Comments: 412
 
mIRC Snippet:  ColorPicker W/Color Dialogs
Posted on Apr 25, 2009 12:32 am
Thanks Aucun50 :)
FordLawnmower
Comments: 412
 
mIRC Snippet:  ColorPicker W/Color Dialogs
Posted on Apr 25, 2009 4:13 am
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
eyiezinc
Comments: 38
 
mIRC Snippet:  ColorPicker W/Color Dialogs
Posted on May 6, 2009 10:20 pm
amazing..good job FordLawnmower
FordLawnmower
Comments: 412
 
mIRC Snippet:  ColorPicker W/Color Dialogs
Posted on May 7, 2009 4:28 pm
Thank you eyiezinc :)
TheProdigY
Comments: 14
 
mIRC Snippet:  ColorPicker W/Color Dialogs
Posted on Jun 17, 2009 3:16 am
Hey, I'm going to ask this question here and in the forums. When I pasted this code in the Aliases of my mIRC v6.35 Script Editor I get this...

-G Unknown command
-
-G Unknown command
-
-17 Unknown command
-
-G Unknown command
-
-G Unknown command
-
-G Unknown command
-
-G Unknown command
FordLawnmower
Comments: 412
 
mIRC Snippet:  ColorPicker W/Color Dialogs
Posted on Jun 17, 2009 2:30 pm
You have to put this into remotes TheProdigY.
Alt+r -- From the file menu select NEW. --- Then paste the code and save it with a unique file name.
TheProdigY
Comments: 14
 
mIRC Snippet:  ColorPicker W/Color Dialogs
Posted on Jun 17, 2009 4:10 pm
Ok, I did that. I put it in the Remote. Saved it as a unique name, clicked ok. Nothing happened. Do I need to do something else for it to come up?
TheProdigY
Comments: 14
 
mIRC Snippet:  ColorPicker W/Color Dialogs
Posted on Jun 17, 2009 4:11 pm
Nevermind! I figured it out! Thank you so much FordLawnmower. And thanks for this excellent color script!
FordLawnmower
Comments: 412
 
mIRC Snippet:  ColorPicker W/Color Dialogs
Posted on Jun 17, 2009 4:18 pm
You're welcome TheProdigY :)
TheProdigY
Comments: 14
 
mIRC Snippet:  ColorPicker W/Color Dialogs
Posted on Jun 17, 2009 5:35 pm
FordLawnmower, I've got one more question, hopefully. When I loaded your script up, I changed it from white text, and blue background. It shows up just as plain text black letters, white background. I unloaded the colors.mrc that came with my Beirut v4 mIRC v6.35. All it does is change the channel background colors to whatever color I chose and the text color to whatever I chose. I just wanted my channel (chatroom, PM, whatever) as black background and my text ONLY to be blue background with white text. I don't know what's going on with that. Any solutions?

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom