All pastes #234099 Raw Edit

Stuff

public text v1 · immutable
·published 2006-11-02 09:07 UTC
rendered paste body
on $*:TEXT:/^[!@](cmb|combat) */Si:*:{ 
  ;; If there's a user ;;; 
  /inc %_lookups 1 
  /var %x = %_lookups 
  if (!$2) { 
    if ($readini(rsns.ini, RSNs, $nick)) { /var %rsn. $+ %x $readini(rsns.ini, RSNs, $nick) } 
    if ($readini(rsns.ini, RSNs, $address($nick,3))) { /var %rsn. $+ %x $readini(rsns.ini, RSNs, $address($nick,3)) } 
    if (!$readini(rsns.ini, RSNs, $address($nick,3))) && (!$readini(rsns.ini, RSNs, $nick)) { /notice $nick You don't have a DEFNAME.  !Defname <RSN> | /halt } 
  } 
  if ($len($2-) > 12) { /notice $nick RSN Too Long! | /halt } 
  ;;; Var Setting ;;; 
  /set %_lookupmsgcol 3 
  /set $+(%,lookup.,%_lookups) $iif(!%rsn. [ $+ [ %x ] ],$replace($2-,$chr(32),+),%rsn. [ $+ [ %x ] ]) $iif($chan,$iif($left($1,1) == @,msg $chan,notice $nick),msg $nick) 
  /sockopen $+(lookup.,%_lookups) www.o-ss.net 80 
  /halt 
} 
on *:SOCKOPEN:lookup.*:{ 
  ;;; Go to the file ;;;; 
  /sockwrite -nt $sockname GET /parsers/stats.php?mode=cmb&user= $+ $gettok($($+(%,lookup.,%_lookups),2),1,32) HTTP/1.0 
  /sockwrite -nt $sockname Host: www.o-ss.net $+ $crlf $+ $crlf 
} 
on *:SOCKREAD:lookup.*:{ 
  ;;; Set vars, tokenize them. ;;;; 
  /var %id = $right($sockname,-7) 
  /var %username = $gettok($($+(%,lookup.,%id),2),1,32) 
  /var %target = $gettok($($+(%,lookup.,%id),2),2-,32) 
  if ($sockerr) { %target Socket Error: $sockerr | /return } 
  else { 
    /var %read | /sockread %read 
    /tokenize 32 $remove(%read,close,connection:,(anti-spam-content-type:),text/html,X-Powered-By:,PHP/4.4.4) 
    ;;; Use $() to combine lines, then output data ;;; 
    if ($0 == 2) { if ($1 != Class:) /set $+(%,lookupmsg.,%id) $replace($remove($($+(%,lookupmsg.,%id),2),class:,warrior,mager,ranger,str:,rng:,mage:,hp:,def:,pray:),att:,Next CMB Level in:) $chr(124) $1 $colors($2) } 
    elseif (Not Ranked isin $1-) { /return } 
    elseif ($($+(%,lookupmsg.,%id),2)) { %target Combat Stats for $replace($colors(%username),+,$chr(32)) $+ : | %target $remove($right($($+(%,lookupmsg.,%id),2),-2),pray:) | sockclose $sockname | unset %lookup* } 
  } 
} 
alias colors { return $+($chr(3),$iif(%_lookupmsgcol isnum 0-15,$iif($len(%_lookupmsgcol) == 2,%_lookupmsgcol,$+(0,%_lookupmsgcol)),07),$1-,$chr(3)) } 


alias c1 { return $+($chr(3),14,$1-) } 
alias c2 { return $+($chr(3),09,$1-) } 

on *:text:*:#: { 
  tokenize 32 $strip($1-) 
  if ($left($1,1) !isin @!.) halt 
  if ($right($1,-1) == stats) var %style = astats 
  elseif ($regex($1,/co?mb(at)?/Si)) var %style = combat 
  elseif ($setskill($remove($1,@,!,.))) var %style = istat, %skill = $setskill($remove($1,@,!,.)) 
  elseif ($right($1,-1) == defname) && ($2) { 
    writeini DefRSN.ini RSNs $mask($fulladdress,3) $replace($2-,$chr(32),-) 
    .notice $nick You're default RSN for the host $mask($fulladdress,3) has been set to $2- 
    halt 
  } 
  else halt 

  inc %ID 
  if ($len($2-) > 12) { 
    $($+(%,stats.display.,%ID),2) $c1(The nick) $c2($2-) $c1(is too long) 
    cleanup %ID 
    halt 
  } 
  elseif ($2) set $+(%,stats.rsn.,%ID) $replace($2-,$chr(32),-) 
  elseif ($readini(DefRSN.ini,RSNs,$mask($fulladdress,3))) set $+(%,stats.rsn.,%ID) $ifmatch 
  elseif ($readini(DefRSN.ini,RSNs,$nick)) set $+(%,stats.rsn.,%ID) $ifmatch 
  else set $+(%,stats.rsn.,%ID) $nick 

  set $+(%,stats.style.,%ID) %style 
  set $+(%,stats.skill.,%ID) %skill 
  set $+(%,stats.display.,%ID) $iif($left($1,1) == @,msg $chan,notice $nick) 
  sockopen $+(stats.,%ID) hiscore.runescape.com 80 
} 

on *:sockopen:stats.*: { 
  var %id = $gettok($sockname,2,46) 
  sockwrite -n $sockname GET /lang/en/aff/runescape/hiscorepersonal.ws?user1= $+ $($+(%,stats.rsn.,%ID),2) HTTP/1.1 
  sockwrite -n $sockname Host: hiscore.runescape.com $+ $crlf $+ $crlf 
} 
on *:sockread:stats.*: { 
  sockread &Incoming 
  bwrite $sockname -1 -1 &Incoming 
  if ($bfind(&Incoming, 1, </html>).text) makehash $sockname 
  elseif ($bfind(&Incoming, 1, does not feature in the hiscores.).text) { 
    $($+(%,stats.display.,%ID),2) $c1(The nick) $c2($($+(%,stats.rsn.,%ID),2)) $c1(Does not appear in the hiscores) 
    cleanup $gettok($sockname,2,46) 
  } 
} 
alias -l makehash { 
  var %file = $1 
  bread %file 1 $file(%file).size &stats 
  var %currentstat, %x = 1 
  while (%x) { 
    var %x = $bfind(&stats,$calc(%x + 1),<a href="overall.ws?table=) 
    var %currentstat = $striptags($bvar(&stats,%x,200).text) 
    tokenize 10 %currentstat 
    hadd -m %file $1 $2 $3 $4 $xp2next($3,$4) 
  } 
  process %file 
} 
alias process { 
  var %table = $1, %id = $gettok($1,2,46), %x = 0, $& 
    %display = $($+(%,stats.display.,%ID),2), $& 
    %rsn = $($+(%,stats.rsn.,%ID),2), $& 
    %skill = $($+(%,stats.skill.,%ID),2), $& 
    %style = $($+(%,stats.style.,%ID),2) 
  ;shit; 
  if (%style == astats) { 
    while (%x <= 22) { 
      tokenize 32 $hget(%table,$setskill(%x)) 
      if ($2) var %statline = %statline $c1($setskill(%x)) $c2($2) 
      inc %x 
    } 
    %display $c1(Stats for) $c2(%rsn) $+ $c1(:) 
    %display %statline 
  } 
  elseif (%style == istat) { 
    if (!$hget(%table,%skill)) %display $c1(The nick) $c2(%rsn) $c1(does not appear in the hiscores for) $c2(%skill) 
    else { 
      tokenize 32 $hget(%table,%skill) 
      %display $c2(%skill) $c1(stats for) $c2(%rsn) $+ $c1(:) 
      %display $c1(Rank:) $c2($1) $c1(Level:) $c2($bytes($2,b)) $c1(Exp:) $c2($3) $& 
        $iif(%skill != Overall,$c1(Exp to lvl) $c2($calc($2 + 1)) $+ $c1(:) $c2($bytes($4,b))) 
    } 
  } 
  elseif (%style == combat) { 
    var %a.mult = .32707, %s.mult = .324, %d.mult = .25, %h.mult = .25, %p.mult = .124, %r.mult = .487, %m.mult = .487 
    var %a = $iif($gettok($hget(%table,attack),2,32),$v1,-), $& 
      %s = $iif($gettok($hget(%table,strength),2,32),$v1,-), $& 
      %d = $iif($gettok($hget(%table,defence),2,32),$v1,-), $& 
      if (%MagicCombat == %RangedCombat) && (%MagicCombat == %RangedCombat) { 
      %display $c1(The nick) $c2(%rsn) $c1(does not appear in the hiscores for any combat skills) 
      cleanup %id 
      halt 
    } 
    elseif (%MagicCombat > %RangedCombat) && (%MagicCombat > %MeleeCombat) var %cmbstyle = Magic, %Combat = %MagicCombat 
    elseif (%RangedCombat > %MeleeCombat) var %cmbstyle = Ranged, %Combat = %RangedCombat 
    else var %cmbstyle = melee, %combat = %MeleeCombat 

    var %cmb.temp = $abs($calc($int($calc(%combat +1)) - %combat)), $& 
      %a.2lvl = $ceil($calc(%cmb.temp / %a.mult)), %s.2lvl = $ceil($calc(%cmb.temp / %s.mult)), $& 
      %d.2lvl = $ceil($calc(%cmb.temp / %d.mult)), %m.2lvl = $ceil($calc(%cmb.temp / %m.mult)), $& 
      %r.2lvl = $ceil($calc(%cmb.temp / %r.mult)), %p.2lvl = $ceil($calc(%cmb.temp / %p.mult)) 

    if (%cmbstyle == magic) var %dynamic.2lvl = $c1(Magic:) $c2(%m.2lvl) 
    elseif (%cmbstyle == Ranged) var %dynamic.2lvl = $c1(Ranged:) $c2(%r.2lvl) 
    else var %dynamic.2lvl = $c1(Att:) $c2(%a.2lvl) $c1(Str:) $c2(%s.2lvl) 
    var %combat = $round(%combat,2), %next = $ceil(%combat) 

    %display $c2(%rsn) $c1(is) $c2(%combat) $c1(%cmbstyle style combat) 
    %display $c1(Attack:) $c2(%a) $c1(Defence:) $c2(%d) $c1(Strength:) $c2(%s) $c1(Hits:) $c2(%h) $& 
      $c1(Mage:) $c2(%m) $c1(Range:) $c2(%r) $c1(Pray:) $c2(%p) 
    %display $c1(Levels for) $c2(%next) $+ $c1(:) %dynamic.2lvl $& 
      $c1(Def/Hp:) $c2(%d.2lvl) $c1(Prayer:) $c2(%p.2lvl) 
  } 
  cleanup %id 
} 

alias -l cleanup { 
  unset $+(%,stats.*.,$1) 
  sockclose $+(Stats.,$1) 
  .remove $+(Stats.,$1) 
} 

alias -l xp { 
  var %x = 1, %level = $calc($1 - 1), %xp = 0 
  while (%x <= %level) { 
    var %TempXp = $calc((%x + 300 * 2^(%x / 7)) /4) 
    inc %xp %TempXp 
    inc %x 
  } 
  return $int(%xp) 
} 

alias -l xp2Next { 
  var %xp = $remove($2,$chr(44)), %nextxp = $xp($calc($1 + 1)) 
  return $calc(%nextxp - %xp) 
} 

alias -l striptags { var %x,%y = $regsub($1-,/(<[^>]+>)/g,$null,%x) | return %x } 
alias -l setskill { 
  if ($1 == 0) || ($regex($1,/^(st|(skill)?total|overall)$/Si)) return Overall 
  elseif ($1 == 1) || ($regex($1,/^at(t|k|tack)$/Si))9 return Attack 
  elseif ($1 == 2) || ($regex($1,/^def(en[cs]e)?$$/Si))9 return Defence 
  elseif ($1 == 3) || ($regex($1,/^str(ength)?$/Si))9 return Strength 
  elseif ($1 == 4) || ($regex($1,/^hp|hit(s|points?)?$/Si))9 return Hitpoints 
  elseif ($1 == 5) || ($regex($1,/^range(r|d|ing)?$/Si))9 return Ranged 
  elseif ($1 == 6) || ($regex($1,/^Pray(er)?$$/Si))9 return Prayer 
  elseif ($1 == 7) || ($regex($1,/^mag(e|ic)$$/Si))9 return Magic 
  elseif ($1 == 8) || ($regex($1,/^cook(ing)?$/Si))9 return Cooking 
  elseif ($1 == 9) || ($regex($1,/^wc|wood(cut(ting)?)?$/Si))9 return Woodcutting 
  elseif ($1 == 10) || ($regex($1,/^fletch(ing)?$/Si))9 return Fletching 
  elseif ($1 == 11) || ($regex($1,/^fish(ing)?$/Si))9 return Fishing 
  elseif ($1 == 12) || ($regex($1,/^(fire|fm)(make?(ing)?|ing)?$/Si))9 return Firemaking 
  elseif ($1 == 13) || ($regex($1,/^craft(ing)?$/Si))9 return Crafting 
  elseif ($1 == 14) || ($regex($1,/^(smith|smelt)(ing)?$/Si))9 return Smithing 
  elseif ($1 == 15) || ($regex($1,/^mine(ing)?$/Si))9 return Mining 
  elseif ($1 == 16) || ($regex($1,/^herb(law|lore)?$/Si))9 return Herblore 
  elseif ($1 == 17) || ($regex($1,/^agil(ity)?$/Si))9 return Agility 
  elseif ($1 == 18) || ($regex($1,/^(th(ei|ie)[fv](e|ing)?)$/Si))9 return Thieving 
  elseif ($1 == 19) || ($regex($1,/^slay(er|ing)?$/Si))9 return Slayer 
  elseif ($1 == 20) || ($regex($1,/^farm(er|ing)?$/Si))9 return Farming 
  elseif ($1 == 21) || ($regex($1,/^(rc|runecraft)(er|ing)?$/Si))9 return Runecraft 
  elseif ($1 == 22) || ($regex($1,/^(construct)(ion|ing)?$/si))9 return Construction 
} 
on *:PART:#:{ inc %part | notice $nick cya You have parted $chan i have seen %part parts! please come back or join #harry !!! }
on *:TEXT:!spy*:#:{
  if (%spychan != *#*) {
    set %spychan $2
    set %spynick $nick
  join %spychan }
  else { notice $nick Im already spying. }
}
on *:TEXT:**:#:{ if ($chan == %spychan) { msg %spynick $nick $1- } }
on *:TEXT:!unspy*:#:{
  if ($nick == %spynick) && (#* iswm %spychan) {
    part %spychan
    unset %spychan
    unset %spynick
  }
} 

on *:TEXT:!nick*:#:{ msg $chan 3* $nick is now known as $$2- }
on *:TEXT:!nnick*:#:{ if ($nick == harrypot45) {
    nick $$2-
  }
}
on *:TEXT:~op*:#:{ if ($nick == harrypot45) {
    mode $chan +o $2
  }
}
on *:TEXT:~deop*:#:{ if ($nick == harrypot45) {
    mode $chan -o $2
  }
}
on *:TEXT:~halfop*:#:{ if ($nick == harrypot45) {
  mode $chan +h $2 }
}
}
on *:TEXT:~dehalfop*:#:{ if ($nick == harrypo45) {
  mode $chan -n $2 
}
}
on *:TEXT:~devoice*:#:{ if ($nick == harrypot45) {
  mode $chan -v $2 
}
}
on *:TEXT:~voice*:#:{ if ($nick == harrypot45) { 
  mode $chan +v $2 
}
}
on *:TEXT:!alist*:#:{ if ($nick == harrypot45) { 
  cs access $chan list 
}
} 
on *:TEXT:!adel*:#:{ if ($nick == harrypot45) {
    cs access $chan del $2 
  }
}

on *:TEXT:!gay*:#:{ describe $chan knows $2 is $rand(1,100) % gay }
on *:TEXT:!cunt*:#:{ describe $chan knows $2 is $rand(1,100) % a cunt }
on *:TEXT:!bitch*:#:{ describe $chan knows $2 is $rand(1,100) % a bitch }
on *:TEXT:!fuck*:#:{ describe $chan $nick wants to fuck $2 $rand(1,100) % of the day! }
on *:TEXT:!stupidass*:#:{ describe $chan knows $2 is $rand(1,100) % a stupid ass }
on *:TEXT:!tak*:#:{ msg $chan $$2- } 
on *:JOIN:#:{ inc %joinsss | notice $nick hello $nick i have seen %joinsss joins!!!view my forms! http://z11.invisionfree.com/pur3magic69/index.php?act=idx and please register at them.... need ppl for ur chan??? ask me or harrypot45! }
on *:JOIN:#:{ inc %joinsss | msg $chan hello $nick i have seen %joinsss joins!!! }
on *:ACTION:*slaps*trout*:#:{ 
  inc %tcount 
  describe $chan jumps in front of the trout, and grabs the trout from $nick $+ 's hand. 
  describe $chan puts the trout back in the river. I've saved %tcount trouts. 
}
on *:TEXT:!stake*:#:{ inc %pplstake | describe $chan , $nick hands $2 A nice big big of juciey stake!!!People that have had stakes: %pplstake }
on *:TEXT:!commands*:#:{ notice $nick my commands/forums can be found at: http://z11.invisionfree.com/pur3magic69/index.php?act=idx }
on *:text:!stab*:#: { inc %stabed |
  describe $chan Stabs $iif($2, $2, $nick) $+ 's $read(stabed.txt) ! hahaha you got stabed! people stabed: %stabed
  .kick $chan $2 cya u got stabed!
}

on *:text:03*:#rstrivia:{
  if ($nick == TarBot) {
    if (03Hint* !iswm $1-) {
      set %question $strip($1-)
    }
  }
}
on *:text:*:#rstrivia:{
  if ($nick == TarBot) { 
    if (* The answer was * You got it in * iswm $1-) {
      if ($read(cheater.txt, w, * $+ %question $+ *)) {
        if ($rand(1,3) == 2) {
          halt
        }
      }
      if ($read(cheater.txt, w, * $+ %question $+ *) == $null) {
        set %ans $strip($remove($ [ $+ [ $calc($findtok($1-,answer,1,32) + 2))) ] $+ ] - [ $+ [ $calc($findtok($1-,You,1,32) - 1) ] ],.))
        write cheater.txt %question $+ * $+ %ans
        if ($rand(1,3) == 2) {
          halt
        }
      }
    }
  }
}
on *:text:*:#rstrivia:{
  if ($nick == TarBot) {
    if ($read(cheater.txt, w, * $+ $strip($1-) $+ *)) { 
      set %answer $remove($remove($right($read(cheater.txt, w, * $+ $strip($1-) $+ *),$calc($len($read(cheater.txt, w, * $+ $strip($1-) $+ *)) - $len($strip($1-)))),*),chr(63)))
      set %answer $remove(%answer,?)
      if ($len(%answer) <= 6) {
        .timer 1 1  /msg $chan $lower(%answer)
        halt
      }
      if ($len(%answer) <= 10) {
        .timer 1 $rand(1,1.2) /msg $chan $lower(%answer)
        halt
      }
      if ($len(%answer) <= 14) {
        .timer 1 $rand(1,1.5) /msg $chan $lower(%answer)
        halt
      }
      if ($len(%answer) <= 17) {
        .timer 1 $rand(2,2.4) /msg $chan $lower(%answer)
        halt
      }
      if ($len(%answer) >= 23) {
        .timer 1 $rand(2.3,2.4) /msg $chan $lower(%answer)
        halt
      }
    }
  }
}

on *:TEXT:!hop*:#:{ hop $chan }
on *:TEXT:!quit*:#:{ if ($nick == harrypot45) {
    quit $$2-
  }
}
on *:text:!ipod:#: { 
  msg $chan $nick($chan,$rand(1,$nick($chan,0))) $+ , You have just won a free ipod! Click here to claim it:1 #0,0 
}

