Jump to content

Script Font Color Help


CharmedOne

Recommended Posts

I am having trouble my dialog comes up blank & dosent show font color I am using with it errors font code can someone tell me why it is comming up blank, I am using a colorcombo.dll in main script folder. Heres both codes along with one error made.

 

Dialog Code

 

dialog color {
  title "Color Changer"
  size -1 -1 112 40
  option dbu
  combo 1, 0 0 68 34, size drop
  button "Close", 4, 72 0 37 12, ok cancel
}

on *:DIALOG:color:init:*:{
  dll colorcombo.dll COMBO options 1
  did -c $dname 1 5
}
on *:DIALOG:color:sclick:1:{
  if ($did(1).sel == 1) { /set %scolor #517693 }
  if ($did(1).sel == 2) { /set %scolor #FFFFFF }
  if ($did(1).sel == 3) { /set %scolor #000000 }
  if ($did(1).sel == 4) { /set %scolor #00007f }
  if ($did(1).sel == 5) { /set %scolor #009300 }
  if ($did(1).sel == 6) { /set %scolor #ff0000 }
  if ($did(1).sel == 7) { /set %scolor #7f0000 }
  if ($did(1).sel == 8) { /set %scolor #9c009c }
  if ($did(1).sel == 9) { /set %scolor #fc7f00 }
  if ($did(1).sel == 10) { /set %scolor #ffff00 }
  if ($did(1).sel == 11) { /set %scolor #00fc00 }
  if ($did(1).sel == 12) { /set %scolor #009393 }
  if ($did(1).sel == 13) { /set %scolor #00ffff }
  if ($did(1).sel == 14) { /set %scolor #0000fc }
  if ($did(1).sel == 15) { /set %scolor #ff00ff }
  if ($did(1).sel == 16) { /set %scolor #7f7f7f }
  if ($did(1).sel == 17) { /set %scolor #d2d2d2 }
}

 

 

Errors Code

 

text change collor (non echo)
alias color { return %scolor }
alias buzzcolor { return [style ff:Arial;co: $+ $color $+;] $+ $1- $+ [/style] }
^for font color change in web chat

echo color change

echo # ( owner: $checkfont($1-) } 

lias checkfont {
  var %bf = $1-
  noop $regex(%bf,/(\[style.*?\])/)  |  var %font $regml(1) | var %fs $iif($gettok(%font,3,59) == b,$true,$false) | var %fc $left($gettok(%font,-1,35),6)
  var %fua $iif($gettok(%font,3,59) == u,$true,$false)  
  var %fub $iif($gettok(%font,4,59) == u,$true,$false) 
  var %fuc $iif($gettok(%font,5,59) == u,$true,$false) 
  if ((%fua == $true) || (%fub == $true) || (%fuc == $true)) { var %fu $true }
  else { var %fu $false }
  var %bf = $replace($regsubex(%bf,/(\[style (ff:.+?;|(bg)?co:.+?;|[ubi];|\bundefined\b)*?\]|\[\/style\])/ig,$null), ,$chr(32),&,&)
  return $iif(%fs == $true,,$null) $+ $iif(%fu == $true,,$null) $+  $+ $iif(%fc == $null,01,$hex2mirccolor(%fc)) $regsubex(%bf, /\[(?:style\x20.*?|/style)\]/gi,$null) $+ $iif(%Option.Theme.Bold == 2,)
}
alias hex2mirccolor {
  tokenize 46 $regsubex($1,/#?([a-f\d]{2})/gi,$base(\1,16,10) .)
  if ($1 == [style) { return 01 | halt }
  var %i = 0, %c, %d = 200000
  while %i < 16 {
    tokenize 32 $1-3 $replace($rgb($color(%i)),$chr(44),$chr(32))
    if $calc(($1 -$4)^2 + ($2 -$5)^2 + ($3 -$6)^2) < %d {
      %c = %i
      %d = $v1
    }
    inc %i
  }
  return %c
}

post-27405-1266120852.jpg

Edited by CharmedOne
Link to comment
Share on other sites

You had...

 

dll colorcombo.dll COMBO options 1

 

It needed to be...

 

dll colorcombo.dll COMBO color 1

 

Then you were missing a letter in one of your aliases, the letter a for the checkfont alias. I added it back in, and also added a bit more things that would be useful for you such as the FF alias (used for finding files quicker, and easier). The following are the codes...

 

alias ff {
  var %test = $1-
  if (!%ff. [ $+ [  %test  ] ]) || (!$exists(%ff. [ $+ [  %test  ] ])) {
    if ($findfile(" $+ $nofile($mircexe) $+ ",%test,1)) || ($findfile(" $+ $mircdir $+ ",%test,1)) set %ff. [ $+ [  %test  ] ] " $+ $ifmatch $+ "
    else set %ff. [ $+ [  %test  ] ] " $+ $mircdir $+ %test $+ "
  }
  return %ff. [ $+ [  %test  ] ]
}


menu * {
  -
  Color Dialog: dialog -md color color
  -
}

dialog color {
  title "Color Changer"
  size -1 -1 112 40
  option dbu
  combo 1, 0 0 68 34, size drop
  button "Close", 4, 72 0 37 12, ok cancel
}

on *:DIALOG:color:init:*:{
  dll $ff(colorcombo.dll) COMBO color 1
  did -c $dname 1 5
}
on *:DIALOG:color:sclick:1:{
  if ($did(1).sel == 1) { /set %scolor #517693 }
  if ($did(1).sel == 2) { /set %scolor #FFFFFF }
  if ($did(1).sel == 3) { /set %scolor #000000 }
  if ($did(1).sel == 4) { /set %scolor #00007f }
  if ($did(1).sel == 5) { /set %scolor #009300 }
  if ($did(1).sel == 6) { /set %scolor #ff0000 }
  if ($did(1).sel == 7) { /set %scolor #7f0000 }
  if ($did(1).sel == 8) { /set %scolor #9c009c }
  if ($did(1).sel == 9) { /set %scolor #fc7f00 }
  if ($did(1).sel == 10) { /set %scolor #ffff00 }
  if ($did(1).sel == 11) { /set %scolor #00fc00 }
  if ($did(1).sel == 12) { /set %scolor #009393 }
  if ($did(1).sel == 13) { /set %scolor #00ffff }
  if ($did(1).sel == 14) { /set %scolor #0000fc }
  if ($did(1).sel == 15) { /set %scolor #ff00ff }
  if ($did(1).sel == 16) { /set %scolor #7f7f7f }
  if ($did(1).sel == 17) { /set %scolor #d2d2d2 }
}

alias color { return %scolor }
alias buzzcolor { return [style ff:Arial;co: $+ $color $+;] $+ $1- $+ [/style] }

alias checkfont {
  var %bf = $1-
  noop $regex(%bf,/(\[style.*?\])/)  |  var %font $regml(1) | var %fs $iif($gettok(%font,3,59) == b,$true,$false) | var %fc $left($gettok(%font,-1,35),6)
  var %fua $iif($gettok(%font,3,59) == u,$true,$false)  
  var %fub $iif($gettok(%font,4,59) == u,$true,$false)
  var %fuc $iif($gettok(%font,5,59) == u,$true,$false)
  if ((%fua == $true) || (%fub == $true) || (%fuc == $true)) { var %fu $true }
  else { var %fu $false }
  var %bf = $replace($regsubex(%bf,/(\[style (ff:.+?;|(bg)?co:.+?;|[ubi];|\bundefined\b)*?\]|\[\/style\])/ig,$null), ,$chr(32),&,&)
  return $iif(%fs == $true,,$null) $+ $iif(%fu == $true,,$null) $+  $+ $iif(%fc == $null,01,$hex2mirccolor(%fc)) $regsubex(%bf, /\[(?:style\x20.*?|/style)\]/gi,$null) $+ $iif(%Option.Theme.Bold == 2,)
}
alias hex2mirccolor {
  tokenize 46 $regsubex($1,/#?([a-f\d]{2})/gi,$base(\1,16,10) .)
  if ($1 == [style) { return 01 | halt }
  var %i = 0, %c, %d = 200000
  while %i < 16 {
    tokenize 32 $1-3 $replace($rgb($color(%i)),$chr(44),$chr(32))
    if $calc(($1 -$4)^2 + ($2 -$5)^2 + ($3 -$6)^2) < %d {
      %c = %i
      %d = $v1
    }
    inc %i
  }
  return %c
}

Edited by Warrior124
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...