Uno helper

By MoshMage on 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
  }
}

Comments

Sign in to comment.
Savage_CL   -  Aug 07, 2011

I didn't know how many settings this uses, but what I'm saying is I hate it when scripts (such as mp3ad+) have like 30 variables.it's extremely unnecessary. Because of this, I never use variables. If the script is a bit more advanced in its use (something that the normal mIRC user wouldn't use) i would use something like this:

alias -l sname return NICK HERE
 Respond  
Savage_CL   -  Aug 06, 2011

MoshMage. The best way to do settings (in my opinion) is with an ini file or aliases. Or aliases that read an ini file. Something like this:

on *:LOAD:{
writeini unosettings.ini settings botnick $input(What's the bot's nick?,eo,unogamer)
noop $input(Done!,o,unogamer)
}
alias uno {
if ($1 == nick) return $readini(unosettings.ini,settings,botnick)
elseif ($1 == channel) return...
else return $false
}

You would call the data with $uno(nick)

 Respond  
MoshMage   -  Aug 05, 2011

Good point. I've added a on load event, that should do the trick :)

 Respond  
Jethro   -  Aug 05, 2011

Oh yeah I missed reading it, but I think it'd be advisable to make it user-friendly...because, let's face it, not every newbies know what to do with a script. Oftentimes, they just install (copy and paste) a script in the remote and forget it....thinking it's gonna work.

 Respond  
Jethro   -  Aug 05, 2011

You should have the #uno removed and placed it as #. Because not every one has to make a channel called #uno to have it working. Do you expect people to make a name as > Uno`, hence the

  if ($nick == Uno`) {

? You need to make some adjustment to make your personal script fitting for the public.

 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.