Typo commented on a Page, PicWin Tool: $bRGB  -  Sep 20, 2008

Very cool snippet BlueThen. I definately see how this could be usefull but when I tested it I seemed to have problems. I went to shorten your code a little bit and my output was different than yours and I finally realized why. I thought I was messing mine up and infact I had discovered a mistake in yours. You have a $2 in the $3 line.

Heres my ideas to shorten it a little bit. I just used a while loop to make the 1 if line handle all three $'s. I also added a check for $3 to make sure that it exists and I didnt totally understand your calc's when I thought there was an error so I made a new one which seemed to test just fine and is shorter than the one you came up with.

alias brgb {
  if ($3) {
    var %brgb.r, %brgb.g, %brgb.b, %endnum $0 
    while (%endnum) {
      var %dotletter $iif(%endnum == 3,b,$iif($v1 == 2,g,$iif($v1 == 1,r))), %dollarnum $ $+ %endnum 
      if ($(%dollarnum,2) > 255) %brgb. [ $+ [ %dotletter ] ] = $calc(255 - ($(%dollarnum,2) - (255 * $int($calc($(%dollarnum,2) / 255)))))  
      else %brgb. [ $+ [ %dotletter ] ] = $(%dollarnum,2)
      dec %endnum
    }
    return $rgb(%brgb.r,%brgb.g,%brgb.b)
  }
}

Anyhow, mine isn't a whole lot shorter but I think it is definately shorter and does show a bit of a different way of doing things for anyone looking.

I really do like the idea and like I said it does make sense and people should find it usefull.

Well done.

 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.