Scripts

From Mk

(Difference between revisions)
(Dice rolling script)
Line 7: Line 7:
; +----------------------------------------------------------------------------------------------------
; +----------------------------------------------------------------------------------------------------
; | MK's coin flipping script. Use /coin to activate yourself, or have others use ^coin
; | MK's coin flipping script. Use /coin to activate yourself, or have others use ^coin
-
on *:text:^*:#:{
+
; | This first part is the alias:
-
  if ($1 == ^coin) { coin }
+
-
}
+
alias coin {
alias coin {
   if ($nick == $null) { var %coinnick $me }  
   if ($nick == $null) { var %coinnick $me }  
Line 18: Line 16:
   else { msg # %coinnick flips a coin...and it landed on its edge. o_O }
   else { msg # %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
; | End of coin flipping script
; +----------------------------------------------------------------------------------------------------
; +----------------------------------------------------------------------------------------------------
Line 25: Line 25:
; +----------------------------------------------------------------------------------------------------
; +----------------------------------------------------------------------------------------------------
; | MK's di(c)e rolling script. Use /roll to activate yourself, or have others use ^roll #x d #y
; | MK's di(c)e rolling script. Use /roll to activate yourself, or have others use ^roll #x d #y
-
on *:text:^*:#:{
+
 
-
  elseif ($1 == ^roll) { roll $2- }
+
; | This first part is the alias:
-
}
+
alias roll {
alias roll {
   if ($nick == $null) { set %rollnick $me }  
   if ($nick == $null) { set %rollnick $me }  
Line 64: Line 63:
   else { msg $chan Sorry %rollnick $+ ; please use natural numbers between 1 and 50. }
   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
; | End of dice rolling script
; +---------------------------------------------------------------------------------------------------
; +---------------------------------------------------------------------------------------------------
</pre>
</pre>

Revision as of 22:46, 12 September 2008

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

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 # %coinnick flips a coin! Heads! }
  elseif ((%coinrand >= 3001) && (%coinrand <= 6000)) { msg # %coinnick flips a coin! Tails! }
  else { msg # %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 (($1 == $null) || (($1 != $null) && ($2 == $null)) || (($2 != $null) && ($3 == $null)) || (($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
; +---------------------------------------------------------------------------------------------------
Personal tools