Scripts

From Mk

Revision as of 23:20, 12 September 2008 by Admin (Talk | contribs)

I'll be putting some scripts I no longer use here:

Contents

mIRC

Coin flipping script

; +----------------------------------------------------------------------------------------------------
; | MK's coin flipping script. Use /coin to activate yourself, or have others use ^coin
; | This first part is the alias:
alias coin {
  if ($nick == $null) { var %coinnick $me } 
  else { var %coinnick $nick } 
  var %coinrand $rand(1,6001)
  if ((%coinrand >= 1) && (%coinrand <= 3000)) { msg $chan %coinnick flips a coin! Heads! }
  elseif ((%coinrand >= 3001) && (%coinrand <= 6000)) { msg $chan %coinnick flips a coin! Tails! }
  else { msg $chan %coinnick flips a coin...and it landed on its edge. o_O }
}
; | This second part is the trigger for the alias:
on *:text:^coin:#:{ coin }
; | End of coin flipping script
; +----------------------------------------------------------------------------------------------------

Dice rolling script

; +----------------------------------------------------------------------------------------------------
; | MK's di(c)e rolling script. Use /roll to activate yourself, or have others use ^roll #x d #y
; | This first part is the alias:
alias roll {
  if ($nick == $null) { set %rollnick $me } 
  else { var %rollnick $nick } 
  if ($1 == help) { 
    notice %rollnick Syntax: ^roll �x� d �y�; �x� is the number of dice to roll; �y� is the number of sizes on each die; between 1 and 50. 
    halt
  }
  elseif (($2 != d) || ($3 == $null)) { 
    msg $chan %rollnick $+ , you somehow managed to screw up a fairly simple script. Type �^roll �help�� for help.
  }
  elseif (($calc($1) > 0) && ($calc($1) < 51) && ($2 == d) && ($calc($3) > 0) && ($calc($3) < 51)) {
    if ($calc($1) == 1) { msg $chan %rollnick rolled a d $+ $3 and got a $rand(1,$calc($3)) $+ ! | unset %roll* | halt }
    var %roll $calc($calc($1) - 1)
    var %rollout %rollnick rolled $1 d $+ $3 $+ 's and got 
    var %rolltotal1 0
    var %rolltotal2 0
    :1
    if (%roll == 0) {
      var %rollrand $rand(1,$calc($3))
      var %rolltotal1 $calc(%rolltotal + %rollrand)
      var %rolltotal2 $calc(%rolltotal2 + $calc($3))
      var %rollout %rollout $+ � and %rollrand $+ ! (Total: %rolltotal1 out of a possible %rolltotal2 $+ )
    }
    else { 
      var %rollrand $rand(1,$calc($3))
      var %rolltotal $calc(%rolltotal + %rollrand)
      var %rolltotal2 $calc(%rolltotal2 + $calc($3))
      var %rollout %rollout $+ � %rollrand $+ ,
      var %roll
      goto 1
    }
    :2
    msg $chan %rollout
  }
  else { msg $chan Sorry %rollnick $+ ; please use natural numbers between 1 and 50. }
}
; | This second part is the trigger for the alias:
on *:text:^roll *:#:{ roll $2- }
; | End of dice rolling script
; +---------------------------------------------------------------------------------------------------

Large Hadron Collider countdown

; +----------------------------------------------------------------------------------------------------
; | MK's LHC countdown script. Activates on Use /coin to activate yourself, or have others use ^coin
; | This first part is the alias:
alias lhc {
  var %lhc_current $ctime($date $time)
  var %lhc_circulate $ctime(2008 September 10 03:35:00)
  var %lhc_collision $ctime(2008 October 10 00:00:00)
  var %lhc_dif1 $calc(%lhc_circulate - %lhc_current)
  var %lhc_dif2 $calc(%lhc_collision - %lhc_current)
  if (%lhc_dif1 < 0) { 
    var %lhc_dif1 $remove(%lhc_dif1,-) 
    var %lhc_neg1 1 
  }
  if (%lhc_dif2 < 0) { 
    var %lhc_dif2 $remove(%lhc_dif2,-) 
    var %lhc_neg2 1
  }
  msg $chan The Large Hadron Collider $iif(%lhc_neg1,began,will begin) circulating protons $datecon($duration(%lhc_dif1)) $iif(%lhc_neg1,ago,from now) and $iif(%lhc_neg2,began,will begin) collisions $datecon($duration(%lhc_dif2)) $iif(%lhc_neg2,ago,from now) $+ . 
}
; | This second part is the trigger for the alias:
on *:text:^lhc:#:{ lhc }
; | End of LHC countdown script
; +---------------------------------------------------------------------------------------------------
Personal tools