Dice Rolling Game

By vaseline28 on May 03, 2008

This script goes in remotes.
It is a game which randomly decides on a winner. The winner is the name which generates the highest numbers from the X amount of dice rolls.
The "X" amount of dice rolls and the "X" number of sides and the opposition are determined through the prompt typed by the user.

!DiceGame

Example:

!dicegame 4 12 Vaseline **[Dice Roll]** < Players: GameMoglin vs. Vaseline > < No. of Dice 4 > < Sides on Dice: 12 > **[GameMoglin vs. Vaseline ]** < Dice Rolled: 2 3 6 1 > < Total:12 > **[GameMoglin vs. Vaseline ]** < Dice Rolled: 4 1 8 3 > < Total:16 > **[GameMoglin vs. Vaseline ]** Vaseline is the winner! ```mirc on *:text:!DiceGame*:#: { if (($2 !isnum) || ($3 !isnum) || (!$4)) { msg $chan [4 $nick ] You need someone to play against! | /halt } msg $chan [4Dice Roll] < Players:4 $nick vs.4 $4 > < No. of Dice:4 $2 > < Sides on Dice:4 $3 > var -s %DiceGameRolled 0 | /var -s %DiceGameAdded 0 while (%DiceGameRolled < $2) { inc %DiceGameRolled var -s %DiceGamePlayer1 $instok(%DiceGamePlayer1,$rand(1,$3),%DiceGameRolled,32) } while (%DiceGameAdded < $2) { inc %DiceGameAdded var -s %RollTime $gettok(%DiceGamePlayer1,%DiceGameAdded,32) var -s %RollTotalPlayer1 $calc(%RollTotalPlayer1 + %RollTime) } var -s %DiceGameRolled 0 | /var -s %DiceGameAdded 0 msg $chan [4 $nick vs.4 $4 ] < Dice Rolled:4 %DiceGamePlayer1 > < Total:4 %RollTotalPlayer1 > while (%DiceGameRolled < $2) { inc %DiceGameRolled var -s %DiceGamePlayer2 $instok(%DiceGamePlayer2,$rand(1,$3),%DiceGameRolled,32) } while (%DiceGameAdded < $2) { inc %DiceGameAdded var -s %RollTime $gettok(%DiceGamePlayer2,%DiceGameAdded,32) var -s %RollTotalPlayer2 $calc(%RollTotalPlayer2 + %RollTime) } msg $chan [4 $nick vs.4 $4 ] < Dice Rolled:4 %DiceGamePlayer2 > < Total:4 %RollTotalPlayer2 > if (%DiceGamePlayer1 > %DiceGamePlayer2) msg $chan [4 $nick vs.4 $4 ]4 $nick is the winner! else msg $chan [4 $nick vs.4 $4 ]4 $4 is the winner! } ```

Comments

Sign in to comment.
MashhitDK   -  Jun 04, 2012

Thanks for sharing... here is a quick edit

on *:TEXT:!DiceGame*:#: {
  if (($2 !isnum) || ($3 !isnum) || ($4 == $nick) || ($4 !ison $chan)) { .notice $nick You need someone to play against! | return }
  var %DiceGameRolled 1 | var %DiceGameAdded 1
  ;*** Rolls
  while (%DiceGameRolled <= $2) { var %DiceGamePlayer1 $instok(%DiceGamePlayer1,$rand(1,$3),%DiceGameRolled,32) | var %DiceGamePlayer2 $instok(%DiceGamePlayer2,$rand(1,$3),%DiceGameRolled,32) | inc %DiceGameRolled }
  ;*** Total
  while (%DiceGameAdded <= $2) { var %RollTime $gettok(%DiceGamePlayer1,%DiceGameAdded,32) | var %RollTotalPlayer1 $calc(%RollTotalPlayer1 +%RollTime) | var %RollTime $gettok(%DiceGamePlayer2,%DiceGameAdded,32) | var %RollTotalPlayer2 $calc(%RollTotalPlayer2 +%RollTime) | inc %DiceGameAdded }
  msg # $+([,$mNiCK($nick) vs. $mNiCK($4),]) Dice roll with $mNUM($2) $+(15,$chr(40),,$mNUM($3),-SiDED15,$chr(41),) $+(dice,$iif($2 > 1,s),...) $&
    $mNiCK($iif(%DiceGamePlayer1 > %DiceGamePlayer2,$nick,$4)) is the winner... rolled $iif(%RollTotalPlayer1 > %RollTotalPlayer2,%DiceGamePlayer1 $+(15,$chr(40),,$v1,15,,$chr(41),) vs. %DiceGamePlayer2 $+(15,$chr(40),,$v2,15,,$chr(41),),%DiceGamePlayer2 $+(15,$chr(40),,$v2,15,,$chr(41),) vs. %DiceGamePlayer1 $+(15,$chr(40),,$v1,15,,$chr(41),))
}
 Respond  
vaseline28   -  May 09, 2008

@Weapon-X: I\'m using the latest version of mIRC, 6.31 and so I don\'t know whether the format for $instok() has been changed since version 6.2. If it has, I can\'t help you other than to suggest downloading the later version if you want this script to work!

@napa182: The -s have been removed, thanks!

 Respond  
napa182   -  May 06, 2008

and also make it so people can only use a certain amount of dice cuz it will bust the script with an error line too long if not.

 Respond  
napa182   -  May 06, 2008

um a bit floody may want to add some kind of flood control to the triger as well as removing the -s switch so it dont flood ur status window when it\'s setting the var.

 Respond  
Weapon-X   -  May 06, 2008

Using mIRC 6.2, script posts the first line, then stops, this message in the Status window:

  • Set %DiceGameRolled to 0
  • Set %DiceGameAdded to 0
  • Invalid format: $instok (line 7, dice.mrc)

I don\'t know enough about mIRC scripting to figure out how to fix it, unfortunately, but thought this was worth a mention.

 Respond  
RagBot   -  May 03, 2008

Kudos to you, i just made a dice game and i have to say this one is better.

 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.