Top

Dice Rolling Script


mIRC Code
+ 0 likes
Please Register to submit score.
Average Score  0.0
Scores Submitted  0
Date Added  Apr 29, 2008
Last Updated  Jun 25, 2008
Tags  compact  dice  mirc  random  remote  roll 
  Bookmark and Share

Introduction

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 <no. of dice used> <sides on all dice>
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 <no. of dice used> <sides on all dice>
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 >

Grab the Code

Comments

  (11)  RSS
mountaindew
Comments: 1,636
 
mIRC Snippet:  Dice Rolling Script
Posted on Apr 29, 2008 2:00 pm
Code:

  if (($2 <= 0) || ($2 == $null) || ($3 == $null) || ($3 <= 0)) {

The if ($2 == $null) is redundant since you have the if ($3 == $null) also.

But you could simply do:
Code:

  if ($2 isnum 1- && $3 isnum 1-) {
jonesy44
Comments: 1,068
 
mIRC Snippet:  Dice Rolling Script
Posted on Apr 29, 2008 2:14 pm
set -s %AmountDice = SPAM !
vaseline28
Comments: 154
 
mIRC Snippet:  Dice Rolling Script
Posted on Apr 30, 2008 11:18 am
I've cut the
Quote:
($2 == $null)

thanks for that pointer!

@ jonesy44: Yep, I've edited in $2 for %AmountDice and $3 for %DiceSides

Thanks for the help!
criminal
Comments: 122
 
mIRC Snippet:  Dice Rolling Script
Posted on May 1, 2008 3:59 pm
Funny ^^
Can you tell me how you type messages in bold? or in colors O.o
Thanks :D
mountaindew
Comments: 1,636
 
mIRC Snippet:  Dice Rolling Script
Posted on May 1, 2008 4:09 pm
criminal:

Code:

[b]bold[/b]
[i]italics[/i]
[color=red]red[/color]
[u]underline[/u]
[url=http://url.com]URL[/url]
[code];code[/code]
[img]http://path/to/image.jpg[/img]
vaseline28
Comments: 154
 
mIRC Snippet:  Dice Rolling Script
Posted on May 2, 2008 9:50 am
And just in case, if you mean mIRC:

Bold = Ctrl+B <message here> Ctrl+B
Color = Ctrl+K then choose the number corresponding to the color
vaseline28
Comments: 154
 
mIRC Snippet:  Dice Rolling Script
Posted on May 3, 2008 9:49 am
Edited the Snippet, it now uses /var instead of /set and therefore does not clutter your Variables!
vaseline28
Comments: 154
 
mIRC Snippet:  Dice Rolling Script
Posted on Jun 21, 2008 3:57 am
Cleand up my if statement.
Nomader
Comments: 5
 
mIRC Snippet:  Dice Rolling Script
Posted on Jun 24, 2008 11:15 pm
nice... might I suggest putting a . in front of your vars to cut out the status window spam.
Typo
Comments: 222
 
mIRC Snippet:  Dice Rolling Script
Posted on Jun 24, 2008 11:35 pm
He is using var -s to specifically show the variables result when set so instead of using .var -s %var to quiet it the better suggestion would be to lose the -s all together.
vaseline28
Comments: 154
 
mIRC Snippet:  Dice Rolling Script
Posted on Jun 25, 2008 12:48 am
I like leaving the -s in when I'm working on my scripts for bug-testing, seems that i haven't removed them.

Edit: Changed now.

Please Register or Login to start posting comments.
Bottom