This snippet goes in Remotes!
I focused on keeping this small and compact, it totals 11 lines in total. The use of /set rather than /var was deliberate also.
It's not my first mIRC script, but probably the trickiest one I've tackled. I was speaking to someone on mIRC and they said they'd seen 4 ways of doing this in 24 hours, so I thought I'd put it here for the experts to scrutinise!
What this does it the following:
User prompts:
!Script
The script generates random numbers for each dice rolled (based on the no. of sides) and then adds up the total score.
An example of a prompt would be:
User prompts: !Script
The script generates random numbers for each dice rolled (based on the no. of sides) and then adds up the total score.
An example of a prompt would be:
!roll 3 2
[ User Nick ] < Dice: 3 > < Sides on Dice: 2 > < Rolls Scores: 2 2 1 > < Total Score: 5 >
on *:text:!roll*:#: {
if (($2 <= 0) || (!$3) || ($3 <= 0)) { msg $chan [ 4 $nick ] You have to roll something silly! | halt }
var %RollsDone 0 | var %Adds 0
while (%RollsDone < $2) {
inc %RollsDone | var %DiceScores $instok(%DiceScores,$rand(1,$3),%RollsDone,32)
}
while (%Adds < $2) {
inc %Adds | var %RollTime $gettok(%DiceScores,%Adds,32) | var %RollTotal $calc(%RollTotal + %RollTime)
}
/msg $chan [ 4 $nick ] < Dice:4 $2 > < Sides on Dice:4 $3 > < Rolls Scores:4 %DiceScores > < Total Score:4 %RollTotal >
}
hey, sorry to respond to this after 6 years, but I am trying to use this script in mIRC for my TwitchTV bot, i have edited it a little, but i dont want the users to be able to say how many dice and the sides, i just want it to always be out of like 100. how would i do that?