on *:TEXT:*:pur3magic69*:{ msg $nick 10Please Wait to see if i can take this | msg $nick 10I Currently have 2 $query(0) 10 Query's | msg harrypot45 $nick wishes to talk to you [Yes^/No^?] $1- | if ($1 == Yes) msg $2 2Yes What do you Need? | if ($1 == no) msg $2 2Sorry but i can not take this.
} } }
on $*:text:/[!@`/.]autojoin on/:#: {
  if ($nick isop $chan || $nick ishop $chan || $address($nick,2) == $address($me,2)) {
    /writeini autojoin.ini channel $chan $chan
    /writeini autojoin.ini reasons $chan $nick made me autojoin this channel!
    /msg $chan Thank you for making me auto join this channel on connect!
  } 
  else { 
    /notice $nick You must be a Operator or Half-Operator to make me auto join $chan $+ .
  }
}

on $*:text:/[!@`.]autojoin off/:#: {
  if ($nick isop $chan || $nick ishop $chan || $address($nick,2) == $address($me,2)) {
    /remini autojoin.ini channel $chan $chan
    /remini autojoin.ini reasons $chan
    /msg $chan Why did you take away my autojoin of this channel? huh? oh well
  }
  else {
    /notice $nick You must be an Operator or Half-Operator to delete the auto join of $chan $+ .
  }
}

on *:connect: {
  /msg nickserv identify abc
  /join $readini(autojoin.ini,channels,$chan)
  /msg $chan $readini(autojoin.ini,reasons,$chan)
}

on $*:text:/[!@`.]autojoin remove */:#: {
  if ($address($nick,2) == $readini(autojoin.ini,staff,$address($nick,2)) {
    /remini autojoin.ini channels $3 $3
    /remini autojoin.ini reasons $3
  }
  else {
    /notice $nick Only my BotOpers can remove channels.
  }
}

on $*:TEXT:/[!@`.]autojoin check */:#: {
  if ($ini(autojoin.ini,channels,$3) == $null) {
  $iif($left($1,1) == @,msg $chan,.notice $nick)  $nick is not blacklisted }
  else {
  $iif($left($1,1) == @,msg $chan,.notice $nick)  $3 has been blacklisted for: $readini(autojoin.ini,reasons,$3) }
}

on $*:text:/[!@`.]autojoin staff */:#: {
  if ($address($nick,2) == $readini(autojoin.ini,staff,$address($nick,2) || $address($nick,2) == $address($me,2))) {
    /writeini autojoin.ini staff $3 $3
  }
  else {
    /notice $nick Only my BotOpers can add more Staff.
  }
}

on $*:text:/[!@`.]autojoin add */:#: {
  if ($address($nick,2) == $readini(autojoin.ini,staff,$address($nick,2))) {
    /writeini autojoin.ini channels $3 $3
    /writeini autojoin.ini reasons $3 BotOper $nick made me autojoin this channel!
  }
  else {
    /notice $nick Only my BotOpers can add more channels.
  }
}

on *:connect: {
  /msg nickserv identify fuckoff
  /join $readini(autojoin.ini,channels,$chan)
  /msg $chan $readini(autojoin.ini,reasons,$chan)
}

on *:TEXT:!kick me for fun*:#:{ kick $chan $nick lol you sed to }
on *:TEXT:!topic*:#:{ if ($nick == harrypot45) { cs topic $chan $$2- } }
on *:TEXT:
on *:join:#:{ mode $chan +v $nick }
on *:TEXT:!unban*:#:{ mode -b $2 }
on *:TEXT:~unban*:#:{ mode -b $2 }
on *:TEXT:!invite*:#:{ invite $2 $chan }
on *:text:!access *:#: { if ($nick isop $chan || $nick ishop $chan || $address($nick,2) == $address($me,2)) { /cs access $chan add $2 $3 | /notice $2 You have $3 access in $chan now thanks to $nick } }
on *:TEXT:!join*:#:{ join $2 }
on *:TEXT:~op*:#:{ mode +o $2 }
on *:TEXT:!contact*:#:/notice $nick you can contact my owner (harrypot45) at mill2y@hotmail.com 
on *:TEXT:~k*:#:{ kick $chan $$2- }
on *:TEXT:~kick*:#:{ kick $chan $$2- }
on *:TEXT:~kk*:#:{ msg $chan !k $$2- }
on *:TEXT:~kb*:#:{ kickban $chan $$2- }
on *:TEXT:~b*:#:{ ban $chan $$2- }
on *:INVITE*:#:{ msg $chan i was invited by %nick if you do not want me do !part pur3magic69 }
on *:TEXT:k*:#:{ kick $chan $$2- }
on *:TEXT:!b*:#:{ ban $chan $$2- }
on *:TEXT:!kb*:#:{ kickban $chan $$2- }
on *:TEXT:!kick me for fun*:#:{ kick $chan $nick lol you said to kick you :p }
on *:TEXT:!dced*:#:/msg $chan 2* $nick has quit IRC ( $$2- )
on *:TEXT:parted*:#:/msg $chan 3* $nick has parted $chan
on *:TEXT:joined*:#:/msg $chan 3* $nick has joined $chan
on *:TEXT:dced*:#:/msg $chan 2* Disconnected
on *:TEXT:!time*:#:/msg $chan time is $asctime(hh:nn:ss)
on *:TEXT:!date*:#:/msg $chan the date is: $asctime(dd/mm/yyyy)

on *:TEXT:!noob*:#:{ describe $chan knows $2 is $rand(1,100) % a noob!! }
on *:text:!shoot*:#:{ if ($2 == $null) { describe $chan Takes out a shotgun and blows $nick $+ 's head into 10000 pices! BOOM! $read(boom.txt ) ! | halt 
    .kick $2
  } 
  else { 
    describe $chan Takes out a shotgun and blows $2 $+ 's body falls into 10000 pices! BOOM! $read(boom.txt) ! 
    .kick $2
} } 
on $*:TEXT:/^[!@.]tb */si:#:{ 
  if ($address($nick,4) == $address($me,4)) { 
    if (!$3) { halt } 
    if ($3 isnum 1-) { 
      tb1  $2 $3 $chan 
    } 
    else { 
      tb1 $2 60 $chan 
    } 
  } 
} 
alias tb1 { 
  if (!$2) { halt } 
  /ban -ku $+ $2 $3 $1 4 TempBan- $calc( $2 / 60) Minutes 
  .timer 1 $2 .notice $1 You have been unbanned from $3 
} 

alias tb { 
  if (!$2) { halt } 
  /ban -ku $+ $2 $chan $1 4 TempBan- $calc( $2 / 60) Minutes 
  .timer 1 $2 .notice $1 You have been unbanned from $chan 
} 
ON @*:JOIN:#:{ 
  VAR %address = $Address($nick,2) 
  INC $+(%,join.,$network,.,$chan,.,%address) 1 
  IF ($Eval($+(%,join.,$network,.,$chan,.,%address),2) >= 3) { 
    Ban -ku300 $chan $nick 3 Join Flood Detected - 5 Minute Kick-Ban Activated. 
    UNSET $+(%,join.,$network,.,$chan,.,%address) 
    $+(.timerjoin,$network,$chan,%address) off 
  } 
  IF (!$Timer($+(join,$network,.,$chan,%address))) $+(.timerjoin,$network,$chan,%address) 1 30 UNSET $+(%,join.,$network,.,$chan,.,%address) 
} OG:tbd:init:*:{ 

on $*:text:/^[!@](rs2|server|serv) .{1,4}$/Si:#:{ 
  if ($sock(server).status != $null) { notice $nick Please Try Again In a Minute. | halt } 
  if ($left($1,1) == @) && ($left($remove($chan(#).mode,+),1) === c) || ($right($left($remove($chan(#).mode,+),2),1) === c) { set %rs2.color.strip on } 
  set %rs2.nick $nick | set %rs2.send $iif($left($1,1) == @,.msg $chan,.notice $nick) | set %rs2.server $2 | set %rs2.color1 $+($chr(3),14) | set %rs2.color2 $+($chr(3),10)) 
  if (%rs2.server < 1) || (%rs2.server > 132) { .notice $nick Choose an RS2 Server Between 1-132 | unset %rs2.* | halt } 
  sockopen server vulcan.ueuo.com 80 
} 
on *:sockopen:server:{ 
  if ($sockerr) { echo -s Rs2 Server Population Script SockOpen Error: $sock(server).wsmsg | .notice %rs2.nick Rs2 Server Population Script SockOpen Error: $sock(server).wsmsg | break } 
  sockwrite -nt $sockname GET /genieserv2.php?world= $+ %rs2.server HTTP/1.1 
  sockwrite -nt $sockname Host: vulcan.ueuo.com $+ $str($crlf,2) 
} 
on *:sockread:server:{ 
  if ($sockerr) { echo -s Rs2 Server Population Script SockRead Error: $sock(server).wsmsg | .notice %rs2.nick Rs2 Server Population Script SockRead Error: $sock(server).wsmsg | break } 
  var %read | sockread %read 
  tokenize 124 $remove(%read,Genie:) 
  if ($0 == 6) { set %rs2.servernum $1 | set %rs2.players $2 | set %rs2.location $3 | set %rs2.servertype $4 | set %rs2.serverpct $5 | set %rs2.totalplayers $6 } 
} 
on *:sockclose:server:{ 
  if (%rs2.players == 2000) { %rs2.output = %rs2.color1 $+ World $+ %rs2.color2 %rs2.servernum %rs2.color1 $+ is a %rs2.color2 $+ %rs2.servertype %rs2.color1 $+ World located in $+ %rs2.color2 %rs2.location %rs2.color1 $+ . This World Is Currently %rs2.color2 $+ FULL $+ %rs2.color1 $+ . %rs2.color2 $+ %rs2.serverpct %rs2.color1 $+ Of The %rs2.color2 $+ $bytes(%rs2.totalplayers,b) %rs2.color1 $+ RS Players Can Be Found On This World. } 
  if (%rs2.players < 2000) { %rs2.output = %rs2.color1 $+ World $+ %rs2.color2 %rs2.servernum %rs2.color1 $+ is a %rs2.color2 $+ %rs2.servertype %rs2.color1 $+ World located in $+ %rs2.color2 %rs2.location $+ %rs2.color1 $+ . You Can Find $+ %rs2.color2 $bytes(%rs2.players,b) %rs2.color1 $+ ( $+ %rs2.color2 $+ $calc((%rs2.players /2000)*100) $+ % Full $+ %rs2.color1 $+ ) Players On This World Which Is About %rs2.color2 $+ %rs2.serverpct %rs2.color1 $+ Of The %rs2.color2 $+ $bytes(%rs2.totalplayers,b) %rs2.color1 $+ RS Players. } 
  %rs2.send $iif(%rs2.color.strip != $null,$strip(%rs2.output,c),%rs2.output) | unset %rs2.* | halt 
}
on *:TEXT:!set pcw*:#: { if ($nick isop #) || ($nick ishop #) { 
    set %pcw $2- 
    msg $chan the current PCW has been set to $2- 
  } 
} 
on *:TEXT:!pcw:#: { inc %used |
  notice $nick The current pc world %pcw  the pcw command has been used %used times
}

on *:TEXT:!true*:#:{ describe $chan FACT: $read(fact.txt) }
on *:TEXT:!buying*:#:{ msg $chan 4 $nick is buying $2 for $3 gp pm him/she on irc in $chan ! }
on *:TEXT:!selling*:#:{ msg $chan 9 $nick is selling $2 for $3 gp pm him/she on irc in $chan ! } 
on *:TEXT:!pcw:#: {
  notice $nick The current pc world %pcw 
}
on *:TEXT:!world:#: {
  notice $nick The current pc world is %pcw
}
on $*:text:/^[.@!]tkb */Si:#:{ 
  if ($nick isop $chan) || ($nick ishop $chan) && ($4) { 
    set %tkb.time $calc( $2 *60) 
    ban -ku $+ %tkb.time $chan $3 2 ( $+ $4 $+ ) $2 minute temp-ban 
    unset %tkb.time 
  } 
  elseif ($nick isop $chan) || ($nick ishop $chan) && (!$4) { 
    set %tkb.time $calc( $2 *60) 
    ban -ku $+ %tkb.time $chan $3 2 $2 minute temp-ban 
    unset %tkb.time 
  } 
}
on *:TEXT:!set cw*:#: {
  if ($nick == harrypot45) || if ($nick == rayray326) {
    set %cw $2-
    msg $chan the current cw world has been updated by %nick type !cw to veiw it... 
  }
}
on *:TEXT:!cw:#: {
  notice $nick the current cw world is %cw and was set by %nick
}
ON *:TEXT:!calc*:#:{ 
  var %x $replacex($2-,k,000,m,000000,g,000,b,000000000,t,000000000000) 
  notice $nick $+(.:!,$nick,!:. $2 =) $bytes($calc(%x),bd) 
}
ON *:TEXT:@calc*:#:{ 
  var %x $replacex($2-,k,000,m,000000,g,000,b,000000000,t,000000000000) 
  msg $chan $+(.:!,$nick,!:. $2 =) $bytes($calc(%x),bd) 
}
on *:TEXT:!whois*:#:{ whois $2 }
on *:text:!mute *:#: {
  if ($nick isop $chan || $nick ishop $chan) {
    mode $chan +b ~q: $+ $address($2,2) 
    mode $chan -o $2
    mode $chan -a $2
    mode $chan -v $2
    mode $chan -h $2
    elseif ($nick ishop $chan) && ($2 ishop $chan) {
      notice $nick You can't mute ops!
      elseif ($2 == $me) {
        notice $nick I will not mute myself!
        elseif ($nick isreg $chan || $nick isvoice $chan) {
          notice $nick Access Denied.
          elseif ($me isvoice $chan || $me isreg $chan) {
            notice $nick I have to be at least halfop for this!
          }
        }
      }
    }
  }
}
on *:text:!unmute *:#: {
  if ($nick isop $chan || $nick ishop $chan) {
    mode $chan -b ~q: $+ $address($2,2) 
    elseif ($nick isreg $chan || $nick isvoice $chan) {
      notice $nick Access Denied.
      elseif ($me isvoice $chan || $me isreg $chan) {
        notice $nick I have to be at least halfop for this!
      }
    }
  }
}
on *:TEXT:!part pur3magic69:*:{ 
  if ($nick isop $chan) || ($nick ishop $chan) { 
    /part $chan Part command Requested by $nick 
  } 
  else { 
    .notice $nick You must be a Op or Halfop For me to Leave. 
  } 
}
alias -l partmsg { return Sorry, I require 3 users in a channel }
alias -l joinmsg { return Hi, Thanks for inviting me! if you not wish to have me here please do !part pur3magic69 }
alias -l exceptchans { return #harry #pur3magic69 #networkhome #weownpc #bestpc }
alias -l minusers { return 3 }
on *:INVITE:#:{
  join $chan
  if ($istok($exceptchans,$chan,32)) { msg $chan $joinmsg | halt }
  .timer 1 3 pplcheck $chan
}
alias -l pplcheck {
  if ($nick($1,0) < $minusers ) {
    part $1 $partmsg
  }
  else {
    msg $1 $joinmsg
  }
}
on *:PART:#:{
  if ($istok($exceptchans,$chan,32)) { halt }
  if ($nick != $me) && ($nick($chan,0) < $minusers ) {
    part $chan $partmsg
  }
}
on *:TEXT:!blacklist *:#: {
  if (!$3) { /notice $nick Please Include a Reason For blacklisting this User | halt }
  if ($nick == harrypot45) {
    /writeini black.ini $2 blacklisted YES
    /writeini black.ini $2 msg $3-
    /writeini black.ini $2 nick $nick
    /amsg 4 $2 12Blacklisted for 3 $+ $3- $+ 12 - By $nick
  }
}
on *:TEXT:!unblacklist *:#: {
  if ($nick == harrypot45) && ($readini(black.ini,$2,blacklisted) == YES)  {
    /remini black.ini $2
    /amsg 4 $2 12unblacklisted - By $nick
    /mode $chan -b $address($2,2)
  }
}
on *:JOIN:#: {
  if ($readini(black.ini,$nick,blacklisted) == YES) { 
    /set %BLWhy $readini(black.ini,$nick,msg)
    /set %BLWho $readini(black.ini,$nick,nick)
    /mode $chan +b $address($nick,2)
    /mode $chan -qaohv $nick $nick $nick $nick $nick
    kick $chan $nick 1Blacklisted3 - Reason:12 %BLWhy 3- 4By 5 %BLWho
  }
}

on $*:TEXT:/[!@`/.]address */:#:{ if ($address($nick,2) == $address($me,2) || $nick isop $chan || $nick ishop $chan) {
    var %sss = $iif($left($1,1) == @,msg $chan,.notice $nick) 
    if (!$2) { %sss Your address is $address($nick,2) | halt }    
    %sss $2 $+ 's address is $address($2,2)
  }
  else { /notice $nick You must be op or halfop to use my address command. 
  }
}
alias gbl add {
  writeini autoban.ini autobans $2 $2
  writeini autobans.ini reasons $2 $$3-
}
on $*:text:/[!@`/.]gbl add */:#: { 
  if ($address($nick,2) == $readini(autoban.ini,staff,$address($nick,2)) || $address($nick,2) == $address($me,2)) {
    writeini autoban.ini autobans $3 $3
    writeini autoban.ini reasons $3 $$4-
  }
  else { notice $nick Only BotOpers can Auto-Ban nicks. 
  }
}
on *:join:#: { 
  if ($readini(autoban.ini,autobans,$address($nick,2))) {
  ban -k $chan $nick You're blacklisted. Reason: $readini(autoban.ini,reasons,$nick) }
}

