Dice rolling script

By Lostgamer on Sep 21, 2004

This is a fairly advanced dice rolling script, that i wrote in cooperation with [Paradox].

it's activated using !roll [number]

it has a limit in the amount of dice that can be rolled, it's set to 10 as default. it can be changed by editing line 3.
it has a simple built in floodprotection, that stops the script from working if !roll [number] is said 2ce within 3 seconds.
allso has a counter, tracking the amount of rolls made.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Dice rolling script                         
;;coded by:                                  
;;Mastha [irc.giveupallready.com #scripting]  
;;with help from :                            
;;[paradox] [irc.undernet.org #scripting]     
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
on *:text:!roll*:*: {
  if ($1 == !roll) { 
    var %max 10
    if (($0 == 2) && ($2 isnum 1- [ $+ [ %max ] ] )) {
      set -u3 %dice.rolling $2
      set -u3 %dice.now $calc(%dice.now + 1)
      if (%dice.now >= 2) {
        halt
      }
      var %loop 1
      var %msg msg $chan $nick rolled the following:
      while (%loop <= %dice.rolling) {
        var %die = $rand(1,6)
        var %msg = %msg 4 %die $+  $+ $chr(44)
        var %total = $calc(%total + %die)
        inc %loop
      }
      %msg totalling 4 %total  $+ .
      inc %dice.rolled
      msg $chan the dice have been rolled %dice.rolled times.
    }
    else {
      msg $chan $nick $+ , you can only roll 1 to %max dice.
      halt
    }
  }
  else {
    halt
  }

Comments

Sign in to comment.
splatted   -  Mar 11, 2005

looks ok. you may want to add another \"}\" as it looks one bracket short

 Respond  
Sigh_   -  Sep 22, 2004

You can use $str to generate N amount of dice with F number of faces, the results separated with a space: $($str($!r(1,F) $chr(32),N),2) - in this case you\'d replace F with 6 and N with $2

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.