Uno helper
Platform: mIRC
Published Aug 05, 2011
Updated Aug 05, 2011
This is supposed to help you play Uno @ irc.
it helps by seeing if you have a card of the same color or number and builds the command to send in your editbox, all you have to do is press enter :)
note: it does not grant you all-mighty-god-knowledge-and-invencibility it only sees the first available match possible and writes it down for you.
;uno helper or uno see or wtv
;-----------
on *:load:ucfg
alias ucfg {
set %unobot $input(please enter the uno bot nickname $crlf ex: Uno`,e,Uno-See)
set %unochan $input(please enter the uno channel $crlf ex: #uno,e,Uno-See)
if (!%unobot) || (!%unochan) {
ucfg
}
}
alias rco {
var %y $len($1-), %txt $1-
var %x 1, %y $len($1-), %txt $1-
while (%x <= %y) {
var %chr $mid(%txt,%x,1)
var %one $asc(%chr)
inc %x
if (%one == 56) { return y }
if (%one == 52) { return r }
if (%one == 49) { return b }
if (%one == 57) { return g }
}
}
on *:text:*up*:%unochan:{
if ($nick == %unobot) {
if ($me isin $1-) {
unset %hand
set %inplay $left($rco($5-),3) $strip($remove($5-,[,]),cb)
}
}
}
on *:text:*round has ended*:%unochan:{
if ($nick == %unobot) {
unset %hand
unset %inplay
unset %uno-d
}
}
on *:notice:* *:*:{
if ($nick == %unobot) {
var %t $remove($1-,[,],$chr(3),$chr(15),$chr(2),$chr(32),$chr(44),WD4,R,S,DT,WILD)
if (%t isnum) {
unset %hand
var %c $numtok($1-,32)
while (%c) {
var %cc $rco($gettok($1-,%c,32))
var %sc $gettok($1-,%c,32)
set %hand $strip($addtok(%hand,%cc $+ - $+ %sc,32),cb)
dec %c
}
unosee
}
if (drew isin $1-) {
var %u $numtok($2-,32)
while (%u) {
var %cc $rco($gettok($3-,%u,32))
var %sc $gettok($3-,%u,32)
set %hand $strip($addtok(%hand,%cc $+ - $+ %sc,32),cb)
dec %u
}
unosee
}
}
}
alias unosee {
if (!$1) {
;have color? have number?
if ($matchtok(%hand,$gettok(%inplay,1,32),0,32)) || ($matchtok(%hand,$gettok(%inplay,2,32),0,32)) {
var %first-card $iif($matchtok(%hand,$gettok(%inplay,1,32),0,32),$matchtok(%hand,$gettok(%inplay,1,32),1,32),$matchtok(%hand,$gettok(%inplay,2,32),1,32))
var %first-card $remove(%first-card,[,])
var %first-card $replace(%first-card,-,$chr(32))
editbox %unochan p %first-card
if ($active != %unochan) {
echo -a $timestamp <UnoSee> T: $+ $strip(%inplay,cb) H: $strip(%hand,cb)
echo -a $timestamp <UnoSee> you have a playable card, %first-card $+ .
}
}
else {
;have nothing, draw
editbox %unochan $iif(!%uno-d,d,pass)
}
}
}
on *:input:%unochan:{
if (d == $1) {
set %uno-d 1
}
if (pass == $1) {
unset %uno-d
}
}