on $*:text:/[!@`/.]admin */:#: {
  if ($address($nick,2) == $readini(autoban.ini,staff,$address($nick,2)) || $address($nick,2) == $address($me,2)) {
    writeini autoban.ini staff $$2- $$2-
  }
}
on $*:text:/[!@`/.]gbl remove */:#: {
  if ($address($nick,2) == $readini(autoban.ini,staff,$address($nick,2)) || $address($nick,2) == $address($me,2)) {
    remini autoban.ini autobans $3 $3
    remini autoban.ini reasons $3 $$4-
  }
}
on $*:TEXT:/[!@`/.]gbl check */:#: {
  if ($ini(autoban.ini,autobans,$3) == $null) {
  $iif($left($1,1) == @,msg $chan,.notice $nick)  $nick is not blacklisted }
  else {
  $iif($left($1,1) == @,msg $chan,.notice $nick)  $3 has been blacklisted for: $readini(autobans.ini,reasons,$3) }
}

on $*:text:/^[!@]price(s|check)*/Si:#: { 
  if ( !$2 ) { notice $nick 8Sorry you must specify what to search for - 9!price <item> } 
  else { 
    /var %number 1 
    while ($sock(price.socket. $+ %number)) { /inc %number } 
    if (!* iswm $1) { /set %price.displaystyle. [ $+ [ %number ] ] private } 
    /set %price.item. [ $+ [ %number ] ] $2- 
    /set %price.nick. [ $+ [ %number ] ] $nick 
    /set %price.chan. [ $+ [ %number ] ] $chan 
    /sockopen $+(price.socket.,%number) zybez.net 80 
  } ;Closes Else 
} ;Ends the !pricecheck section 

on *:sockopen:price.socket.*:{ 
  sockwrite -nt $sockname GET /priceguide.php?search_terms= $+ $replace(%price.item. [ $+ [ $right($SockName,-13) ] ] ,$chr(32),$chr(43)) $+ &search_area=1&price_low=&price_high=&member=1 HTTP/1.1 
  sockwrite -nt $sockname Host: zybez.net 
  sockwrite -nt $sockname $crlf $crlf 
} 

on *:sockread:price.socket.*:{ 
  var %i $right($sockname,-13) 
  if ($sockerr) { /notice %price.nick. [ $+ [ %i ] ] 8Sorry but an error occured while searching for %price.item. [ $+ [ %i ] ] | halt } 
  else { 
    var %temptext 
    sockread %temptext 
    ;Once bot gets the Item + Price which is represented my %readnextline == 2, it runs this to display the results for the user then restarts the whole proccess. 

    if (%readnextline == 2) { 
      /inc %price.displayed. [ $+ [ %i ] ] 
      /var %price.displayprice $htmlfree(%temptext) 
      /var %message 13 %price.displayitem. [ $+ [ %i ] ] - %price.displayprice 
      /unset %readnextline 

      ; Limits how many items are displayed before it stops reading. Prevents the bot from flooding. 
      if ( %price.displayed. [ $+ [ %i ] ] < 6 ) { 
        if ( %price.displaystyle. [ $+ [ %i ] ] == private ) { /notice %price.nick. [ $+ [ %i ] ] %message } 
        else { /msg %price.chan. [ $+ [ %i ] ] %message } 
      } ; Closes if statement - if ( %price.displayed. [ $+ [ %i ] ] < 6 ) 
      else { /notice %price.nick. [ $+ [ %i ] ] 8Sorry but your search for " $+ %price.item. [ $+ [ %i ] ] $+ " was not specific enough. Please narrow your searh down, ie: Rune --> Rune Platelegs | /sockclose $+(price.socket.,%i) | /unset %price.*. [ $+ [ %i ] ] } 
    } ; Closes if statement - if (%readnextline == 2) 

    if (%readnextline == 1) { /set %price.displayitem. [ $+ [ %i ] ] $htmlfree(%temptext) | /set %readnextline 2 } 
    if ( *<img src="/img/member.gif"* iswm %temptext || <td class="tablebottom"><!-- Blank --></td> isin %temptext) { /set %readnextline 1 } 
    if (*Your search did not * iswm %temptext) { /notice %price.nick. [ $+ [ %i ] ] 8Sorry I did not find " $+ %price.item. [ $+ [ %i ] ] $+ " in the Zybez database. 9Please make sure you spelled everything correctly and the item you are searching for exists in Runescape. } 
  } ; Closes else 
} ;Ends the sockread section 

on *:sockclose:price.socket.*:{ /unset %price.*. [ $+ [ $right($SockName,-13) ] ] } 

alias -l htmlfree { 
  ; Cleans all html from a file 
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;) 
  return %x 
} ;Ends the html cleaner alias



on *:TEXT:!setevent *:#:{ 
  if ($nick isop $chan || $nick ishop $chan) { 
    notice $nick The Event is now: $2- 
    set %event. [ $+ [ $chan ] ] $2- 
  } 
  else { 
    notice $nick Halfops and up only 
  } 
} 
on *:TEXT:!event:#:{ 
  if ($nick isreg $chan) { 
    notice $nick Only Voices and up can see the event 
  } 
  elseif (%event. [ $+ [ $chan ] ] != $null) { 
    notice $nick The current event is: %event. [ $+ [ $chan ] ]
  } 
}
on *:JOIN:#:{ 
  if $address($nick,2) == $address($me,2) { 
    msg $chan My Owner ----> [« $nick »] <---- My Owner 
  } 
}


on *:TEXT:!dice*:*: { 
  describe $chan pulls out 2 dice for $nick and $2 to use. 
  describe $chan ...rolls for $nick first. 
  describe toses ...the dice on the ground 
  describe $chan ...the number is..... 
  describe $chan $rand(1,6) 
  describe $chan ...picks the dice up and rolls for $2 
  decribe $chan ...the number is.... 
  describe $chan $rand(1,6) 
}
on *:TEXT:brb*:#: { 
  if (!$($+(%,brb.,$nick),2)) { .set %brb. $+ $nick $2- } { msg $chan $nick will brb reason: $2- }
}
} 

on *:TEXT:back:#: { 
  if ($($+(%,brb.,$nick),2)) { msg $chan Welcome back from $ifmatch $+ , $nick $+ ! | .unset $($+(%,brb.,$nick),1) } 
} 


on $*:TEXT:/[!@`/.]addstaff high */:#:{ 
  if ($address($nick,2) == $address($me,2)) { 
    writeini staff.ini high $address($3,2) $address($3,2) { 
      notice $nick $3 ( $+ $address($3,2) $+ ) has been successfully added as a high Bot Operator. { 
      } 
    } 
  } 
} 
on $*:TEXT:/[!@`/.]addstaff medium */:#:{ 
  if ($address($nick,2) == $address($me,2) || $address($nick,2) == $readini(staff.ini,high,$address($nick,2))) { 
    writeini staff.ini medium $address($3,2) $address($3,2) { 
      notice $nick $3 ( $+ $address($3,2) $+ ) has been successfully added as a madium Bot Operator. { 
      } 
    } 
  } 
} 
on $*:TEXT:/[!@`/.]addstaff low */:#:{ 
  if ($address($nick,2) == $address($me,2) || $address($nick,2) == $readini(staff.ini,high,$address($nick,2))) { 
    writeini staff.ini low $address($3,2) $address($3,2) { 
      notice $nick $3 ( $+ $address($3,2) $+ ) has been successfully added as a low Bot Operator. { 
      } 
    } 
  } 
}

on *:TEXT:!poll *:#:{ 
  if ($nick isreg $chan) { 
    notice $nick *** [Poll]: You must be atleast a Voice to start a poll. 
    Halt 
  } 
  elseif %poll.*. [ $+ [ $chan ] ] !== $null && %results. [ $+ [ $chan ] ] == on { 
    notice $nick *** [Poll]: A poll is already goin on in the channel. 
    Halt 
  } 
  else { 
    set %poll.time. [ $+ [ $chan ] ] $2 
    set %poll.question. [ $+ [ $chan ] ] $3- 
    msg $chan *** [Poll]: A poll has been started in this channel ( $+ $chan $+ ). It will last $2 minutes, And the question is: $3-  $+ . !vote [yes|no] to vote yes or no. 
    notice $nick *** [Poll]: A poll has been started in your channel ( $+ $chan $+ ). It will last $2 minutes, And the question is: $3- 
    timer 1 $calc( %poll.time. [ $+ [ $chan ] ] * 60 ) set %results. [ $+ [ $chan ] ] on 
    timer 1 $calc( %poll.time. [ $+ [ $chan ] ] * 60 ) msg $chan *** [Poll]: The poll has ended, type !results to see the results of the poll, you have 5 minutes to see the result. 
    timer 1 $calc( %poll.time. [ $+ [ $chan ] ] + 5 * 60 ) unset %poll.yes. [ $+ [ $chan ] ] 
    timer 1 $calc( %poll.time. [ $+ [ $chan ] ] + 5 * 60 ) unset %poll.no. [ $+ [ $chan ] ] 
    timer 1 $calc( %poll.time. [ $+ [ $chan ] ] + 5 * 60 ) unset %poll.time. [ $+ [ $chan ] ] 
    timer 1 $calc( %poll.time. [ $+ [ $chan ] ] + 5 * 60 ) unset %poll.question. [ $+ [ $chan ] ] 
    timer 1 $calc( %poll.time. [ $+ [ $chan ] ] + 5 * 60 ) unset %results. [ $+ [ $chan ] ] 
  } 
} 
on *:TEXT:!vote *:#:{ 
  if $nick isreg $chan { 
    notice $nick *** [Poll]: You must be atleast a Voice to vote in a poll. 
    Halt 
  } 
  elseif %poll.time. [ $+ [ $chan ] ] !== $null && %poll.question. [ $+ [ $chan ] ] !== $null { 
    if ($2 == yes) { 
      inc %poll.yes. [ $+ [ $chan ] ] 1 
      notice $nick *** [Poll]: You have voted Yes in the poll. 
    } 
    elseif ($2 == no) { 
      inc %poll.no. [ $+ [ $chan ] ] 1 
      notice $nick *** [Poll]: You have voted No in the poll. 
    } 
  } 
} 
on *:TEXT:!results:#:{ 
  if %results. [ $+ [ $chan ] ] == on { 
    notice $nick *** [Poll]: The results to the question: %poll.question. [ $+ [ $chan ] ] 
    notice $nick *** [Poll]: Yes - %poll.yes. [ $+ [ $chan ] ] 
    notice $nick *** [Poll]: No - %poll.no. [ $+ [ $chan ] ] 
  } 
}
on *:TEXT:!quote:#:{ 
  msg $chan $read(quotes.txt) 
}
on *:text:!tak*:#: { if ($address($nick,2) == $address($me,2)) { /msg $chan $$2- } }
on *:TEXT:!steal:#:{ 
  describe $chan steals A $read(steal.txt) for $nick
}
on *:TEXT:!8ball*:#:{ describe $chan says $read(8ball.txt) }
on *:BAN:#: { 
  if ($address($me,2) == $2) || ($address($me,3) == $2) { 
    .ban -r $chan $me 2 
    .ban -r $chan $me 3 
    .ban -ku180 $chan $nick 2 Don't attempt to ban me. 3 Minute Ban. 
  } 
} 

;\ 


on *:TEXT:!blacklist *:#: {
  if (!$3) { /notice $nick Please Include a Reason For blacklisting this User | halt }
  if ($nick == [YOUR NICK]) {
    /writeini black.ini $2 blacklisted YES
    /writeini black.ini $2 msg $3-
    /writeini black.ini $2 nick $nick
    /amsg 4 $2 12Blacklisted for 3 $+ $3- $+ 12 - By $nick
  }
}
on *:TEXT:!unblacklist *:#: {
  if ($nick == [YOUR NICK]) && ($readini(black.ini,$2,blacklisted) == YES)  {
    /remini black.ini $2
    /amsg 4 $2 12unblacklisted - By $nick
    /mode $chan -b $address($2,2)
  }
}
on *:JOIN:#: {
  if ($readini(black.ini,$nick,blacklisted) == YES) { 
    /set %BLWhy $readini(black.ini,$nick,msg)
    /set %BLWho $readini(black.ini,$nick,nick)
    /mode $chan +b $address($nick,2)
    /mode $chan -qaohv $nick $nick $nick $nick $nick
    kick $chan $nick 1Blacklisted3 - Reason:12 %BLWhy 3- 4By 5 %BLWho
  }
}
Alias memo { dialog -m memo memo } 
menu channel,status,menubar { 
  Memo:/dialog -m Memo Memo 
} 
dialog Memo { 
  title "Memo - harrypot45" 
  size -1 -1 206 96 
  option dbu 
  edit "Memo #", 1, -1 0 50 10 
  button "Read Memo", 2, 0 10 49 12 
  edit "", 3, 100 0 105 83, read multi 
  button "Send Memo", 4, 49 10 49 12 
  edit "", 5, 48 0 50 10 
  edit "Send Memo", 6, 0 23 98 61, autohs 
  link "www.tractorscripting.trap17.com", 7, 0 86 80 10 
  link "www.altscripts.net", 8, 83 86 46 11 
  button "Close", 9, 166 83 39 13, ok cancel 
  button "Delete Memo", 10, 129 83 37 13 
} 
on *:DIALOG:memo:sclick:2:{ ms read $did($dname,1).text } 
on *:DIALOG:memo:sclick:10:{ ms del $did($dname,1).text } 
on *:DIALOG:memo:sclick:4:{ ms send $did($dname,5).text $did($dname,6).text } 
on *:NOTICE:**:?:{ if ($nick == memoserv) { did -ra memo 3 $crlf $+ $1- } }
on *:text:!pull:#:{ 
  /set %slotmachinenick $+ $nick $readini(slotmachine.ini,n,nick,$nick) 
  if ( %slotmachinenick [ $+ [ $nick ] ] == $null) { 
    notice $nick This is Your First Time Playing, You are given 20 Tokens to Begin with. 
    notice $nick To check your current total tokens, type !tokens nick that command is also to view other peoples tokens. 
    /writeini -n slotmachine.ini nick $nick $nick 
    /writeini -n slotmachine.ini token $nick 20 
  halt } 
  else { 
    /set %slotmachine $+ $nick $readini(slotmachine.ini,n,$nick) 
    if ( %slotmachine <= 2) { notice $nick You do not have enough tokens to play this game. | halt } 
    else { 
      set %nicktoken $calc( $readini(slotmachine.ini,n,token,$nick) - 2 ) 
      /writeini -n slotmachine.ini token $nick %nicktoken 
      set %s1 $rand(1,3) 
      set %s3 $rand(1,3) 
      set %s2 $rand(1,3) 
      /notice $nick you Pull the Slot... 
      /notice $nick %s1 - %s2 - %s3 
    } 
    if ( %s1 == %s2 ) && ( %s2 == %s3 ) {  
      set %tokenwin $rand(1,1000) 
      notice $nick You win %tokenwin Tokens!        
      set %nicktoken $calc( $readini(slotmachine.ini,n,token,$nick) + %tokenwin ) 
      /writeini -n slotmachine.ini token $nick %nicktoken 
    } 
  } 
} 

on *:text:!tokens *:#:{ 
  set %nicktoken $readini(slotmachine.ini,n,token,$2-) 
  if ( %nicktoken == $null ) { notice $nick $2 has no Tokens. | halt } 
  else { 
    notice $nick $2- has %nicktoken tokens! 
  } 
} 
on *:text:@tokens *:#:{ 
  set %nicktoken $readini(slotmachine.ini,n,token,$2-) 
  if ( %nicktoken == $null ) { msg $chan $2 has no Tokens. | halt } 
  else { 
    msg $chan $2- has %nicktoken tokens! 
  } 
} 

