Shadowrun

Shadowrun Play => Gamemasters' Lounge => Topic started by: calicojack73 on <12-13-12/1341:18>

Title: VBscript Dice Roller I came up with
Post by: calicojack73 on <12-13-12/1341:18>
As a GM I don't really care about the exact rolls for my NPCs, I just want to quickly know how many hits and glitches I got.
That being said, I created this vbscript to automate dice rolling for SR4.
Simply copy and save the code into a blank txt file on your Windows PC and change the file extension from .txt to .vbs
Double click it and it will handle the rest.

Code: [Select]
Y = 6
Do Until Y <> 6
D = inputbox("Enter the number of dice you want to roll","SR4 Dice Roller 1.0",0)
If D = "" or D = "0" then
wscript.quit
End If
Set objRandom = CreateObject( "System.Random" )
Hits = 0
Glitches = 0
For i = 1 to D
x = objRandom.Next_2( 1, 6 )
If x > 4 then
Hits = Hits + 1
End If
If x = 1 then
Glitches = Glitches + 1
End If
Next
If Hits = 0 AND Glitches >= D/2 Then
msgbox"YOU GOT A CRITICAL FAILURE!!!" & vbcrlf & Glitches & " Glitches rolled!",,"SR4 Dice Roller 1.0"
Else
msgbox"You got " & Hits & " Hits and " & Glitches & " Glitches.",,"SR4 Dice Roller 1.0"
End If

Y = msgbox("Do you want to roll again?",vbYesNo,"SR4 Dice Roller 1.0")
Title: Re: VBscript Dice Roller I came up with
Post by: Xzylvador on <12-13-12/1651:48>
Might want to change to 
Code: [Select]
If Glitches >= Int(D/2 + 0.5) AND Hits > 0 Then
      msgbox"GLITCH!" & vbcrlf & Hits & " Hits " & Glitches & " Glitches rolled." ,,"SR4 Dice Roller 1.01"
else
           If Hits = 0 AND Glitches >= D/2 Then
              msgbox"YOU GOT A CRITICAL FAILURE!!!" & vbcrlf & Glitches & " Glitches rolled!",,"SR4 Dice Roller 1.01"
            Else
                 msgbox"You got " & Hits & " Hits and " & Glitches & " Glitches.",,"SR4 Dice Roller 1.01"
            End If
End If

Unless being drunk and not having coded in a decade or so screwed up my writing.
Title: Re: VBscript Dice Roller I came up with
Post by: calicojack73 on <12-14-12/0713:29>
Thats nice... I didn't really figure on needing to specify a normal glitch since it is possible to still succeed at a task while rolling a glitch.  That is a nice addition though.  Did you try the code out and see if it worked?
Title: Re: VBscript Dice Roller I came up with
Post by: Xzylvador on <12-14-12/0732:20>
Android tablet, so no.
Title: Re: VBscript Dice Roller I came up with
Post by: JustADude on <12-15-12/0520:34>
Android tablet, so no.

Try Simple DiceRoller (https://play.google.com/store/apps/details?id=com.projectsexception&feature=more_from_developer#?t=W251bGwsMSwxLDEwMiwiY29tLnByb2plY3RzZXhjZXB0aW9uIl0.), which is a free Android App, if you want to do something similar on a Tablet.

It lets you create formulae to check for various statuses. I've never messed around with them too much, but I think it should work just fine for what you need.
Title: Re: VBscript Dice Roller I came up with
Post by: Xzylvador on <12-15-12/0546:42>
I've got a small pouch with 20 d6's which I carry around in the same bag I use for my tablet, so thanks, but I'm good ;)
Invisible Castle works great too.

Next tablet I buy just might be a windows 8 tablet so I can use Chummer, too.
Title: Re: VBscript Dice Roller I came up with
Post by: Redmercury on <12-15-12/1339:08>
Nice Xzylvador, always ready to play classy.