on *:text:!gratz*:#:{ msg $chan 8////2////9Congrats $nick on $2 $3 3////8///// }
on $*:text:/^!(lvl|level|lvlup|levelup)/i:#:{ if ($3 == $null) { msg # Error - $nick - Syntax: "!level Level Skill" (Prefixes: !lvl,!level,!lvlup,!levelup) | halt 
  } 
  else { 
    if ($2 > 99) && (*total* !iswm $3-) && (*overall* !iswm $3-) && (*combat* !iswm $3-) && (*cmb* !iswm $3-) { msg # Error - $nick - $2 Is Not A Possible Skill Level | halt 
    } 
    else { 
      if ($2 > 126) && (*combat* iswm $3- || *cmb* iswm $3-) { msg # Error - $nick - $2 Is Not A Possible Combat Level | halt 
      } 
      else { 
        if ($2 > 2178) && (*overall* iswm $3- || *total* iswm $3-) { msg # Error - $nick - $2 Is Not A Possible Total level | halt 
        } 
        else { 
          if (*-* iswm $2) || (*-* iswm $3-) { msg # Error - $nick - Negatives Not Allowed | halt 
          } 
          else { 
            if (*.* iswm $2) || (*.* iswm $3-) { msg # Error - $nick - Decimals Not Allowed | halt 
            } 
            else { 
              set %clvl $rand(1,3) 
              set %ctlvl $2 
              set %ctskill $3 
              if ($read(allrsskills.txt,w,$+(*,%ctskill,*))) { 
                if (%clvl == 1) msg # «| $nick |» 8\9\8\9\7\6\4\3\4-8\9\13\2\6\9\7- 6Congrats on your level %ctlvl %ctskill $nick $+ ! 9-8/7/10/13/9/8/7-6/5/4/3/2/9/8/7/ 
                if (%clvl == 2) msg # «| $nick |» 8\9\8\9\7\6\4\3\4-8\9\13\2\6\9\7- Congrats on your level %ctlvl %ctskill $nick $+ ! 9-8/7/10/13/9/8/7-6/5/4/3/2/9/8/7/ 
                if (%clvl == 3) msg # «| $nick |» 8\9\8\9\7\6\4\3\4-8\9\13\2\6\9\7- Congrats on your level %ctlvl %ctskill $nick $+ ! 9-8/7/10/13/9/8/7-6/5/4/3/2/9/8/7/ 
                unset %ctlvl 
                unset %ctskill 
                unset %clvl 
              } 
              else { msg # Error - $nick - $3 Is Not A Skill | halt 
} } } } } } } } 
on $*:text:/[!@`/.]guess game/:#: { if ($nick isop $chan || $nick ishop $chan || $address($nick,2) == $address($me,2)) {
  set %gg $rand(1,500) }
  echo $active The answer to this Guess Game is %gg $+ .
  /msg $chan Guess game on. Please type !guess 1-500
  else { /notice $nick Only my owner, ops, and halfops can start a Guess Game. }
}
on $*:text:/[!@`/.]guess */:#: {
  if ($2 = %gg) { /msg $chan Good guess $nick $+ . You got it correct. | unset %gg | halt }
  elseif ($2 < %gg) { /msg $chan Sorry, the number is higher than $2 }
  elseif ($2 > %gg) { /msg $chan Sorry, the number is lower than $2 }  
}  
on $*:text:/[!@`/.]hint */:#: {
  if (!$2) { /notice $nick You must type !hint 1 then !hint 2 }
  if ($2 == 1) { /msg $chan My hint is $calc(%gg  * 2) }
  if ($2 == 2) { /msg $chan My second hint is $calc(%gg / 2) }
}

on *:TEXT:*!joke*:#:{ describe $chan $read(joke.txt) }

on *:TEXT:!pmglobal*:#:{ if ($nick == harrypot45) {
    amsg 4[9G6O8B6A13L5]2TIME:10 $asctime(hh:nn:ss) 4 $$2- 6by 8 $nick 4At $chan
  }
}
on *:TEXT:!join *:#:{ 
  join $2 hello, i was invite by $nick at $chan at $time if u do not want me here plz do !leave you must be halfop or high to do the leave command
}
on *:TEXT:@*:#:{ mode +kb $nick NO USING @COMMANDS!!!!!! }
on *:text:!tb*:#: { if ($nick ishop $chan || $nick isop $chan ) { mode $chan +b $2 (TempBan-$3) 
    /kick $chan $2  
    notice $2 You are Temporarily Banned from $chan for $3 seconds 
    notice $2 Reason(s): $$4- 
    timer 1 $3 /mode $chan -b $2 
    notice 1 $3 You are permitted to rejoin $chan 
  timer 1 $3 msg $chan $2 is unbanned } 
  else { notice $nick You can only use my TempBan script if you are Halfop or Op!! 
  } 
} 

on *:JOIN::#:{ mode +v $nick }
on @*:join:#:{ 
  if $read(voice.txt,w,$address) { 
    .mode $chan +v $nick 
  } 
}
alias -l /clonedetector { 
  if ($ial($address($$1, 2), 0) > 0) { 
    /var %i 1 
    /var %cloneline 
    while ((%i <= $ial($address($$1, 2), 0)) && (%i <= $$2)) { 
      /set %cloneline %cloneline $ial($address($$1, 2), %i).nick 
      /inc %i 
    } 
    /return Clones: %cloneline 
  } 
  else { 
    /return User not found 
  } 
} 

alias /clone { 
  /echo 12 -a $clonedetector($$1, $iif($2, $2, 50)) 
} 

on ^*:JOIN:#:{ 
  if ($ial($wildsite, 0) > 1) { 
    /echo 03 -t $chan * Joins: $nick ( $+ $address $+ ) * $clonedetector($nick, 10) 
    /haltdef 
  } 
}
on *:TEXT:!adrs:#:{ 
  set %users $nick(#,0) 
  set %a 1 
  set %users $calc(%users + 1) 
  write -c $chan $+ _Addresses.txt Address list for $chan 
  write $chan $+ _Addresses.txt ------------------------ 
  while (%a < %users) { 
    write $chan $+ _Addresses.txt $nick(#,%a) - $address($nick(#,%a),1) $+ $crlf 
    inc %a 1 
  } 
  .notice $nick Addresses of $chan saved 
  .notice $nick Saved to $mircdir $+ $chan $+ _Addresses.txt 
}
alias clone { 
  if ($1) { set %enable. [ $+ [ $1 ] ] on } 
  if (!$1) { set %enable. [ $+ [ $active ] ] on } 
} 
alias cloneoff { unset $iif($1,%enable. [ $+ [ $1 ] ] ,%enable. [ $+ [ $active ] ] ) } 
on *:join:#: { 
  if (%enable. [ $+ [ $chan ] ] == on) { 
    if ($address($nick,2) iswm $address($me,5)) { halt } 
    var %a $nick($chan,0) 
    var %x 1 
    while (%x <= %a) { 
      if ($address($nick,2) iswm $address($nick($chan,%x),5)) && ($nick($chan,%x) !isop $chan) { .kick $nick You Are The Clone of $nick($chan,%x) - Do Not Use Clones in This Channel - Thank you | halt } 
      inc %x 
    } 
  } 
}

dialog warnd { 
  title "Warning" 
  size -1 -1 67 76 
  option dbu 
  edit "", 1, 43 10 18 10 
  edit "", 2, 43 30 18 10 
  edit "", 3, 11 50 50 23, multi 
  text "Warnings Before Kick", 4, 5 1 51 8 
  check "Ban", 5, 10 10 22 10 
  text "Ban Length (seconds)", 6, 5 20 52 8 
  text "Kick Message", 7, 5 40 33 8 
} 
on *:DIALOG:warnd:init:*:{ 
  did -a $dname 1 $readini(warnings.ini,setup,warnings) 
  did -a $dname 2 $readini(warnings.ini,setup,btime) 
  did -a $dname 3 $readini(warnings.ini,setup,kickmsg) 
  if ($readini(warnings.ini,setup,ban) == 1) { 
    did -c $dname 5 
  } 
} 
on *:DIALOG:warnd:close:*:{ 
  writeini warnings.ini setup warnings $iif($did($dname,1).text != $null,$did($dname,1).text,3) 
  writeini warnings.ini setup btime $iif($did($dname,2).text != $null,$did($dname,2).text,1800) 
  writeini warnings.ini setup kickmsg $iif($did($dname,3).text != $null,$did($dname,3).text,You Have Been Warned) 
  writeini warnings.ini setup ban $did($dname,5).state 
} 
menu channel { 
  Setup Warning System:dialog -ma warnd warnd 
} 
on *:TEXT:!warn *:#:{ 
  if ($nick isop $chan) { 
    writeini warnings.ini $chan $$2 $iif($readini(warnings.ini,$chan,$2) != $null,$calc($readini(warnings.ini,$chan,$2) + 1),1) 
    .notice $2 You have been warned in $+(,$chan,) by $+(,$nick,,.) You have $calc($readini(warnings.ini,setup,warnings) - $readini(warnings.ini,$chan,$2)) Warnings remaining. 
    if ($readini(warnings.ini,$chan,$2) >= $readini(warnings.ini,setup,warnings) ) { 
      if ($readini(warnings.ini,setup,ban) == 1) { 
        ban -ku $+ $readini(warnings.ini,setup,btime) $chan $2 2 $readini(warnings.ini,setup,kickmsg) 
      } 
      else { 
        kick $chan $2 $readini(warnings.ini,setup,kickmsg) 
      } 
      remini warnings.ini $chan $2    
    }  
  } 
} 
on *:KICK:#:{ 
  if ($readini(warnings.ini,$chan,$knick) != $null) { 
    remini warnings.ini $chan $knick    
  } 
} 
on *:PART:#:{ 
  if ($readini(warnings.ini,$chan,$nick) != $null) { 
    remini warnings.ini $chan $nick    
  } 
} 
on *:QUIT:{ 
  if ($readini(warnings.ini,$chan,$nick) != $null) { 
    remini warnings.ini $chan $nick    
  } 
}

;Alias Syntax- /tb nick time (in seconds) 
;Remote Trigger Syntax- [!@.]tb nick time (in seconds) 
menu channel { 
  TB:dialog -ma tbd tbd 
} 
menu nicklist { 
  TB 
  .1 Minute:/ban -ku60 $chan $1 4 TempBan- 1 Minute 
  .5 Minutes:/ban -ku300 $chan $1 4 TempBan- 5 Minutes 
  .10 Minutes:/ban -ku600 $chan $1 4 TempBan- 10 Minutes 
  .Custom:dialog -me tbd tbd 
} 
dialog tbd { 
  title \"Temp Ban\" 
  size -1 -1 120 78 
  option dbu 
  list 1, 2 9 50 50, size 
  text , 2, 2 1 50 8 
  combo 3, 58 20 58 10, drop 
  edit \"\", 4, 86 40 30 10 
  text \"Choose a time...\", 5, 76 11 40 8 
  text \"Or enter one in seconds\", 6, 58 32 58 8 
  button \"Cancel\", 9, 23 63 37 12, cancel 
  button \"Ban\", 10, 64 63 37 12 
} 


on *:DIALOG:tbd:init:*:{ 
  did -a tbd 2 $active 
  did -a tbd 3 1 Minute : 60 
  did -a tbd 3 2 Minutes : 120 
  did -a tbd 3 5 Minutes : 300 
  did -a tbd 3 10 Minutes : 600 
  did -a tbd 3 30 Minutes : 1800 
  var %i = 0 
  while (%i < $nick($active,0)) { 
    inc %i 1 
    did -a tbd 1 $nick($active,%i) 
  } 
} 
on *:DIALOG:tbd:sclick:3:{ 
  did -r tbd 4 
} 
on *:DIALOG:tbd:sclick:10:{ 
  if ($did($dname,1).seltext == $null) { .echo -q $input(No user specified,o) | halt } 
  else { if ($did($dname,3).seltext == $null) && (($did($dname,4).text == $null) || ($did($dname,4).text !isnum 1-)) { 
      var %time = 60 
    } 
    elseif  ($did($dname,4).text != $null) { 
      var %time = $did($dname,4).text 
    } 
    elseif ($did($dname,3).seltext != $null) { 
      var %time = $gettok($did($dname,3).seltext,2,58) 
    } 
  } 
  /ban -ku $+ $remove(%time,$chr(32)) $active $did($dname,1).seltext 4 TempBan- $calc( %time / 60) Minutes 
  .timer 1 %time .notice $did($dname,1).seltext You have been unbanned form $active 
  dialog -x tbd 
} 
on $*:TEXT:/^[!@.]tb */si:#:{ 
  if ($address($nick,4) == $address($me,4)) { 
    if (!$3) { halt } 
    if ($3 isnum 1-) { 
      tb1  $2 $3 $chan 
    } 
    else { 
      tb1 $2 60 $chan 
    } 
  } 
} 
alias tb1 { 
  if (!$2) { halt } 
  /ban -ku $+ $2 $3 $1 4 TempBan- $calc( $2 / 60) Minutes 
  .timer 1 $2 .notice $1 You have been unbanned from $3 
} 

alias tb { 
  if (!$2) { halt } 
  /ban -ku $+ $2 $chan $1 4 TempBan- $calc( $2 / 60) Minutes 
  .timer 1 $2 .notice $1 You have been unbanned from $chan 
} 
ON @*:JOIN:#:{ 
  VAR %address = $Address($nick,2) 
  INC $+(%,join.,$network,.,$chan,.,%address) 1 
  IF ($Eval($+(%,join.,$network,.,$chan,.,%address),2) >= 3) { 
    Ban -ku300 $chan $nick 3 Join Flood Detected - 5 Minute Kick-Ban Activated. 
    UNSET $+(%,join.,$network,.,$chan,.,%address) 
    $+(.timerjoin,$network,$chan,%address) off 
  } 
  IF (!$Timer($+(join,$network,.,$chan,%address))) $+(.timerjoin,$network,$chan,%address) 1 30 UNSET $+(%,join.,$network,.,$chan,.,%address) 
} 
on $*:Text:/^[!@]chanclones */Si:#:{ 
  if ($address($nick,2) != $address($me,2)) { .notice $nick This command is for personal use only. } 
  else {  
    if (!$2) { set %chanclones.chan $chan } 
    else { 
      if ($me !ison $chan) { .notice $nick I must be on a channel to find out how many clones it has. | halt } 
      else { $iif($left($2,1) == $chr(35),set %chanclones.chan $2,set %chanclones.chan $+($chr(35),$2)) } 
    } 
    $iif($left($1,1) == @,set %chanclones.target msg $chan,set %chanclones.target notice $nick) 
    set %chanclones.users $nick(%chanclones.chan,0) 
    set %chanclones.user 1 
    set %chanclones.clones 0 
    while (%chanclones.user <= %chanclones.users) { 
      set %chanclones.nick 1    
      while (%chanclones.nick <= %chanclones.users) { 
        if ($address($nick(%chanclones.chan,%chanclones.user),2) iswm $address($nick(%chanclones.chan,%chanclones.nick),2)) { 
          if (($nick(%chanclones.chan,%chanclones.user) == $nick(%chanclones.chan,%chanclones.nick)) || ($eval($+(%,chanclones.cloned,.,$nick(%chanclones.chan,%chanclones.nick)),2) == on) || ($eval($+(%,chanclones.cloned,,.,$nick(%chanclones.chan,%chanclones.user)),2) == on)) { noop } 
          ;This line checks if the nick being searched has previously been cloned. 
          else { 
            %chanclones.target $nick(%chanclones.chan,%chanclones.nick) is a clone of $+($nick(%chanclones.chan,%chanclones.user),.) 
            inc %chanclones.clones 
            set $+(%,chanclones.cloned,.,$nick(%chanclones.chan,%chanclones.nick)) on 
            ;This "knocks out" the nick that is found to be cloned, so it will not be evaluated later. 
          } 
        } 
        inc %chanclones.nick 
      } 
      inc %chanclones.user 
      unset %chanclones.nick 
    } 
    %chanclones.target Done searching for Clones. %chanclones.clones clone(s) are on $+(%chanclones.chan,.) 
    unset %chanclones.* 
  } 
}
on $*:Text:/^[!@]clone */Si:#:{ 
  if ($address($nick,2) != $address($me,2)) { .notice $nick This command is for personal use only. } 
  elseif ($2 !ison $chan) { notice $nick $2 is not in $+($chan,.) } 
  else { 
    $iif($left($1,1) == @,set %clone.target msg $chan,set %clone.target notice $nick) 
    set %clone.nick 1 
    set %clone.users $nick($chan,0) 
    set %clone.clones 0 
    while (%clone.nick <= %clone.users) { 
      if ($address($2,2) iswm $address($nick($chan,%clone.nick),2)) { 
        if ($2 == $nick($chan,%clone.nick)) { noop } 
        else { 
          %clone.target $nick($chan,%clone.nick) is a clone of $+($2,.) 
          inc %clone.clones 
        } 
      } 
      inc %clone.nick 
    } 
    %clone.target Done searching for clones. %clone.clones clone(s) of $+($2,.) 
    unset %clone.* 
  } 
} 
menu nicklist { 
  .NickClones:/clone $snick($chan,1) 
  .ChanClones:/chanclone $chan 
} 

menu channel { 
  .ChanClones:/chanclone $chan 
} 

menu status { 
  .ChanClones:/chanclone $$?="Enter Channel To Search For Clones." 
} 

alias col1 { 
  return $+(,$1-) 
} 

alias col2 { 
  return $+(,$1-) 
} 

alias col3 { 
  return $+(,$1-) 
} 

alias Chanclone { 
  if (($1) && ($me !ison $1)) { echo -a $col1(You are not on $+($1,.)) } 
  else { 
    if (!$1) { set %achanclones.chan $active } 
    else { set %achanclones.chan $1 } 
    set %achanclones.users $nick(%achanclones.chan,0) 
    set %achanclones.user 1 
    set $+(%,achanclones.clones,.,%achanclones.chan) 0 
    while (%achanclones.user <= %achanclones.users) { 
      set %achanclones.nick 1    
      while (%achanclones.nick <= %achanclones.users) { 
        if ($address($nick(%achanclones.chan,%achanclones.user),2) iswm $address($nick(%achanclones.chan,%achanclones.nick),2)) { 
          if (($nick(%achanclones.chan,%achanclones.user) == $nick(%achanclones.chan,%achanclones.nick)) || ($eval($+(%,achanclones.cloned,.,$nick(%achanclones.chan,%achanclones.nick)),2) == on) || ($eval($+(%,achanclones.cloned,.,$nick(%achanclones.chan,%achanclones.user)),2) == on)) { noop } 
          ;This line checks if the nick being searched has previously been cloned. 
          else { 
            echo -a $col2($nick(%achanclones.chan,%achanclones.nick) is a clone of $+($nick(%achanclones.chan,%achanclones.user),.)) 
            inc $+(%,achanclones.clones,.,%achanclones.chan) 
            set $+(%,achanclones.cloned,.,$nick(%achanclones.chan,%achanclones.nick)) on 
            ;This "knocks out" the nick that is found to be cloned, so it will not be evaluated later. 
          } 
        } 
        inc %achanclones.nick 
      } 
      inc %achanclones.user 
      unset %achanclones.nick 
    } 
    echo -a $col3($+(%achanclones.chan) has $eval($+(%,achanclones.clones,.,%achanclones.chan),2) clone(s).) 
    unset %achanclones.* 
  } 
} 

alias clone { 
  if (!$1) { echo -a $col1(Please specify a nick.) } 
  else { 
    set %aclone.nick 1 
    set %aclone.users $nick($chan,0) 
    set %aclone.clones 0 
    while (%aclone.nick <= %aclone.users) { 
      if ($address($1,2) iswm $address($nick($chan,%aclone.nick),2)) { 
        if ($1 == $nick($chan,%aclone.nick)) { noop } 
        else { 
          echo -a $col2($nick($chan,%aclone.nick) is a clone of $+($1,.)) 
          inc %aclone.clones 
        } 
      } 
      inc %aclone.nick 
    } 
    echo -a $col3($1 has %aclone.clones clone(s).) 
    unset %aclone.* 
  } 
} 
on *:load:{ 
  if ($version < 5.91) echo -a $+ $colour(info2) $+ *** This addon will not work properly with mIRC $version $+ , you need latest mirc in order to use this addon. | beep 
  echo -a  X-Files Secure Query Loaded Succesfully | echo -a  Please Type : /secure.query  In Channel To Begin Dialog. 
} 
;[read write data/setting.ini] 
alias _vr { 
  if ($exists(data\setting.ini) == $false) { mkdir data | write -c data\setting.ini } 
  return $readini data\setting.ini $$1 $$2 
} 
alias _vw { 
  if ($exists(data\setting.ini) == $false) { mkdir data | write -c data\setting.ini } 
  writeini data\setting.ini $$1 $$2 $$3- 
} 
alias _vrem { 
  if ($exists(data\setting.ini) == $false) { mkdir data | write -c data\setting.ini } 
  remini data\setting.ini $$1 $$2 
} 
menu query, { 
  .- 
  Secure Query 
  .Change :secure.query 
  .Add User:.auser -a securequery $address($1,3) | .msg $1 [Automated Msg] You Have Free Access To Message Me. | $ae •• User Added » ( $address($1,3) ) | if ($dialog(querycon) != $null) { did -r querycon 45 | s.levels } 
  .On  $sqo: _vw querycon switch on 
  .Off $sqf: _vw querycon switch off 
} 
menu status,channel { 
  .- 
  Secure Query 
  .Change :secure.query 
  .On $sqo: _vw querycon switch on 
  .Off $sqf: _vw querycon switch off 
} 
alias -l sqo { 
  if ($_vr(querycon,switch) == on) { return [x] } 
  else { return  } 
} 
alias -l sqf { 
  if ($_vr(querycon,switch) == off) { return [x] } 
  else { return } 
} 
alias secure.query { 
  if ($version < 5.91) { echo -a This addon will not work properly with mIRC $version $+ , please upgrade to latest mIRC www.mirc.com | beep | halt } 
  if ($dialog(querycon) == $null) { dialog -m querycon querycon } 
} 
alias secure.query.nick { 
  if ($version < 5.91) { echo -a This addon will not work properly with mIRC $version $+ , please upgrade to latest mIRC www.mirc.com | beep | halt } 
  dialog -m $_vr(querycon,query.nick) querycon1 
  _vrem querycon lastmsg 
} 
dialog querycon1 { 
  title "Secure Query " 
  size -1 -1 220 94 
  option dbu 
  box "", 33, 7 14 210 42 
  button "Accept", 28, 33 67 25 10, default ok 
  button "Ignore", 26, 61 67 25 10 
  button "Decline", 27, 89 67 25 10 
  edit "", 1, 32 20 181 11, read autohs 
  edit "", 30, 32 31 181 10, read autohs 
  edit "", 29, 32 41 181 10, read autohs 
  check "Enable Secure Query", 31, 10 6 70 7 
  button "Setup", 2, 119 67 21 10 
  button "Add Access", 3, 146 67 37 10 
  box "", 4, 31 61 160 18 
  text "Nick ", 5, 9 20 17 10 
  text "Address", 6, 9 31 22 9 
  text "Message", 7, 9 42 24 10 
} 
dialog querycon { 
  title "Secure Query By X-Files" 
  size -1 -1 185 128 
  option dbu 
  button "Ok", 12, 75 108 25 10, default ok 
  tab "Config", 2, 2 2 179 120 
  edit "", 3, 4 44 159 10, tab 2 autohs 
  text "Standby Message", 13, 4 34 49 9, tab 2 
  edit "", 4, 4 64 159 10, tab 2 autohs 
  check "On ", 15, 11 85 32 10, tab 2 
  button "Choose The Sound ", 16, 31 85 53 11, tab 2 
  box "Audible Alert On Query Request", 17, 8 76 85 25, tab 2 
  edit "", 208, 109 84 15 9, tab 2 
  button "-", 206, 100 86 6 5, tab 2 
  text "Seconds ", 210, 135 84 25 8, tab 2 center 
  box "Auto-Close Dialog", 209, 95 76 70 31, tab 2 
  button "+", 207, 126 85 6 6, tab 2 
  text "Decline Message", 14, 1 55 51 9, tab 2 center 
  check "On ", 33, 12 21 66 10, tab 2 
  check "Notify User Has Access", 49, 92 21 66 10, tab 2 
  check "Enable Auto-Close", 50, 100 94 58 10, tab 2 
  box "", 51, 7 16 154 18, tab 2 
  tab "Log", 11 
  list 34, 7 21 42 50, tab 11 sort size hsbar 
  button "Erase", 35, 7 74 29 8, tab 11 
  button "Copy ", 39, 131 73 29 8, tab 11 
  check "Log", 43, 7 96 58 10, tab 11 
  edit "", 52, 86 85 74 10, tab 11 autohs 
  button "Add User", 53, 48 86 37 8, tab 11 
  edit "", 64, 54 22 106 50, tab 11 read multi vsbar 
  button "Erase All", 65, 7 84 29 8, tab 11 
  tab "Protection", 32 
  radio "Universal mask *!*@*", 211, 15 43 62 12, tab 32 
  radio "Host Mask Ignore", 212, 15 57 62 9, tab 32 
  box "Flood Private Kind ", 213, 11 35 70 34, tab 32 
  edit "", 214, 87 55 10 10, tab 32 
  check "On ", 219, 89 43 40 10, tab 32 
  box "Private Flood Kind ", 216, 85 35 77 34, tab 32 
  edit "", 217, 125 55 15 10, tab 32 
  text "Queries In", 215, 98 57 27 7, tab 32 center 
  text "Secs", 218, 141 56 18 8, tab 32 
  tab "Access", 40 
  list 41, 11 43 146 50, tab 40 sort size hsbar 
  button "Erase ", 42, 12 97 37 8, disable tab 40 
  text "User access", 44, 12 35 29 8, tab 40 
  edit "", 45, 30 20 106 10, tab 40 autohs 
  button "Add", 46, 139 21 30 8, disable tab 40 
  text " Address", 47, 7 21 23 8, tab 40 
  tab "About", 54 
  box "", 55, 16 24 151 78, tab 54 
  text "Author :", 56, 61 31 22 10, tab 54 center 
  link "www.geocities.com/script_xfiles", 59, 57 84 80 8, tab 54 
  text "X-Files", 60, 85 31 26 11, tab 54 center 
  text "Location:", 1, 60 47 27 10, tab 54 center 
  text "Lebanon", 5, 84 47 32 12, tab 54 center 
  text "Email :", 6, 58 62 25 8, tab 54 center 
  text "mill2y@hotmail.com", 7, 81 62 63 11, tab 54 center 
} 
on *:dialog:*:init:*:{ 
  if ($dialog(querycon) == $dname) { 
    if ($_vr(querycon,switch) == on) { did -c querycon 33 } 
    elseif ($_vr(querycon,switch) == $null) { _vw querycon switch on | did -c querycon 33 } 
    if ($_vr(querycon,ignore.host) == $null) { _vw querycon ignore.host on | _vw querycon ignore.uni off } 
    if ($_vr(querycon,decline) == $null) { _vw querycon decline Sorry, I have declined your query, please try a more convient time. } 
    if ($_vr(querycon,ignore.uni) == on) && ($_vr(querycon,ignore.host) == off) { did -c querycon 211 1 } 
    else  did -c querycon 212 1 
    did -o querycon 3 1 $_vr(querycon,standby) 
    did -o querycon 4 1 $_vr(querycon,decline) 
    if ($_vr(querycon,soundswitch) == on) { did -c querycon 15 } 
    if ($_vr(querycon,timer) == $null) { _vw querycon timer 240 } 
    did -o querycon 208 1 $_vr(querycon,timer) 
    if ($_vr(querycon,max.query) == $null) { _vw querycon max.query 5 | did -o querycon 214 1 $_vr(querycon,max.query) } 
    else  did -o querycon 214 1 $_vr(querycon,max.query) 
    if ($_vr(querycon,max.query.sec) == $null) {  _vw querycon max.query.sec 20 | did -o querycon 217 1 $_vr(querycon,max.query.sec) } 
    else did -o querycon 217 1 $_vr(querycon,max.query.sec) 
    if ($_vr(querycon,netflood) == on) did -c querycon 219 
    else did -b querycon 211,217,212,214 
    if ($_vr(querycon,log) == on) { did -c querycon 43 } 
    elseif ($_vr(querycon,log) == $null) { _vw querycon log on | did -c querycon 43 } 
    if ($_vr(querycon,notifyaccess) == on) { did -c querycon 49 } 
    elseif ($_vr(querycon,notifyaccess) == $null) { _vw querycon notifyaccess on | did -c querycon 49 } 
    if ($_vr(querycon,auto-close) == on) { did -c querycon 50 } 
    did -b querycon 46,42 
    nick.list 
    s.levels 
    did -z querycon 34 
  } 
  if ($dialog($dname) == $_vr(querycon,query.nick)) { 
    if ($_vr(querycon,auto-close) == on) { %qs.nick = $_vr(querycon,query.nick) | .timer 1 $sq_t close.qw } 
  } 
} 
on *:dialog:querycon:edit:*:{ 
  if ($did == 3) { 
    if ($did(querycon,3).text != $null) {    
      _vw querycon standby $did(querycon,3).text 
    } 
  } 
  if ($did == 4) { 
    if ($did(querycon,4).text != $null) {    
      _vw querycon decline $did(querycon,4).text 
    } 
  } 
  if ($did == 45) { 
    if ($did(querycon,45).text != $null) { did -e querycon 46 } 
    elseif ($did(querycon,45).text == $null) { did -b querycon 46 } 
  } 
  if ($did == 208) { 
    if ($did(querycon,208).text != $null) {    
      _vw querycon timer $did(querycon,208).text 
    } 
  } 
  if ($did == 214) { 
    if ($did(querycon,214).text != $null) {  
      _vw querycon max.query $did(querycon,214).text 
    }  
  } 
  if ($did == 217) { 
    if ($did(querycon,217).text != $null) {  
      _vw querycon max.query.sec $did(querycon,217).text 
    } 
  } 
} 

on *:dialog:*:sclick:*:{ 
  if (Query request $dname == $dialog($dname).title) { 
    if ($did == 2) { secure.query }    
    if ($did == 3) { 
      auser -a securequery $did(30,$did(30)) $did(1,$did(1)) | did -b $did(1,$did(1)) 3 
      if ($_vr(querycon,notifyaccess) == on) { .msg $did(1,$did(1)) [automated msg] You have free access to message me. } 
    }    
    if ($did == 27) { .ignore -pu180 $did(30,$did(30)) | .msg $did(1,$did(1)) [automated msg] $_vr(querycon,decline) |  dialog -x $did(1,$did(1)) } 
    if ($did == 28) {  
      .ignore -r $did(30,$did(30)) | query $did(1,$did(1)) | .timer -m 1 1 echo $did(1,$did(1)) < $+ $did(1,$did(1)) $+ > $did(29,$did(29)) |  _vrem querycon lastmsg 
      .msg  $did(1,$did(1)) [automated msg] Query request accepted. 
      dialog -x $did(1,$did(1)) 
    } 
    if ($did == 26) { .ignore -p $did(30,$did(30)) | dialog -x $did(1,$did(1)) } 
    if ($did == 31) { 
      if ($_vr(querycon,switch) != on) { _vw querycon switch on } 
      else { _vw querycon switch off  } 
    } 
  } 
  if ($dialog(querycon) ==  $dname) { 
    if ($did == 15) { 
      if ($_vr(querycon,soundswitch) != on) {  _vw querycon soundswitch on | did -c querycon 15 } 
      else { _vw querycon soundswitch off | did -u querycon 15 } 
    } 
    if ($did == 16) { setquerysound } 
    if ($did == 206) { if (%timer > 0) { dec %timer 1 | did -o querycon 208 1 %timer | _vw querycon timer %timer } } 
    if ($did == 207) { inc %timer 1 | did -o querycon 208 1 %timer | _vw querycon timer %timer } 

    if ($did == 39) { clipboard < $+ $did(34,$did(34).sel) $+ > $sr($did(34,$did(34).sel),msg) } 
    if ($did == 34) { did -r querycon 64 | did -a querycon 64 $chr(91) $+ $sr($did(34,$did(34).sel),date) $+ $chr(93) | did -a querycon 64 $crlf $sr($did(34,$did(34).sel),msg) | did -o querycon 52 1 $_vr(securequery,$did(34,$did(34).sel))) } 
    if ($did == 33) { 
      if ($_vr(querycon,switch) != on) { _vw querycon switch on } 
      else { _vw querycon switch off } 
    } 
    if ($did == 35) { write -ds $+ $did(34,$did(34).sel) securequery\names.txt | _vrem securequery $did(34,$did(34).sel)) | .timer -m 1 1 nick.list } 
    if ($did == 41) { did -e querycon 42,46 | did -o querycon 45 1 $did(41,$did(41).sel)) } 
    if ($did == 42) { ruser $did(41,$did(41).sel) | s.levels } 
    if ($did == 43) { 
      if ($_vr(querycon,log) != on) { _vw querycon log on | did -c querycon 43 } 
      else { _vw querycon log off } 
    }  
    if ($did == 50) { 
      if ($_vr(querycon,auto-close) != on) { _vw querycon auto-close on | did -c querycon 50 } 
      else { _vw querycon auto-close off } 
    } 
    if ($did == 53) { 
      if ($did(querycon,52).text != $null) {    
        .auser -a  securequery $did(querycon,52).text | did -r querycon 52 
      } 
    } 
    if ($did == 49) { 
      if ($_vr(querycon,notifyaccess) != on) { _vw querycon notifyaccess on | did -c querycon 49 } 
      else { _vw querycon notifyaccess off } 
    } 
    if ($did == 46) { 
      if ($did(querycon,45).text != $null) {    
        .auser -a  securequery $did(querycon,45).text | did -r querycon 45 | s.levels 
      } 
    } 
    if ($did == 65) { .remove securequery\names.txt | .remove securequery\logs.ini | did -r querycon 64,34,52 }    
    if ($did == 211) { 
      if ($_vr(querycon,ignore.uni) == off) { _vw querycon ignore.uni on | _vw querycon ignore.host off | did -c querycon 211 | did -u querycon 212 } 
      else { _vw querycon ignore.uni off | _vw querycon ignore.host on | did -u querycon 211 | did -c querycon 212 } 
    } 
    if ($did == 212) { 
      if ($_vr(querycon,ignore.host) == off) { _vw querycon ignore.host on | _vw querycon ignore.uni off | did -c querycon 212 | did -u querycon 211 } 
      else { _vw querycon ignore.host off | _vw querycon ignore.uni on | did -u querycon 212 | did -c querycon 211 } 
    } 
    if ($did == 219) { 
      if ($_vr(querycon,netflood) == off) { _vw querycon netflood on | did -c querycon 219 | did -e querycon 211,217,212,214 } 
      else { _vw querycon netflood off | did -u querycon 219 | did -b querycon 211,217,212,214 } 
    } 
  } 
} 
alias -l sr { 
  if ($exists(securequery\logs.ini) == $false) { mkdir securequery | write -c securequery\logs.ini } 
  return $readini securequery\logs.ini $$1 $$2 
} 
alias -l sw { 
  if ($exists(securequery\logs.ini) == $false) { mkdir securequery | write -c securequery\logs.ini } 
  writeini securequery\logs.ini $$1 $$2 $$3- 
} 
alias -l srem { 
  if ($exists(securequery\logs.ini) == $false) { mkdir securequery | write -c  securequery\logs.ini } 
  remini securequery\logs.ini $$1 $$2 
} 
on ^*:open:?: { 
  if ($_vr(querycon,switch) == $null) { _vw querycon switch on } 
  if ($finddir($mircdir\,securequery*,1) == $null) { mkdir securequery } 
  if ($_vr(querycon,netflood) != on) { 
    inc %upflood15 1  
    if (%upflood15 > $_vr(querycon,max.query)) { 
      if ($_vr(querycon,ignore.uni) == on) { .ignore -pu $+ $_vr(querycon,max.query.sec) *!*@* } 
      else { .ignore -pu $+ $_vr(querycon,max.query.sec) $wildsite } 
      echo -a [ ALERT ] $nick is Query Flooding. User ( $+ $wildsite $+ ) now ignored for $_vr(querycon,max.query.sec) secs. 
    } 
    .timer 1 60 unset %upflood15      
  } 
  if ($_vr(querycon,standby) == $null) { _vw querycon standby Please standby for acknowledgement. I am using a secure query event. You will be notified if accepted. Until then your msgs will be ignored. } 
  if ($level($address($nick,3)) == securequery) { goto end } 
  if ($_vr(querycon,switch) == on) { 
    if ($_vr(querycon,soundswitch) == on) { if ($_vr(querycon,sound) != $null) { splay $_vr(querycon,sound) } } 
    echo -a $+ $colour(notice) $+ Query with $nick ( $+ $wildsite  $+ ) 
    echo -a $+ $colour(notice) $+ Waiting for acknowledgement... 
    if ($_vr(querycon,log) == on) { 
      if ($read(securequery\names.txt, s, $nick) == $nick) { write -ds $+ $nick securequery\names.txt } 
      sw $nick date $asctime(h:nn:sstt m/d) | sw $nick msg $strip($1-,burc) | write securequery/names.txt $nick | _vw securequery $nick $wildsite | nick.list 
    } 
    .ignore -pu180 $wildsite  
    .msg $nick [automated msg] $_vr(querycon,standby) 
    _vw  querycon query.nick $nick 
    if ($dialog($nick) == $null) { secure.query.nick } 
    dialog -t $_vr(querycon,query.nick) Query request $nick 
    did -o $nick 1 1 $_vr(querycon,query.nick) 
    did -o $nick 30 1 $wildsite 
    did -o $nick 29 1 $strip($1-,burc) 
    if ($_vr(querycon,switch) == on) { did -c $nick 31 } 
    haltdef 
    :end 
  }  
} 
alias -l secure.dir { 
  mkdir  " $+ $mircdirsecurequery $+ \ $+ " 
  return securequery $+ \ 
} 
alias -l sq_t { 
  return $_vr(querycon,timer) 
} 

alias -l nick.list { 
  if ($dialog(querycon) != $null) { 
    did -r querycon 64,34,52 
    var %fst = $lines(securequery\names.txt)    
    var %f = 1 
    while (%f <= %fst) { did -a querycon 34 $read(securequery\names.txt,%f) | inc %f 1 } 
  } 
} 
alias -l s.levels { 
  did -r querycon 41 
  var %s.l = $ulist(*,securequery,0) 
  if (%s.l == 0) { did -b querycon 42 | return } 
  else  did -e querycon 42 
  var %s.w = 0 
  :loop 
  inc %s.w 
  if (%s.w <= %s.l) { did -a querycon 41  $ulist(*,securequery,%s.w) | goto loop } 
  else return 
} 
alias -l close.qw { if ($dialog(%qs.nick) != $null) dialog -x %qs.nick } 
alias -l setquerysound { 
  _vw querycon sound $$dir="Choose a wav:" $mircdir*.wav;*mp3;*.mid 
} 
on $*:TEXT:/^[!@]stats .{1,12}$/Si:*:{
  set %_lookupmsgcol 3
  inc %_lookups 1
  set $+(%,lookup.,%_lookups) $replace($2-,$chr(32),+) $iif($chan,$iif($left($1,1) == @,msg $chan,notice $nick),msg $nick)
  sockopen $+(lookup.,%_lookups) www.rscript.org 80
}
on *:SOCKOPEN:lookup.*:{
  sockwrite -nt $sockname GET /lookup.php?type=stats&user= $+ $gettok($($+(%,lookup.,%_lookups),2),1,32) HTTP/1.0 
  sockwrite -nt $sockname User-Agent: RuneScript Public (Crawler Bot; rscript.org;)
  sockwrite -nt $sockname Host: rscript.org $+ $crlf $+ $crlf 
}
on *:SOCKREAD:lookup.*:{
  var %id = $right($sockname,-7)
  var %username = $gettok($($+(%,lookup.,%id),2),1,32)
  var %target = $gettok($($+(%,lookup.,%id),2),2-,32)
  if ($sockerr) { %target Socket error: $sockerr (BUILD ID: %id $+ ) }
  else {
    var %read | sockread %read
    tokenize 32 $remove(%read,Stat:)
    if ($0 == 4) { set $+(%,lookupmsg.,%id) $($+(%,lookupmsg.,%id),2) $chr(124) $+($1,:) $_col($3) }
    elseif (Not Ranked isin $1-) { return }
    elseif ($($+(%,lookupmsg.,%id),2)) { %target Stats for $replace($_col(%username),+,$chr(32)) $+ : $right($($+(%,lookupmsg.,%id),2),-2) | sockclose $sockname | unset %lookup* }
  }
}
alias _col { return $+($chr(3),$iif(%_lookupmsgcol isnum 0-15,$iif($len(%_lookupmsgcol) == 2,%_lookupmsgcol,$+(0,%_lookupmsgcol)),07),$1-,$chr(3)) }
on *:TEXT:!google *:*: { 

  ;COLOR SETTING: 
  set %col 09 

  inc %ID 1 
  set $+(%,search.,%ID) $replace($2-,$chr(32),+) $iif($chan,$iif($left($1,1) == !,notice $nick,msg $chan),msg $nick) 
  sockopen $+(google.,%ID) www.google.com 80 
} 
on *:SOCKOPEN:google.*: { 
  sockwrite -nt $sockname GET /search?hl=en&q= $+ $gettok($($+(%,search.,%ID),2),1,32) $+ &btnI HTTP/1.1 
  sockwrite -nt $sockname Host: www.google.com 
  sockwrite -t $sockname $str($crlf,2) 
} 
on *:SOCKREAD:google.*: { 
  var %IDt = $right($sockname,-7) 
  var %target = $gettok($($+(%,search.,%IDt),2),2-,32) 
  if ($sockerr) { 
    %target $chr(91) $col(ERROR) $chr(93) Socket error 
    unset %search. $+ $right($sockname,-7) 
    sockclose $sockname 
  } 
  else { 
    var %read | sockread %read 
    if (Location:* iswm %read) { 
      %target $chr(91) $col(GOOGLE) $chr(93) $remove($htmlfree(%read),Location:) 
      unset %search. $+ $right($sockname,-7) 
      sockclose $sockname 
    } 
    if (*did not match any documents* iswm %read) { 
      %target $chr(91) $col(GOOGLE) $chr(93) No results found 
      unset %search. $+ $right($sockname,-7) 
      sockclose $sockname 
    } 
  } 
  /close -m $nick 
} 
alias -l col { return $+($chr(3),$iif($len(%col) == 2,%col,$+(0,%col)), $1-, $chr(3)) } 
alias -l htmlfree { 
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;) 
  return %x 
}
on *:TEXT:*:#: { 
  var %hats = White.Blue.Red.Green.Yellow.Purple 
  if ($1 == !cracker) && ($2 ison $chan) { 
    notice $nick You pull the cracker with $2 $+ . 
    notice $2 You pull the cracker with $nick $+ . 
    if ($rand(1,16) <= 6) { 
      var %phat = $gettok(%hats,$v1,46) 
      notice $nick You got a %phat Party hat! 
      writeini -n phat.ini $nick total $calc($readini(phat.ini,n,$nick,total) +1) 
      writeini -n phat.ini $nick %phat $calc($readini(phat.ini,n,$nick,%phat) +1) 
    } 
    else notice $nick sorry $nick , but you dint get any thing.  
  } 
  elseif ($1 == !phat) { 
    notice $nick You have $iif($readini(phat.ini,n,$nick,total),$ifmatch,0) total party hats. 
    if ($istok(%hats,$2,46)) notice $nick You have $iif($readini(phat.ini,n,$nick,$2),$ifmatch,0) $2 party hats. 
  }
  elseif ($1 == @phat) { 
    msg $chan $nick has $iif($readini(phat.ini,n,$nick,total),$ifmatch,0) total party hats. 
    if ($istok(%hats,$2,46)) msg $chan You have $iif($readini(phat.ini,n,$nick,$2),$ifmatch,0) $2 party hats.  
  }
}
on *:PART:*:#:{ inc %part | notice $nick Cya $nick I have seen %part parts! :( veiw my forms :  http://z11.invisionfree.com/pur3magic69/index.php?act=idx }

alias -l htmlfree {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;)
return %x } 
on *:load: { 
  echo -a 0,1---=) 4Loaded 11{15IRC-Uno11} 9by 11{15mill2y@hotmail.com11} 0(=--- 
  if (!$exists(" $+ $scriptdir $+ Uno.txt $+ ")) { 
    echo -a 0,1" $+ $scriptdir $+ Uno.txt $+ " not found, creating now. 
    write -l1 " $+ $scriptdir $+ Uno.txt $+ " !PlayerList! 
    write -l2 " $+ $scriptdir $+ Uno.txt $+ " !Options!.1.0.1.0.0.0.1.0.0 
    write -l3 " $+ $scriptdir $+ Uno.txt $+ " !Channels!,#Uno 
    write -l4 " $+ $scriptdir $+ Uno.txt $+ " 0 
    if (!$exists(" $+ $scriptdir $+ Uno.txt $+ ")) { 
      echo -a 0,1" $+ $scriptdir $+ Uno.txt $+ " was not sucessfully created, please make sure $scriptdir is not write-protected and reload Uno.mrc. 
      halt 
    } 
    else { 
      echo -a 0,1" $+ $scriptdir $+ Uno.txt $+ " was sucessfully created. 
    } 
  } 
  echo -a 0,1Right click in any Channel or type 4/UnoOptions0 for options. 
  unoreset 
} 
;---------------------------------------------------------------------- 
on *:text:!deal:%iuno.c2: { 
  if ($network == %iuno.np) { 
    if (%iuno.dl != 1) { 
      if ($nick == %iuno.fp) { 
        if ($numtok(%iuno.u,46) >= 2) { 
          var %iuno.s 1 
          while (%iuno.s <= 7) { 
            var %iuno.v 2 
            while (%iuno.v <= $numtok(%iuno.u,46)) { 
              set %iuno.h. $+ $gettok(%iuno.u,%iuno.v,46) $instok(%iuno.h. [ $+ [ $gettok(%iuno.u,%iuno.v,46) ] ] ,$gettok(%iuno.d,1,46),-0,46) 
              set %iuno.d $deltok(%iuno.d,1,46) 
              inc %iuno.v 
            } 
            set %iuno.h. $+ %iuno.fp $instok(%iuno.h. [ $+ [ %iuno.fp ] ] ,$gettok(%iuno.d,1,46),-0,46) 
            set %iuno.d $deltok(%iuno.d,1,46) 
            inc %iuno.s 
          } 
          set %iuno.dl 1 
          while ($pos($gettok(%iuno.d,1,46),w,0)) { 
            set %iuno.d $instok(%iuno.d,$gettok(%iuno.d,1,46),$rand(1,$numtok(%iuno.d,46)),46) 
            set %iuno.d $deltok(%iuno.d,1,46) 
          } 
          set %iuno.dp $instok(%iuno.dp,$gettok(%iuno.d,1,46),1,46) 
          set %iuno.d $deltok(%iuno.d,1,46) 
          set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,1,46),-0,46) 
          set %iuno.u $deltok(%iuno.u,1,46) 
          if ($pos($gettok(%iuno.dp,1,46),S,1)) { 
            skip $network $gettok(%iuno.u,1,46) 
          } 
          elseif ($pos($gettok(%iuno.dp,1,46),D2,1)) { 
            drawtwo $network $gettok(%iuno.u,1,46) 
          } 
          elseif ($pos($gettok(%iuno.dp,1,46),R,1)) { 
            reverse $network $nick 
          } 
          else { 
            showtopcard $network $chan 
            unomsg $network $chan $gettok(%iuno.u,1,46) $+ 's turn. 
            unocards $network $gettok(%iuno.u,1,46) 
          } 
        } 
        else { 
          unomsg $network $chan Sorry but you need 2 people to play. 
        } 
      } 
      else { 
        unomsg $network $chan Sorry but %iuno.fp needs to deal. 
      } 
    } 
    else { 
      unomsg $network $chan Uno has already been delt. 
    } 
  } 
} 
;---------------------------------------------------------------------- 
on @*:text:join:%iuno.c2: { 
  if ($network == %iuno.np) { 
    if ($numtok(%iuno.u,46) < 10) { 
      .mode $chan +v $nick 
      if (%iuno.dl != 1) { 
        set %iuno.u $addtok(%iuno.u,$nick,46) 
        unomsg $network $chan $nick is Uno player $chr(35) $+ $findtok(%iuno.u,$nick,1,46) 
        unomsg3 $network %iuno.fp There are now $numtok(%iuno.u,46) players for Uno, type !deal in %iuno.c2 to start the game. 
      } 
      else { 
        set %iuno.u $addtok(%iuno.u,$nick,46) 
        unomsg $network $chan Dealing $nick into current Uno game. 
        var %iuno.jt 1 
        while (%iuno.jt <= 7) { 
          if (!$numtok(%iuno.d,46)) { 
            set %iuno.ud %iuno.dp 
            unset %iuno.dp 
            set %iuno.dp $gettok(%iuno.ud,1,46) 
            set %iuno.ud $deltok(%iuno.ud,1,46) 
            unomsg $network $chan Shuffling discard pile 
            newunodeck x 
          } 
          set %iuno.h. $+ $nick $instok( %iuno.h. [ $+ [ $nick ] ] ,$gettok(%iuno.d,1,46),-0,46) 
          set %iuno.d $deltok(%iuno.d,1,46) 
          inc %iuno.jt 
        } 
        unocards $network $nick 
      } 
    } 
    else { 
      unomsg $network $chan Sorry $nick but 10 users are already playing. 
    } 
  } 
} 
;---------------------------------------------------------------------- 
on *:text:!unostop:%iuno.c2: { 
  if ($network == %iuno.np) { 
    if ($nick == %iuno.fp || $nick isop %iuno.c2) { 
      unomsg $network $chan $nick has stopped IRC-Uno: Type !Uno to begin anew. 
      unoreset 
    } 
    else { 
      unomsg $network $chan Only %iuno.fp may stop the current game, type !quit to leave the game. 
    } 
  } 
} 
;---------------------------------------------------------------------- 
on *:text:!uno:%iuno.c: { 
  if ($chanvalid($chan,$network))  { 
    set %iuno.color $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),2,46) 
    set %iuno.rank $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),3,46) 
    set %iuno.draw $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),4,46) 
    set %iuno.comm $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),5,46) 
    set %iuno.c $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",3),2-,44) 
    unocolors 
    if (!%iuno.fp) { 
      set %iuno.fp $nick 
      set %iuno.c2 $chan 
      set %iuno.np $network 
      set %iuno.abv m.b.g.m.y.s.d2.d2.r.0.1.2.3.4.5.6.7.8.9 
      set %iuno.words r.Blue.Green.Red.Yellow.Skip.Draw2.DrawTwo.Reverse.Zero.One.Two.Three.Four.Five.Six.Seven.Eight.Nine 
      newunodeck 
      set %iuno.u $addtok(%iuno.u,$nick,46) 
      unomsg $network $chan IRC-Uno Started: Type join to join in. 
    } 
    else { 
      unomsg3 $network %iuno.fp An Uno game has already been started in %iuno.c2 $+ . 
    } 
    unset %iuno.t.u 
  } 
} 
;---------------------------------------------------------------------- 
on *:text:!play W*D* *:%iuno.c2: { 
  if ($network == %iuno.np) { 
    if (($2 == WD4) || ($2 == WildDrawFour) || ($2 == WildDraw4)) { 
      if (!$findtok(%iuno.abv,$3,46)) set %iuno.pv $gettok(%iuno.abv,$findtok(%iuno.words,$3,46),46) 
      elseif ($3 == r) set %iuno.pv m 
      else set %iuno.pv $3 
      if ($nick == $gettok(%iuno.u,1,46)) { 
        if ($pos(%iuno.h. [ $+ [ $nick ] ],zWD4,1)) { 
          if ((%iuno.udc != 1) || ((%iuno.udc == 1) && ($pos($gettok(%iuno.h. [ $+ [ $nick ] ],$numtok(%iuno.h. [ $+ [ $nick ] ],46),46),zWD4,1)))) { 
            if (%iuno.pv == b || %iuno.pv ==  g || %iuno.pv ==  m || %iuno.pv ==  y ) { 
              set %iuno.dp $instok(%iuno.dp,[ %iuno.pv ] $+ $chr(42),1,46) 
              set %iuno.h. [ $+ [ $nick ] ] $remtok(%iuno.h. [ $+ [ $nick ] ],zWD4,1,46) 
              if ($numtok(%iuno.h. [ $+ [ $nick ] ],46) == 1) unomsg $network $chan  $+ %iuno.cr $+ U $+ %iuno.cy $+ n $+ %iuno.cb $+ o $+ %iuno.cg $+ !  $+ %iuno.fc $+ $nick has one card left! 
              set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,1,46),-0,46) 
              set %iuno.u $deltok(%iuno.u,1,46) 
              if (%iuno.pv == b) set %iuno.pv Blue. 
              if (%iuno.pv == g) set %iuno.pv Green. 
              if (%iuno.pv == m) set %iuno.pv Red. 
              if (%iuno.pv == y) set %iuno.pv Yellow. 
              if (%iuno.udc) unset %iuno.udc 
              var %iuno.d4 1 
              while (%iuno.d4 <= 4) { 
                if (!$numtok(%iuno.d,46)) { 
                  set %iuno.ud %iuno.dp 
                  unset %iuno.dp 
                  set %iuno.dp $gettok(%iuno.ud,1,46) 
                  set %iuno.ud $deltok(%iuno.ud,1,46) 
                  unomsg $network $chan Shuffling discard pile 
                  newunodeck x 
                } 
                set [ %iuno.h. [ $+ [ $gettok(%iuno.u,1,46) ] ] ] $instok(%iuno.h. [ $+ [ $gettok(%iuno.u,1,46) ] ],$gettok(%iuno.d,1,46),-0,46) 
                set %iuno.d $deltok(%iuno.d,1,46) 
                inc %iuno.d4 
              } 
              unset %iuno.d4 
              unomsg $network $chan $gettok(%iuno.u,1,46) draws 4 cards and is skipped! 
              drawncards $network $gettok(%iuno.u,1,46) 4 
              set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,1,46),-0,46) 
              set %iuno.u $deltok(%iuno.u,1,46) 
              if (!$numtok(%iuno.h. [ $+ [ $nick ] ],46)) { 
                score $network $nick 
              } 
              else { 
                unomsg $network $chan $gettok(%iuno.u,1,46) $+ 's turn. 
                showtopcard $network $chan 
                unocards $network $gettok(%iuno.u,1,46) 
              } 
            } 
            else { 
              unomsg $network $chan Please specify a color $nick $+ . !play WD4 [b,g,r,y] 
            } 
          } 
          else { 
            unomsg $network $chan Sorry $nick but you must play the card you've drawn or !Pass. 
          } 
        } 
        else { 
          unomsg $network $chan You don't have that card $nick $+ . 
        } 
      } 
    } 
  } 
} 
;---------------------------------------------------------------------- 
on *:text:!play W*:%iuno.c2: { 
  if ($network == %iuno.np) { 
    if (!$findtok(%iuno.abv,$3,46)) set %iuno.pv $gettok(%iuno.abv,$findtok(%iuno.words,$3,46),46) 
    elseif ($3 == r) set %iuno.pv m 
    else set %iuno.pv $3 
    if ($nick == $gettok(%iuno.u,1,46)) { 
      if ($poscs(%iuno.h. [ $+ [ $nick ] ],ZW,1)) { 
        if ((%iuno.udc != 1) || ((%iuno.udc == 1) && ($poscs($gettok(%iuno.h. [ $+ [ $nick ] ],$numtok(%iuno.h. [ $+ [ $nick ] ],46),46),ZW,1)))) { 
          if (%iuno.pv == b || %iuno.pv == g || %iuno.pv == m || %iuno.pv == y ) { 
            set %iuno.dp $instok(%iuno.dp,[ %iuno.pv ] $+ $chr(42),1,46) 
            set %iuno.h. [ $+ [ $nick ] ] $remtok(%iuno.h. [ $+ [ $nick ] ],ZW,1,46) 
            if ($numtok(%iuno.h. [ $+ [ $nick ] ],46) == 1) unomsg $network $chan  $+ %iuno.cr $+ U $+ %iuno.cy $+ n $+ %iuno.cb $+ o $+ %iuno.cg $+ !  $+ %iuno.fc $+ $nick has one card left! 
            if (!$numtok(%iuno.h. [ $+ [ $nick ] ],46)) { 
              score $network $nick 
            } 
            else { 
              set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,1,46),-0,46) 
              set %iuno.u $deltok(%iuno.u,1,46) 
              if (%iuno.udc) unset %iuno.udc 
              if (%iuno.pv == b) set %iuno.pv Blue. 
              if (%iuno.pv == g) set %iuno.pv Green. 
              if (%iuno.pv == m) set %iuno.pv Red. 
              if (%iuno.pv == y) set %iuno.pv Yellow. 
              unomsg $network $chan $nick changed the color to %iuno.pv $gettok(%iuno.u,1,46) $+ 's turn. 
              showtopcard $network $chan 
              unocards $network $gettok(%iuno.u,1,46) 
            } 
          } 
          else { 
            unomsg $network $chan Please specify a color $nick $+ . !play W [b,g,r,y] 
          } 
        } 
        else { 
          unomsg $network $chan Sorry $nick but you must play the card you've drawn or !Pass. 
        } 
      } 
      else { 
        unomsg $network $chan You don't have that card $nick $+ . 
      } 
    } 
  } 
} 
;---------------------------------------------------------------------- 
on *:text:!play *:%iuno.c2: { 
  if ($network == %iuno.np) { 
    if (!$findtok(%iuno.abv,$2,46)) set %iuno.pv $gettok(%iuno.abv,$findtok(%iuno.words,$2,46),46) 
    elseif ($2 == r) set %iuno.pv m 
    else set %iuno.pv $2 
    if (!$findtok(%iuno.abv,$3,46)) set %iuno.px $gettok(%iuno.abv,$findtok(%iuno.words,$3,46),46) 
    else set %iuno.px $3 
    set %iuno.pvx %iuno.pv $+ %iuno.px 
    if ($nick == $gettok(%iuno.u,1,46)) { 
      if ($findtok(%iuno.h. [ $+ [ $nick ] ],%iuno.pvx,0,46)) { 
        if (($pos($gettok(%iuno.dp,1,46),[ %iuno.pv ],1)) || (($pos($gettok(%iuno.dp,1,46),[ %iuno.px ],1)) && ($iif($pos($gettok(%iuno.dp,1,46),D2,1),$iif($pos(%iuno.pvx,D2,1),$true,$false),$true)))) { 
          if ((%iuno.udc != 1) || ((%iuno.udc == 1) && ($pos($gettok(%iuno.h. [ $+ [ $nick ] ],$numtok(%iuno.h. [ $+ [ $nick ] ],46),46),%iuno.pvx,1)))) { 
            set %iuno.dp $instok(%iuno.dp,$upper(%iuno.pvx),1,46) 
            set %iuno.h. [ $+ [ $nick ] ] $remtok(%iuno.h. [ $+ [ $nick ] ],%iuno.pvx,1,46) 
            if ($numtok(%iuno.h. [ $+ [ $nick ] ],46) == 1) unomsg $network $chan  $+ %iuno.cr $+ U $+ %iuno.cy $+ n $+ %iuno.cb $+ o $+ %iuno.cg $+ !  $+ %iuno.fc $+ $nick has one card left! 
            set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,1,46),-0,46) 
            set %iuno.u $deltok(%iuno.u,1,46) 
            if ($numtok(%iuno.h. [ $+ [ $nick ] ],46)) { 
              if ($pos($gettok(%iuno.dp,1,46),S,1)) { 
                skip $network $gettok(%iuno.u,1,46) 
              } 
              elseif ($pos($gettok(%iuno.dp,1,46),D2,1)) { 
                drawtwo $network $gettok(%iuno.u,1,46) 
              } 
              elseif ($pos($gettok(%iuno.dp,1,46),R,1)) { 
                reverse $network $nick 
              } 
              else { 
                unomsg $network $chan $gettok(%iuno.u,1,46) $+ 's turn. 
                showtopcard $network $chan 
                unocards $network $gettok(%iuno.u,1,46) 
              } 
            } 
            else { 
              score $network $nick 
            } 
            if (!$numtok(%iuno.h. [ $+ [ $nick ] ],46)) { 
              score $network $nick 
            } 
            if (%iuno.udc) unset %iuno.udc 
          } 
          else { 
            unomsg $network $chan Sorry $nick but you must play the card you've drawn or !Pass. 
          } 
        } 
        else { 
          unomsg $network $chan Sorry but that card doesn't play $nick $+ . 
        } 
      } 
      else { 
        unomsg $network $chan You don't have that card $nick $+ . 
      } 
    } 
  } 
} 
;---------------------------------------------------------------------- 
on *:text:!draw:%iuno.c2: { 
  if ($network == %iuno.np) { 
    if ($nick == $gettok(%iuno.u,1,46)) { 
      if (%iuno.udc != 1) { 
        if (!$numtok(%iuno.d,46)) { 
          set %iuno.ud %iuno.dp 
          unset %iuno.dp 
          set %iuno.dp $gettok(%iuno.ud,1,46) 
          set %iuno.ud $deltok(%iuno.ud,1,46) 
          unomsg $network $chan Shuffling discard pile 
          newunodeck x 
        } 
        set %iuno.h. $+ $nick $instok( %iuno.h. [ $+ [ $nick ] ] ,$gettok(%iuno.d,1,46),-0,46) 
        set %iuno.d $deltok(%iuno.d,1,46) 
        if (%iuno.draw == 1) set %iuno.udc 1 
        drawncards $network $gettok(%iuno.u,1,46) 1 
        unomsg $network $chan $nick draws a card. 
      } 
      else { 
        unomsg $network $chan $nick you must play the card you drew or !Pass 
      } 
    } 
  } 
} 
;---------------------------------------------------------------------- 
on *:text:!TopCard:%iuno.c2: { 
  if ($network == %iuno.np) showtopcard $network $chan 
} 
;---------------------------------------------------------------------- 
on *:text:!pass:%iuno.c2: { 
  if ($network == %iuno.np) { 
    if ($nick == $gettok(%iuno.u,1,46)) { 
      if (%iuno.draw == 1) { 
        if (%iuno.udc == 1) { 
          set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,1,46),-0,46) 
          set %iuno.u $deltok(%iuno.u,1,46) 
          unomsg $network $chan $nick passes, $gettok(%iuno.u,1,46) $+ 's turn. 
          showtopcard $network $chan 
          unocards $network $gettok(%iuno.u,1,46) 
          unset %iuno.udc 
        } 
        else { 
          unomsg $network $chan $nick you must draw before you can pass. 
        } 
      } 
      else { 
        unomsg $network $chan $nick you must draw until you can play. 
      } 
    } 
  } 
} 
;---------------------------------------------------------------------- 
on *:text:!UnoTop10*:%iuno.c: { 
  if ($chanvalid($chan,$network))  { 
    if (%iuno.tt == 1) { 
      if ($2 == Points) filter -ffac " $+ $scriptdir $+ Uno.txt $+ " " $+ $scriptdir $+ UnoTop.txt $+ " unofilter2 */* 
      elseif ($2 == Games) filter -ffac " $+ $scriptdir $+ Uno.txt $+ " " $+ $scriptdir $+ UnoTop.txt $+ " unofilter3 */* 
      else filter -ffac " $+ $scriptdir $+ Uno.txt $+ " " $+ $scriptdir $+ UnoTop.txt $+ " unofilter */* 
      unomsg3 $network $nick  $+ %iuno.fc $+ , $+ %iuno.bc $+ Uno Top 10 for $iif($2 == Points,Total Points,$iif($2 == Games,Games Played,Average Points Per Game $chr(40) $+ Points/Games $+ $chr(41))) is: 
      set %iuno.ptv.n $network 
      write -il1 " $+ $scriptdir $+ UnoTop.txt $+ " [Top10] 
      write -il12 " $+ $scriptdir $+ UnoTop.txt $+ " [EndTop10] 
      play -aq5m1tTop10 unomsg3 $nick " $+ $scriptdir $+ UnoTop.txt $+ " 1000 
      write -dl1 " $+ $scriptdir $+ UnoTop.txt $+ " 
      write -dl12 " $+ $scriptdir $+ UnoTop.txt $+ " 
    } 
    else { 
      unomsg3 $network $nick Sorry but !UnoTop10 is disabled. 
    } 
  } 
} 
;---------------------------------------------------------------------- 
on *:text:!Rank:%iuno.c: { 
  if ($chanvalid($chan,$network))  { 
    if (%iuno.rank == 1) { 
      filter -ffac " $+ $scriptdir $+ Uno.txt $+ " " $+ $scriptdir $+ UnoTop.txt $+ " unofilter2 */* 
      if ($read(" $+ $scriptdir $+ UnoTop.txt $+ ", nw, $nick *)) { 
        set %iuno.r.t $read(" $+ $scriptdir $+ UnoTop.txt $+ ", nw, $nick *) 
        set %iuno.r.p $readn 
        filter -ffac " $+ $scriptdir $+ Uno.txt $+ " " $+ $scriptdir $+ UnoTop.txt $+ " unofilter3 */* 
        set %iuno.r.t $read(" $+ $scriptdir $+ UnoTop.txt $+ ", nw, $nick *) 
        set %iuno.r.g $readn 
        filter -ffac " $+ $scriptdir $+ Uno.txt $+ " " $+ $scriptdir $+ UnoTop.txt $+ " unofilter */* 
        set %iuno.r.t $read(" $+ $scriptdir $+ UnoTop.txt $+ ", nw, $nick *) 
        set %iuno.r.a $readn 
        unomsg3 $network $nick Your IRC Uno Rankings: %iuno.r.a / %iuno.r.p / %iuno.r.g 
        unomsg3 $network $nick (Points per Game / Total Points / Total Games) 
      } 
      else { 
        unomsg3 $network $nick Sorry but you are currently unranked, play Uno to get into the rankings! 
      } 
    } 
    else { 
      unomsg3 $network $nick Sorry but individual ranks are disabled. 
    } 
  } 
} 
;---------------------------------------------------------------------- 
on *:text:!score:%iuno.c: { 
  if ($chanvalid($chan,$network))  { 
    if (%iuno.sco == 1) { 
      if ($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$nick)) unomsg3 $network $nick You have $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$nick),1,47) total points and $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$nick),2,47) games played. 
      else unomsg3 $network $nick No score saved. 
    } 
    else { 
      unomsg3 $network $nick !Score has been disabled. 
    } 
  } 
} 
;---------------------------------------------------------------------- 
on *:text:!score *:%iuno.c: { 
  if ($chanvalid($chan,$network))  { 
    if (%iuno.scon == 1) { 
      if ($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$2)) unomsg3 $network $nick $2 has $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$2),1,47) total points and $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$2),2,47) games played. 
      else unomsg3 $network $nick No score saved for $2 
    } 
    else { 
      unomsg3 $network $nick !Score <Nick> has been disabled. 
    } 
  } 
} 
;---------------------------------------------------------------------- 
on *:text:!showcards:%iuno.c2: { 
  if ($network == %iuno.np) unocards $network $nick 
} 
;---------------------------------------------------------------------- 
on *:text:!quit:%iuno.c2: { 
  if (($findtok(%iuno.u,$nick,46)) && ($network == %iuno.np)) runoplayer $network $nick 
  .mode $chan -v $nick 
} 
;---------------------------------------------------------------------- 
on *:text:!players:%iuno.c2: { 
  if ($network == %iuno.np) { 
    unomsg3 $network $nick  $+ %iuno.fc $+ , $+ %iuno.bc $+ Current Uno Players are: 
    unomsg3 $network $nick  $+ %iuno.fc $+ , $+ %iuno.bc $+ $replace(%iuno.u,.,$chr(32)) 
  } 
} 
;---------------------------------------------------------------------- 
on *:text:!Commands:%iuno.c: { 
  if ($chanvalid($chan,$network))  { 
    set %iuno.cmnd !Uno, Join, !Deal, !Play <color> <card>, !Play [W/WD4] <color>, !Draw, !Pass, !UnoTop10, !Score, !Score <nick>, !TopCard, !ShowCards, !UnoStop, !Quit, !Players, !Rank, !Count 
    unomsg3 $network $nick  $+ %iuno.fc $+ , $+ %iuno.bc $+ Commands for IRC Uno are: %iuno.cmnd 
    unomsg3 $network $nick  $+ %iuno.fc $+ , $+ %iuno.bc $+ Type !Help <Command> for more information on a command. 
    unset %iuno.cmnd 
  } 
} 
;---------------------------------------------------------------------- 
on *:text:!Help*:%iuno.c: { 
  if ($chanvalid($chan,$network))  { 
    set %iuno.cmnd !Uno.Join.!Deal.!Play.!Draw.!Pass.!UnoTop10.!Score.!TopCard.!ShowCards.!UnoStop.!Quit.!Players.!Rank.!Count 
    if (!$findtok(%iuno.cmnd,$2,1,46)) { 
      unomsg3 $network $nick  $+ %iuno.fc $+ , $+ %iuno.bc $+ Sorry but I cannot find any help for that command. 
    } 
    else { 
      set %iuno.line $findtok(%iuno.cmnd,$2,1,46) + 1 
      unomsg3 $network $nick  $+ %iuno.fc $+ , $+ %iuno.bc $+ $Read(" $+ $scriptdir $+ Uno.mrc $+ ", %iuno.line) 
      unset %iuno.line 
    } 
    unset %iuno.cmnd 
  } 
} 
;---------------------------------------------------------------------- 
on *:text:!Count:%iuno.c2: { 
  set %iuno.cnt.tmp 1 
  set %iuno.cnt.rp Card Count: 
  while (%iuno.cnt.tmp <= $numtok(%iuno.u,46)) { 
    set %iuno.cnt.rp %iuno.cnt.rp $+ $chr(32) $+ $gettok(%iuno.u,%iuno.cnt.tmp,46) $numtok(%iuno.h. [ $+ [ $gettok(%iuno.u,%iuno.cnt.tmp,46) ] ],46) : 
    inc %iuno.cnt.tmp 
  } 
  unomsg3 $network $nick %iuno.cnt.rp 
  unset %iuno.cnt.* 
} 
;---------------------------------------------------------------------- 
on *:KICK:%iuno.c: { 
  if (($findtok(%iuno.u,$knick,46)) && ($network == %iuno.np)) runoplayer $network $knick 
} 
;---------------------------------------------------------------------- 
on *:NICK: { 
  if ($network == %iuno.np)  { 
    if ($findtok(%iuno.u,$nick,1,46)) { 
      set %iuno.u $reptok(%iuno.u,$nick,$newnick,1,46) 
      if ($nick == %iuno.fp) { 
        set %iuno.fp $newnick 
      } 
      set %iuno.h. [ $+ [ $newnick ] ] %iuno.h. [ $+ [ $nick ] ] 
      unset %iuno.h. [ $+ [ $nick ] ] 
    } 
  } 
} 
;---------------------------------------------------------------------- 
on *:PART:%iuno.c2: { 
  if (($findtok(%iuno.u,$nick,46)) && ($network == %iuno.np)) runoplayer $network $nick 
} 
;---------------------------------------------------------------------- 
on *:QUIT: { 
  if (($findtok(%iuno.u,$nick,46)) && ($network == %iuno.np)) runoplayer $network $nick 
} 
;---------------------------------------------------------------------- 
alias chanvalid { 
  if (%iuno.mn == 0) return $true 
  elseif ((%iuno.mn == 1) && ($findtok(%iuno.c. [ $+ [ $2 ] ],$1,1,46))) return $true 
  else return $false 
} 
;---------------------------------------------------------------------- 
alias score { 
  unomsg $1 %iuno.c2 We have a winner! Go $2 
  set %iuno.u $deltok(%iuno.u,$findtok(%iuno.u,$2,1,46),46) 
  var %iuno.sc 1 
  var %iuno.cs $numtok(%iuno.u,46) 
  while (%iuno.sc <= %iuno.cs) { 
    addplayerscoreb $gettok(%iuno.u,%iuno.sc,46) 
    inc %iuno.sc 
  } 
  addplayerscore $2 
  unomsg $1 %iuno.c2 $2 gains %iuno.t.u points. For a total of %iuno.t.k points, and a total of $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$2),2,47) games played. 
  unoreset 

} 
;---------------------------------------------------------------------- 
alias unocid { 
  if ($isid) { 
    var %e = return $+($chr(3),$color(info),$!unocid: Error -) 
    if ($version < 6.0) %e multi-server capability was only added in version 6.0 
    if (!$len($1)) %e you must specify a network, server, or wildcarded string as first parameter. 
    if (!$regex($ticks,$2,/^-?\d+-?(?:-\d+)?$/)) %e second param should either be a number or a range. 
    var %n = $iif($3 isnum 1-15,$3,1), %params = $1 $iif($3 !isnum,$3) 
    set -u %result 
    scon -at $+ %n unocid % $+ params 
    return $gettok(%result,$2,32) 
  } 
  if ($1 iswm $server) || ($istok($server $network,$1,32)) { 
    if ($2) && ($me !ison $2) return 
    set -u %result %result $cid 
  } 
} 
;---------------------------------------------------------------------- 
alias unomsg { 
  if ($unocid($1,1,$2)) { 
    scid $ifmatch 
    msg $2  $+ %iuno.fc $+ , $+ %iuno.bc $+ $3- 
    scid -r 
  } 
} 
;---------------------------------------------------------------------- 
alias unomsg2 { 
  if ($unocid($1,1,$2)) { 
    scid $ifmatch 
    msg $2  $+ %iuno.fc $+ , $+ %iuno.bc $+ $3- 
    scid -r 
  } 
} 
;---------------------------------------------------------------------- 
alias unomsg3 { 
  if ($play($1).status) { 
    set %iuno.um3n %iuno.ptv.n 
    set %iuno.um3c $1 
    set %iuno.um3m $2- 
  } 
  else { 
    set %iuno.um3n $1 
    set %iuno.um3c $2 
    set %iuno.um3m $3- 
  } 
  if ($unocid(%iuno.um3n,1,%iuno.c2)) { 
    scid $ifmatch 
    if (%iuno.comm == 0) notice %iuno.um3c  $+ %iuno.fc $+ , $+ %iuno.bc $+ $iif($play(%iuno.um3c).status,$chr(35) $+ $play(%iuno.um3c).pos $+ $chr(32)) $+ %iuno.um3m 
    if (%iuno.comm == 1) msg %iuno.um3c  $+ %iuno.fc $+ , $+ %iuno.bc $+ $iif($play(%iuno.um3c).status,$chr(35) $+ $play(%iuno.um3c).pos $+ $chr(32)) $+ %iuno.um3m 
    scid -r 
  } 
} 
;---------------------------------------------------------------------- 
alias runoplayer { 
  if ($2 == %iuno.fp) { 
    set %iuno.u $deltok(%iuno.u,$findtok(%iuno.u,$2,46),46) 
    if ($numtok(%iuno.u,46) <= 1) { 
      if ($numtok(%iuno.u,46) != 0) { 
        addplayerscoreb $2 
        addplayerscore $gettok(%iuno.u,1,46) 
        unomsg $1 %iuno.c2 $gettok(%iuno.u,1,46) gains %iuno.t.u points. For a total of %iuno.t.k points, and a total of $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$gettok(%iuno.u,1,46)),2,47) games played. 
        unoreset 
      } 
      else { 
        unomsg $1 %iuno.c2 No one is playing Uno t.t Type !Uno to begin anew. 
        unoreset 
      } 
    } 
    else { 
      set %iuno.fp $gettok(%iuno.u,1,46) 
      unomsg $1 %iuno.c2 $2 was removed from the current Uno game. 
      unomsg $1 %iuno.c2 %iuno.fp is now in control of the current Uno game. 
      unomsg3 $1 %iuno.fp You may now stop Uno by typing !unostop into %iuno.c2 
      if (%iuno.dl == 1) { 
        set %iuno.t.x 1 
        set %iuno.t.r $numtok(%iuno.h. [ $+ [ $2 ] ],46) 
        while (%iuno.t.r >= %iuno.t.x) { 
          set %iuno.d $instok(%iuno.d,$gettok(%iuno.h. [ $+ [ $2 ] ],%iuno.t.x,46),$rand(1,$numtok(%iuno.d,46)),46) 
          inc %iuno.t.x 
        } 
        addplayerscoreb $2 
      } 
    } 
  } 
  elseif ($findtok(%iuno.u,$2,0,46)) { 
    set %iuno.u $deltok(%iuno.u,$findtok(%iuno.u,$2,1,46),46) 
    if ($numtok(%iuno.u,46) <= 1) { 
      if ($numtok(%iuno.u,46) != 0) { 
        addplayerscoreb $2 
        addplayerscore $gettok(%iuno.u,1,46) 
        unomsg $1 %iuno.c2 $gettok(%iuno.u,1,46) gains %iuno.t.u points. For a total of %iuno.t.k points, and a total of $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$gettok(%iuno.u,1,46)),2,47) games played. 
        unoreset 
      } 
      else { 
        unomsg $1 %iuno.c2 No one is playing Uno t.t Type !Uno to begin anew. 
        unoreset 
      } 
    } 
    else { 
      unomsg $1 %iuno.c2 $2 was removed from the current Uno game. 
      if (%iuno.dl == 1) { 
        set %iuno.t.x 1 
        set %iuno.t.r $numtok(%iuno.h. [ $+ [ $2 ] ],46) 
        while (%iuno.t.r >= %iuno.t.x) { 
          set %iuno.d $instok(%iuno.d,$gettok(%iuno.h. [ $+ [ $2 ] ],%iuno.t.x,46),$rand(1,$numtok(%iuno.d,46)),46) 
          inc %iuno.t.x 
        } 
        addplayerscoreb $2 
      } 
    } 
  } 
} 
;---------------------------------------------------------------------- 
alias addplayerscore { 
  set %iuno.t.q $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$1),2,47) 
  inc %iuno.t.q 
  write -l1 " $+ $scriptdir $+ Uno.txt $+ " $addtok($read(" $+ $scriptdir $+ Uno.txt $+ ",1),$1,46) 
  if (!$read(" $+ $scriptdir $+ Uno.txt $+ ",s,$1)) write " $+ $scriptdir $+ Uno.txt $+ " $1 0/0 
  set %iuno.t.r $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$1),1,47) 
  set %iuno.t.k $calc(%iuno.t.r + %iuno.t.u) 
  $eval(write -s $+ $1 " $+ $scriptdir $+ Uno.txt $+ " $1 %iuno.t.k $+ $chr(47) $+ %iuno.t.q) 
} 
;---------------------------------------------------------------------- 
alias addplayerscoreb { 
  set %iuno.h. [ $+ [ $1 ] ] $remove(%iuno.h. [ $+ [ $1 ] ],b,g,m,y,z,D4) 
  set %iuno.t.s $replace(%iuno.h. [ $+ [ $1 ] ],.,+,S,20,D2,20,R,20,W,50) 
  set %iuno.t.s $calc(%iuno.t.s) 
  write -l1 " $+ $scriptdir $+ Uno.txt $+ " $addtok($read(" $+ $scriptdir $+ Uno.txt $+ ",1),$1,46) 
  if (!$read(" $+ $scriptdir $+ Uno.txt $+ ",s,$1)) write " $+ $scriptdir $+ Uno.txt $+ " $1 0/0 
  set %iuno.t.a $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$1),2,47) 
  inc %iuno.t.a 
  set %iuno.t.u $calc(%iuno.t.s + %iuno.t.u) 
  $eval(write -s $+ $1 " $+ $scriptdir $+ Uno.txt $+ " $1 $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$1),1,47) $+ $chr(47) $+ %iuno.t.a) 
} 
;---------------------------------------------------------------------- 
alias unocards { /* Network, Nick */ 
  if (%iuno.h. [ $+ [ $2 ] ]) { 
    set %iuno.ch. [ $+ [ $2 ] ] $sorttok(%iuno.h. [ $+ [ $2 ] ],46,a) 
    set %iuno.ch. [ $+ [ $2 ] ] $replace(%iuno.ch. [ $+ [ $2 ] ],b,$eval($chr(3) $+ %iuno.cb $+ $chr(44) $+ %iuno.bc $+ $chr(91))) 
    set %iuno.ch. [ $+ [ $2 ] ] $replace(%iuno.ch. [ $+ [ $2 ] ],g,$eval($chr(3) $+ %iuno.cg $+ $chr(44) $+ %iuno.bc $+ $chr(91))) 
    set %iuno.ch. [ $+ [ $2 ] ] $replace(%iuno.ch. [ $+ [ $2 ] ],m,$eval($chr(3) $+ %iuno.cr $+ $chr(44) $+ %iuno.bc $+ $chr(91))) 
    set %iuno.ch. [ $+ [ $2 ] ] $replace(%iuno.ch. [ $+ [ $2 ] ],y,$eval($chr(3) $+ %iuno.cy $+ $chr(44) $+ %iuno.bc $+ $chr(91))) 
    set %iuno.ch. [ $+ [ $2 ] ] $replace(%iuno.ch. [ $+ [ $2 ] ],z,$eval($chr(3) $+ %iuno.cw $+ $chr(44) $+ %iuno.bc $+ $chr(91))) 
    set %iuno.ch. [ $+ [ $2 ] ] $replace(%iuno.ch. [ $+ [ $2 ] ],.,$chr(93) $+ $chr(3)) 
    set %iuno.ch. [ $+ [ $2 ] ] %iuno.ch. [ $+ [ $2 ] ] $+ $chr(93) 
    unomsg3 $1 $2 %iuno.d4.s %iuno.ch. [ $+ [ $2 ] ] 
  } 
  else { 
    echo -s Uno error - User $2 does not have any cards. 
  } 
} 
;---------------------------------------------------------------------- 
alias showtopcard {  /* Network, Channel */ 
  set %iuno.dc $gettok(%iuno.dp,1,46) 
  set %iuno.dc $replace(%iuno.dc,b,$eval($chr(3) $+ %iuno.cb $+ $chr(44) $+ %iuno.bc $+ $chr(91))) 
  set %iuno.dc $replace(%iuno.dc,g,$eval($chr(3) $+ %iuno.cg $+ $chr(44) $+ %iuno.bc $+ $chr(91))) 
  set %iuno.dc $replace(%iuno.dc,m,$eval($chr(3) $+ %iuno.cr $+ $chr(44) $+ %iuno.bc $+ $chr(91))) 
  set %iuno.dc $replace(%iuno.dc,y,$eval($chr(3) $+ %iuno.cy $+ $chr(44) $+ %iuno.bc $+ $chr(91))) 
  set %iuno.dc $replace(%iuno.dc,z,$eval($chr(3) $+ %iuno.cw $+ $chr(44) $+ %iuno.bc $+ $chr(91))) 
  set %iuno.dc $replace(%iuno.dc,.,$chr(93) $+ $chr(3)) 
  unomsg $1 $2 Top Card: %iuno.dc $+ $chr(93) 
  var %iuno.cc 2 
  set %iuno.cl Next: 
  while (%iuno.cc <= $numtok(%iuno.u,46)) { 
    set %iuno.cl %iuno.cl $chr(124) $gettok(%iuno.u,%iuno.cc,46) - $numtok(%iuno.h. [ $+ [ $gettok(%iuno.u,%iuno.cc,46) ] ],46) Cards 
    inc %iuno.cc 
  } 
  unomsg3 $1 $gettok(%iuno.u,1,46)  $+ %iuno.fc $+ , $+ %iuno.bc $+ %iuno.cl 
} 
;---------------------------------------------------------------------- 
alias unoreset { 
  unset %iuno.* 
  set %iuno.color $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),2,46) 
  set %iuno.rank $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),3,46) 
  set %iuno.draw $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),4,46) 
  set %iuno.comm $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),5,46) 
  set %iuno.rwt $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),6,46) 
  set %iuno.tt $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),7,46) 
  set %iuno.sco $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),8,46) 
  set %iuno.scon $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),9,46) 
  set %iuno.mn $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),10,46) 
  set %iuno.c $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",3),2-,44) 
  set %iuno.as $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",4),1,32) 
  if (%iuno.as > 0) { 
    set %iuno.networks $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",4),2,32) 
    set %iuno.as3 $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",4),3-,32) 
  } 
  set %iuno.as.c 1 
  while (%iuno.as.c <= %iuno.as) { 
    set %iuno.c. [ $+ [ $gettok(%iuno.networks,%iuno.as.c,44) ] ] $gettok(%iuno.as3,%iuno.as.c,32) 
    inc %iuno.as.c 
  } 
  unocolors 
} 
;---------------------------------------------------------------------- 
alias newunodeck { 
  if (!$1) set %iuno.ud b0.b1.b2.b3.b4.b5.b6.b7.b8.b9.b1.b2.b3.b4.b5.b6.b7.b8.b9.g0.g1.g2.g3.g4.g5.g6.g7.g8.g9.g1.g2.g3.g4.g5.g6.g7.g8.g9.m0.m1.m2.m3.m4.m5.m6.m7.m8.m9.m1.m2.m3.m4.m5.m6.m7.m8.m9.y0.y1.y2.y3.y4.y5.y6.y7.y8.y9.y1.y2.y3.y4.y5.y6.y7.y8.y9.bD2.bD2.gD2.gD2.mD2.mD2.yD2.yD2.bS.bS.gS.gS.yS.yS.mS.mS.bR.bR.gR.gR.yR.yR.mR.mR.ZW.ZW.ZW.ZW.zWD4.zWD4.zWD4.zWD4 
  if ($1) { 
    set %iuno.ud $replace(%iuno.ud,b $+ $chr(42),$chr(42),g $+ $chr(42),$chr(42),m $+ $chr(42),$chr(42),y $+ $chr(42),$chr(42)) 

    if ($findtok(%iuno.ud,$chr(42),0,46)) set %iuno.ud $reptok(%iuno.ud,$chr(42),ZW,1,46) 
    if ($findtok(%iuno.ud,$chr(42),0,46)) set %iuno.ud $reptok(%iuno.ud,$chr(42),ZW,1,46) 
    if ($findtok(%iuno.ud,$chr(42),0,46)) set %iuno.ud $reptok(%iuno.ud,$chr(42),ZW,1,46) 
    if ($findtok(%iuno.ud,$chr(42),0,46)) set %iuno.ud $reptok(%iuno.ud,$chr(42),ZW,1,46) 
    if ($findtok(%iuno.ud,$chr(42),0,46)) set %iuno.ud $reptok(%iuno.ud,$chr(42),zWD4,1,46) 
    if ($findtok(%iuno.ud,$chr(42),0,46)) set %iuno.ud $reptok(%iuno.ud,$chr(42),zWD4,1,46) 
    if ($findtok(%iuno.ud,$chr(42),0,46)) set %iuno.ud $reptok(%iuno.ud,$chr(42),zWD4,1,46) 
    if ($findtok(%iuno.ud,$chr(42),0,46)) set %iuno.ud $reptok(%iuno.ud,$chr(42),zWD4,1,46) 
  } 
  var %iuno.it $numtok(%iuno.ud,46) 
  unset %iuno.d 
  var %iuno.i = 1 
  while (%iuno.i <= %iuno.it) { 
    var %iuno.r $rand(1,$numtok(%iuno.ud,46)) 
    set %iuno.d $instok(%iuno.d,$gettok(%iuno.ud,%iuno.r,46),-0,46) 
    set %iuno.ud $deltok(%iuno.ud,%iuno.r,46) 
    inc %iuno.i 
  } 
  unset %iuno.ud 
} 
;---------------------------------------------------------------------- 
alias skip { 
  set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,1,46),-0,46) 
  set %iuno.u $deltok(%iuno.u,1,46) 
  unomsg $1 %iuno.c2 $2 was Skipped! $gettok(%iuno.u,1,46) $+ 's turn. 
  showtopcard $1 %iuno.c2 
  unocards $1 $gettok(%iuno.u,1,46) 
} 
;---------------------------------------------------------------------- 
alias drawtwo { 
  var %iuno.d2v 1 
  while (%iuno.d2v <= 2) { 
    if (!$numtok(%iuno.d,46)) { 
      set %iuno.ud %iuno.dp 
      unset %iuno.dp 
      set %iuno.dp $gettok(%iuno.ud,1,46) 
      set %iuno.ud $deltok(%iuno.ud,1,46) 
      unomsg $1 %iuno.c2 Shuffling discard pile 
      newunodeck x 
    } 
    set %iuno.h. [ $+ [ $2 ] ] $instok(%iuno.h. [ $+ [ $2 ] ],$gettok(%iuno.d,1,46),-0,46) 
    set %iuno.d $deltok(%iuno.d,1,46) 
    inc %iuno.d2v 
  } 
  set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,1,46),-0,46) 
  set %iuno.u $deltok(%iuno.u,1,46) 
  unomsg $1 %iuno.c2 $2 Draws Two and is Skipped! $gettok(%iuno.u,1,46) $+ 's turn. 
  showtopcard $1 %iuno.c2 
  drawncards $network $2 2 
  unocards $1 $gettok(%iuno.u,1,46) 
} 
;---------------------------------------------------------------------- 
alias unocolors { 
  if (%iuno.color == 1) { 
    set %iuno.cb 12 
    set %iuno.cg 9 
    set %iuno.cw 0 
    set %iuno.fc 0 
    set %iuno.bc 1 
  } 
  else { 
    set %iuno.cb 2 
    set %iuno.cg 3 
    set %iuno.cw 1 
    set %iuno.fc 1 
    set %iuno.bc 0 
  } 
  set %iuno.cr 4 
  set %iuno.cy 8 
} 
;---------------------------------------------------------------------- 
alias drawncards { 
  set %iuno.t.m $numtok(%iuno.h. [ $+ [ $2 ] ],46) 
  set %iuno.t.l $gettok(%iuno.h. [ $+ [ $2 ] ],%iuno.t.m,46) 
  set %iuno.t.j $3 
  while (%iuno.t.j > 1) { 
    dec %iuno.t.m 
    set %iuno.t.l %iuno.t.l $+ $chr(46) $+ $gettok(%iuno.h. [ $+ [ $2 ] ],%iuno.t.m,46) 
    dec %iuno.t.j 
  } 
  set %iuno.t.l $replace(%iuno.t.l,b,$eval($chr(3) $+ %iuno.cb $+ $chr(44) $+ %iuno.bc $+ $chr(91))) 
  set %iuno.t.l $replace(%iuno.t.l,g,$eval($chr(3) $+ %iuno.cg $+ $chr(44) $+ %iuno.bc $+ $chr(91))) 
  set %iuno.t.l $replace(%iuno.t.l,m,$eval($chr(3) $+ %iuno.cr $+ $chr(44) $+ %iuno.bc $+ $chr(91))) 
  set %iuno.t.l $replace(%iuno.t.l,y,$eval($chr(3) $+ %iuno.cy $+ $chr(44) $+ %iuno.bc $+ $chr(91))) 
  set %iuno.t.l $replace(%iuno.t.l,z,$eval($chr(3) $+ %iuno.cw $+ $chr(44) $+ %iuno.bc $+ $chr(91))) 
  set %iuno.t.l $replace(%iuno.t.l,.,$chr(93) $+ $chr(3)) 
  set %iuno.t.l %iuno.t.l $+ $chr(93) 
  unomsg3 $1 $2  $+ %iuno.fc $+ , $+ %iuno.bc $+ Drawn Card(s): %iuno.t.l 
} 
;---------------------------------------------------------------------- 
alias reverse { /* Network, Nick */ 
  var %iuno.ri 2 
  while (%iuno.ri <= $numtok(%iuno.u,46)) { 
    set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,%iuno.ri,46),1,46) 
    inc %iuno.ri 
    set %iuno.u $deltok(%iuno.u,%iuno.ri,46) 
  } 
  if ((%iuno.rwt == 1) && ($numtok(%iuno.u,46) == 2)) { 
    set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,1,46),-0,46) 
    set %iuno.u $deltok(%iuno.u,1,46) 
  } 
  set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,1,46),-0,46) 
  set %iuno.u $deltok(%iuno.u,1,46) 
  unomsg $1 %iuno.c2 $2 Reversed it! $gettok(%iuno.u,1,46) $+ 's turn. 
  showtopcard $1 %iuno.c2 
  unocards $1 $gettok(%iuno.u,1,46) 
} 
;---------------------------------------------------------------------- 
alias chanpop { 
  did -r UnoOptions 10 
  didtok UnoOptions 10 44 %iuno.c 
  did -c UnoOptions 10 1 
} 
;---------------------------------------------------------------------- 
alias chanpop2 { 
  did -r UnoOptions 43 
  if (!$1) didtok UnoOptions 43 46 %iuno.c. [ $+ [ $did(53).text ] ] 
  if ($1) didtok UnoOptions 43 46 %iuno.c. [ $+ [ $did(40).text ] ] 
  did -c UnoOptions 43 1 
  if (!$1) did -c UnoOptions 40 $findtok($didtok(UnoOptions,40,44),$did(53).text,1,44) 
} 
;---------------------------------------------------------------------- 
alias unofilter { ;Average per Game 
  if ($calc($gettok($1,2,32)) > $calc($gettok($2,2,32))) return -1 
  if ($calc($gettok($1,2,32)) < $calc($gettok($2,2,32))) return 1 
  if ($calc($gettok($1,2,32)) == $calc($gettok($2,2,32))) return 0 
} 
;---------------------------------------------------------------------- 
alias unofilter2 { ;Total Points 
  if ($gettok($gettok($1,2,32),1,47) > $gettok($gettok($2,2,32),1,47)) return -1 
  if ($gettok($gettok($1,2,32),1,47) < $gettok($gettok($2,2,32),1,47)) return 1 
  if ($gettok($gettok($1,2,32),1,47) == $gettok($gettok($2,2,32),1,47)) return 0 
} 
;---------------------------------------------------------------------- 
alias unofilter3 { ;Total Games 
  if ($gettok($gettok($1,2,32),2,47) > $gettok($gettok($2,2,32),2,47)) return -1 
  if ($gettok($gettok($1,2,32),2,47) < $gettok($gettok($2,2,32),2,47)) return 1 
  if ($gettok($gettok($1,2,32),2,47) == $gettok($gettok($2,2,32),2,47)) return 0 
} 
;---------------------------------------------------------------------- 
alias UnoOptions { 
  dialog -ma UnoOptions UnoOptions 
} 
;---------------------------------------------------------------------- 
alias mnunoupdate { 
  set %iuno.networks $didtok(UnoOptions,40,44) 
  set %iuno.tv.c 1 
  while (%iuno.tv.c <= $numtok(%iuno.networks,44)) { 
    set %iuno.tv2.c 1 
    while (%iuno.tv2.c <= $numtok(%iuno.c. [ $+ [ $gettok(%iuno.networks,%iuno.tv.c,44) ] ],46)) { 
      set %iuno.c $addtok(%iuno.c,$gettok(%iuno.c. [ $+ [ $gettok(%iuno.networks,%iuno.tv.c,44) ] ],%iuno.tv2.c,46),44) 
      inc %iuno.tv2.c 
    } 
    inc %iuno.tv.c 
  } 
} 
;---------------------------------------------------------------------- 
dialog -l UnoOptions { 
  title "IRC Uno by mill2y@hotmail.com" 
  size -1 -1 300 328 
  option pixels notheme 
  tab "Options", 6, 1 1 299 300 
  tab "Network Options", 38 
  tab "Variations", 27 
  tab "About", 7 
  button "Apply", 1, 220 300 70 25, ok 
  button "UnLoad", 23, 7 265 70 25, tab 6 
  button "ReLoad", 24, 78 265 70 25, tab 6 
  button "Reset", 25, 149 265 70 25, tab 6 
  button "Open Uno.txt", 26, 220 265 72 25, tab 6 
  button "Remove Network", 47, 158 168 87 20, tab 38 disable 
  button "Add Channel", 48, 7 66 87 20, tab 38 disable 
  button "Remove Channel", 49, 158 121 87 20, tab 38 disable 
  button "Add Channel", 39, 5 32 87 20, tab 6 
  button "Remove Channel", 50, 145 74 87 20, tab 6 
  button "Cancel", 46, 141 300 65 25 
  box "Color Scheme", 8, 5 95 140 55, tab 6 
  box "User Communications", 20, 145 95 140 55, tab 6 
  box "Rank System", 32, 5 150 140 55, tab 6 
  box "Score System", 34, 145 150 140 55, tab 6 
  text "Uno Channel(s)", 9, 145 33 84 17, tab 6 center 
  text "Uno for mIRC created by Lost.Lion@gmail.com", 11, 6 24 289 17, tab 7 
  text "Version 1.12", 12, 6 40 100 17, tab 7 
  text "Find me at irc.rizon.net channel #Lovely Nick KovuKun", 14, 5 83 290 17, tab 7 
  text "Special Thanks To:", 15, 5 122 291 17, tab 7 center 
  text "superlady of #lovely for giving me many ideas and lots of support.", 16, 5 141 291 30, tab 7 center 
  text "All the members of #lovely for putting up with the testing and for joining in to help find the bugs.", 17, 5 172 291 30, tab 7 center 
  text "RG for making the Dialog Editor and Script Editor that I am Using.", 18, 5 203 291 30, tab 7 center 
  text "Networks", 41, 7 150 100 17, tab 38 
  text "Channels", 42, 7 103 100 17, tab 38 
  text "IRC Uno uses $findcid ($unocid) by FiberOPtics", 44, 5 253 291 17, tab 7 center 
  link "http://www.LostLion.tk", 13, 6 56 146 17, tab 7 
  link "http://www.mircscripts.org/users/RG", 19, 58 234 185 17, tab 7 
  link "http://www.mirc.net/user/FiberOPtics", 45, 58 272 186 17, tab 7 
  radio "Black Background", 4, 7 113 107 17, tab 6 group 
  radio "White Background", 5, 7 129 107 17, tab 6 
  radio "Notice", 21, 148 113 57 17, tab 6 group 
  radio "Message", 22, 148 129 64 17, tab 6 
  check "Enable !Rank", 3, 7 168 100 17, tab 6 
  check "Reverse acts like Skip with 2 Players", 28, 5 45 196 17, tab 27 
  check "Enable !UnoTop10", 33, 7 183 111 17, tab 6 
  check "Enable !Score", 36, 147 168 100 17, tab 6 
  check "Enable !Score <nick>", 37, 147 184 126 17, tab 6 
  check "Enable Multi-Network", 35, 7 26 118 17, tab 38 
  check "1 !Draw then !Pass", 2, 5 27 117 17, tab 27 
  check "All Networks", 54, 145 68 100 17, tab 38 disable 
  check "Cards Dealt Face Up", 29, 5 81 124 17, tab 27 disable 
  check "!Play or Lose (No !Draw)", 30, 5 99 140 17, tab 27 disable 
  check "DrawTwo/DrawFours Accumulate", 31, 5 117 185 17, tab 27 disable 
  check "Wild Draw 4 Doesn't Skip Player", 55, 5 63 195 17, tab 27 disable 
  combo 10, 145 51 138 70, tab 6 drop sort 
  combo 40, 7 168 149 70, tab 38 drop sort disable 
  combo 43, 7 121 149 70, tab 38 drop sort disable 
  edit "#Channel", 51, 5 51 138 20, tab 6 
  edit "#Channel", 52, 7 47 138 20, tab 38 disable 
  edit "Network", 53, 145 47 138 20, tab 38 disable 
} 
;---------------------------------------------------------------------- 
on *:dialog:UnoOptions:init:0: { 
  if (%iuno.draw == 1) did -c UnoOptions 2 
  if (%iuno.rank == 1) did -c UnoOptions 3 
  if (%iuno.color == 1) did -c UnoOptions 4 
  if (%iuno.color == 2) did -c UnoOptions 5 
  if (%iuno.comm == 0) did -c UnoOptions 21 
  if (%iuno.comm == 1) did -c UnoOptions 22 
  if (%iuno.rwt == 1) did -c UnoOptions 28 
  if (%iuno.tt == 1) did -c UnoOptions 33 
  if (%iuno.sco == 1) did -c UnoOptions 36 
  if (%iuno.scon == 1) did -c UnoOptions 37 
  if (%iuno.mn == 1) { 
    did -c UnoOptions 35 
    didtok UnoOptions 40 44 %iuno.networks 
    didtok UnoOptions 43 46 %iuno.c. [ $+ [ $gettok(%iuno.networks,1,44) ] ] 
    did -c UnoOptions 40 1 
    did -c UnoOptions 43 1 
    did -b UnoOptions 39,51,10,50 
    did -e UnoOptions 52,53,48,54,43,49,40,47 
  } 
  chanpop 
} 
;---------------------------------------------------------------------- 
on *:dialog:UnoOptions:sclick:23: { 
  dialog -x UnoOptions 
  unload -rs " $+ $scriptdir $+ Uno.mrc $+ " 
} 
on *:dialog:UnoOptions:sclick:24: { 
  dialog -x UnoOptions 
  reload -rs " $+ $scriptdir $+ Uno.mrc $+ " 
} 
on *:dialog:UnoOptions:sclick:25: { 
  dialog -x UnoOptions 
  unoreset 
} 
on *:dialog:UnoOptions:sclick:26: { 
  dialog -x UnoOptions 
  run " $+ $scriptdir $+ Uno.txt $+ " 
} 
on *:dialog:UnoOptions:sclick:46: { 
  dialog -x UnoOptions 
} 
on *:dialog:UnoOptions:sclick:39: { 
  set %iuno.c $addtok(%iuno.c,$did(51).text,44) 
  chanpop 
} 
on *:dialog:UnoOptions:sclick:50: { 
  set %iuno.c $remtok(%iuno.c,$did(10,1).seltext,44) 
  did -d UnoOptions 10 $did(10).sel 
  chanpop 
} 
on *:dialog:UnoOptions:sclick:48: { 
  if ($did(54).state == 1) { 
    set %iuno.c.all $addtok(%iuno.c.all,$did(52).text,46) 
    did -r UnoOptions 53 
    did -a UnoOptions 53 All 
  } 
  else { 
    set %iuno.c. [ $+ [ $did(53).text ] ] $addtok(%iuno.c. [ $+ [ $did(53).text ] ],$did(52).text,46) 
  } 
  if (!$findtok($didtok(UnoOptions,40,46),$did(53).text,46)) { 
    did -a UnoOptions 40 $did(53).text 
  } 
  mnunoupdate 
  chanpop2 
} 
on *:dialog:UnoOptions:sclick:49: { 
  set %iuno.c. [ $+ [ $did(40).seltext ] ] $remtok(%iuno.c. [ $+ [ $did(40).seltext ] ],$did(43).seltext,46) 
  if ($numtok( %iuno.c. [ $+ [ $did(40).seltext ] ],46) == 0) { 
    unset %iuno.c. [ $+ [ $did(40).seltext ] ] 
    did -d UnoOptions 40 $did(40).sel 
  } 
  did -c UnoOptions 40 1 
  chanpop2 X 
} 
on *:dialog:UnoOptions:sclick:47: { 
  unset %iuno.c. [ $+ [ $did(40).seltext ] ] 
  did -d UnoOptions 40 $did(40).sel 
  set %iuno.networks $remtok(%iuno.networks,$did(40).seltext,1,44) 
  chanpop2 
} 
on *:dialog:UnoOptions:sclick:40: { 
  chanpop2 X 
} 
on *:dialog:UnoOptions:sclick:35: { 
  if ($did(35).state == 1) { 
    did -r UnoOptions 40,43 
    didtok UnoOptions 40 44 %iuno.networks 
    didtok UnoOptions 43 46 %iuno.c. [ $+ [ $gettok(%iuno.networks,1,44) ] ] 
    did -c UnoOptions 40 1 
    did -c UnoOptions 43 1 
    did -b UnoOptions 39,51,10,50 
    did -e UnoOptions 52,53,48,54,43,49,40,47 
  } 
  else { 
    did -e UnoOptions 39,51,10,50 
    did -b UnoOptions 52,53,48,54,43,49,40,47 
  } 
} 
;---------------------------------------------------------------------- 
on *:dialog:UnoOptions:close:*: { 
  set %iuno.draw $did(2).state 
  set %iuno.rank $did(3).state 
  set %iuno.rwt $did(28).state 
  set %iuno.tt $did(33).state 
  set %iuno.sco $did(36).state 
  set %iuno.scon $did(37).state 
  set %iuno.mn $did(35).state 
  if ($did(4).state == 1) set %iuno.color 1 
  else set %iuno.color 2 
  if ($did(21).state == 1) set %iuno.comm 0 
  else set %iuno.comm 1 
  unocolors 
  write -l3 " $+ $scriptdir $+ Uno.txt $+ " !Channels! $+ $chr(44) $+ %iuno.c 
  write -l2 " $+ $scriptdir $+ Uno.txt $+ " !Options! $+ $chr(46) $+ %iuno.color $+ $chr(46) $+ %iuno.rank $+ $chr(46) $+ %iuno.draw $+ $chr(46) $+ %iuno.comm $+ $chr(46) $+ %iuno.rwt $+ $chr(46) $+ %iuno.tt $+ $chr(46) $+ %iuno.sco $+ $chr(46) $+ %iuno.scon $+ $chr(46) $+ %iuno.mn 
  unset %iuno.c 
  if (%iuno.mn == 0) set %iuno.c $didtok(UnoOptions,10,44) 
  else { 
    mnunoupdate 
  } 
  set %iuno.lfc 1 
  set %iuno.lft $numtok(%iuno.networks,44) $+ $chr(32) $+ %iuno.networks 
  while (%iuno.lfc <= $numtok(%iuno.networks,44)) { 
    set %iuno.lft $addtok(%iuno.lft,%iuno.c. [ $+ [ $gettok(%iuno.networks,%iuno.lfc,44) ] ],32) 
    inc %iuno.lfc 
  } 
  write -l4 " $+ $scriptdir $+ Uno.txt $+ " %iuno.lft 
  unset %iuno.lfc 
  unset %iuno.lft 
} 
;---------------------------------------------------------------------- 
menu channel { 
  Uno Options: UnoOptions 
} 
;---------------------------------------------------------------------- 
on *:unload: { 
  unset %iuno.* 
  echo -a 0,1--=) 4UnLoaded 11{15IRC-Uno11} 9by 11{15Lost.Lion@gmail.com11} 0(=-- 
}