User:Nod/Auto Character Generator And Dice Roller

From FuturePath
< User:Nod
Revision as of 06:23, 15 January 2015 by Nod (talk | contribs) (Created page with "'This is source code for a nicely formatted automatic character generator for use on Windows (Yeah, I know...). 'Copy and paste this into a plain text document like notepad an...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

'This is source code for a nicely formatted automatic character generator for use on Windows (Yeah, I know...). 'Copy and paste this into a plain text document like notepad and save as chargen.vbs. 'DO NOT COPY any of this block of single quoted lines. 'Open a command windows and cd to the directory where this file resides. 'Type the below. 'For help: 'cscript chargen.vbs 'To roll a new character: 'cscript chargen.vbs new 'To roll a die (Only recognizes one die at a time): 'cscript chargen.vbs <integer of the number of sides on the die you would like to roll> 'Example: cscript chargen.vbs 12


On Error Resume Next


Dim die Set die = Wscript.Arguments

If die.Count = 0 Then

   Wscript.Echo "To roll a die, type the number of sides for that die 2-20"
   Wscript.Echo "To roll a character, type ""new"""
   Wscript.Quit 0

End If

Cool = Nothing

If die(0) = "new" Then

   Wscript.Echo "MAIN STATS"
   PhysicalPower = Int(stats(Cool))
   PhysicalQuickness = Int(stats(Cool))
   PhysicalToughness = Int(stats(Cool))
   PhysicalProwess = Int(stats(Cool))
   MentalPower = Int(stats(Cool))
   MentalQuickness = Int(stats(Cool))
   MentalToughness = Int(stats(Cool))
   MentalProwess = Int(stats(Cool))
   CommonSense = Int(stats(Cool))
   SixthSense = Int(stats(Cool))
   Social = Int(stats(Cool))
   Cool = "coolness"
   Coolness = Int(stats(Cool))
   Wscript.Echo "                  ---Physical--------Mental------"
   Wscript.Echo "  Power       " & PhysicalPower & "       " & MentalPower
   Wscript.Echo "  Quick       " & PhysicalQuickness & "       " & MentalQuickness
   Wscript.Echo "  Tough       " & PhysicalToughness & "       " & MentalToughness
   Wscript.Echo "  Prowess     " & PhysicalProwess & "     " & MentalProwess
   Wscript.Echo ""
   Wscript.Echo "  Common Sense        " & CommonSense
   Wscript.Echo "  Sixth Sense     " & SixthSense
   Wscript.Echo "  Coolness        " & Int(Coolness    /   3)
   Wscript.Echo "  Social          " & Social
   Wscript.Echo ""
   Wscript.Echo "COMBAT STATS"
   PhysicalHit = Int((PhysicalProwess     +   ((PhysicalQuickness +   CommonSense)        /   2)))
   PhysicalDamage = Int((PhysicalPower        +   ((PhysicalProwess   +   CommonSense)        /   2)))
   PhysicalSoak = Int((PhysicalToughness      +   ((PhysicalQuickness +   CommonSense)        /   2)))
   PhysicalHitRange = Int((PhysicalProwess        +   ((PhysicalQuickness +   PhysicalPower)      /   2)))
   PhysicalDamageRange = Int((PhysicalQuickness   +   ((PhysicalProwess   +   PhysicalPower)      /   2)))
   PhysicalSoakRange = Int((PhysicalToughness +   ((PhysicalProwess   +   PhysicalQuickness)  /   2)))
   MentalHit = Int((MentalProwess         +   ((MentalQuickness   +   SixthSense)     /   2)))
   MentalDamage = Int((MentalPower            +   ((MentalProwess     +   SixthSense)     /   2)))
   MentalSoak = Int((MentalToughness      +   ((MentalQuickness   +   SixthSense)     /   2)))
   MentalHitRange = Int((MentalQuickness      +   ((MentalProwess     +   MentalPower)        /   2)))
   MentalDamageRange = Int((MentalPower       +   ((MentalProwess     +   MentalQuickness)    /   2)))
   MentalSoakRange = Int((MentalProwess       +   ((MentalToughness   +   MentalQuickness)    /   2)))
   PhysicalDodge = Int((PhysicalQuickness     +   ((PhysicalProwess   +   SixthSense)     /   2)))
   PhysicalGrip = Int((((PhysicalPower        +   PhysicalToughness)  /   2)          +   ((PhysicalSoak  +   PhysicalDodge)  /   3)))
   PhysicalCrit = Int((PhysicalProwess        +   ((PhysicalPower     +   SixthSense)     /   2)))
   MentalDodge = Int((MentalQuickness     +   ((MentalProwess     +   CommonSense)        /   2)))
   MentalGrip = Int((((MentalPower            +   MentalToughness)    /   2)          +   ((MentalSoak    +   MentalDodge)    /   3)))
   MentalCrit = Int((MentalProwess            +   ((MentalPower       +   CommonSense)        /   2)))
   'PhysicalHit = Int((PhysicalProwess      +   ((PhysicalQuickness +   CommonSense)        /   2))/3)
   'PhysicalDamage = Int((PhysicalPower     +   ((PhysicalProwess   +   CommonSense)        /   2))/3)
   'PhysicalSoak = Int((PhysicalToughness       +   ((PhysicalQuickness +   CommonSense)        /   2))/3)
   'PhysicalHitRange = Int((PhysicalProwess     +   ((PhysicalQuickness +   PhysicalPower)      /   2))/3)
   'PhysicalDamageRange = Int((PhysicalQuickness    +   ((PhysicalProwess   +   PhysicalPower)      /   2))/3)
   'PhysicalSoakRange = Int((PhysicalToughness  +   ((PhysicalProwess   +   PhysicalQuickness)  /   2))/3)
   'MentalHit = Int((MentalProwess          +   ((MentalQuickness   +   SixthSense)     /   2))/3)
   'MentalDamage = Int((MentalPower         +   ((MentalProwess     +   SixthSense)     /   2))/3)
   'MentalSoak = Int((MentalToughness       +   ((MentalQuickness   +   SixthSense)     /   2))/3)
   'MentalHitRange = Int((MentalQuickness       +   ((MentalProwess     +   MentalPower)        /   2))/3)
   'MentalDamageRange = Int((MentalPower        +   ((MentalProwess     +   MentalQuickness)    /   2))/3)
   'MentalSoakRange = Int((MentalProwess        +   ((MentalToughness   +   MentalQuickness)    /   2))/3)
   'PhysicalDodge = Int((PhysicalQuickness      +   ((PhysicalProwess   +   SixthSense)     /   2))/3)
   'PhysicalGrip = Int((((PhysicalPower     +   PhysicalToughness)  /   2)          +   ((PhysicalSoak  +   PhysicalDodge)  /   3))/4)
   'PhysicalCrit = Int((PhysicalProwess     +   ((PhysicalPower     +   SixthSense)     /   2))/3)
   'MentalDodge = Int((MentalQuickness      +   ((MentalProwess     +   CommonSense)        /   2))/3)
   'MentalGrip = Int((((MentalPower         +   MentalToughness)    /   2)          +   ((MentalSoak    +   MentalDodge)    /   3))/4)
   'MentalCrit = Int((MentalProwess         +   ((MentalPower       +   CommonSense)        /   2))/3)
   Wscript.Echo ""
   Wscript.Echo "  Dodge       " & PhysicalDodge & "       " & MentalDodge
   Wscript.Echo "  Grip        " & PhysicalGrip & "        " & MentalGrip
   Wscript.Echo "  Crit        " & PhysicalCrit & "        " & MentalCrit
   Wscript.Echo ""
   Wscript.Echo "                  ---Melee--Range--Melee--Range"
   Wscript.Echo "  Hit       " & PhysicalHit & "     " & PhysicalDamage & "     " & MentalHit & "     " & MentalDamage
   Wscript.Echo "  Damage        " & PhysicalDamage & "     " & PhysicalDamageRange & "     " & MentalDamage & "     " & MentalDamageRange
   Wscript.Echo "  Soak          " & PhysicalSoak & "     " & PhysicalSoakRange & "     " & MentalSoak & "     " & MentalSoakRange

End If

Function stats(coolStat)

   If coolStat = "coolness" Then
       roll1 = Int(Dice12)
       roll2 = Int(Dice12)
       roll3 = Int(Dice12)
       roll4 = Int(Dice12)
       allRolls = Array(roll1, roll2, roll3, roll4)
   Else
       roll1 = Int(Dice12)
       roll2 = Int(Dice12)
       allRolls = Array(roll1, roll2)
       If roll1 = 1 And roll2 = 1 Then
           finalRoll = 25
           stats = finalRoll
           Exit Function
       End If
   End If
   For Each eachRoll in allRolls
       While eachRoll < 3
           eachRoll = Int(Dice12)
       Wend
       finalRoll = Int(finalRoll + eachRoll)
   Next
   stats = finalroll
   'New change (divide final roll by 2) to use only one D12 rather than 2 for the final stat result
   'stats = Int(finalroll/2)

End Function

If die(0) = "2" Then

   If die(0) and die(1) = Null Then Wscript.Echo Int(Dice2)
   If die(1) Then Wscript.Echo Int(Dice2 * die(1))

End If

If die(0) = "3" Then

   If die(0) and die(1) = Null Then Wscript.Echo Int(Dice3)
   If die(1) Then Wscript.Echo Int(Dice3 * die(1))

End If

If die(0) = "4" Then

   If die(0) and die(1) = Null Then Wscript.Echo Int(Dice4)
   If die(1) Then Wscript.Echo Int(Dice4 * die(1))

End If

If die(0) = "5" Then

   If die(0) and die(1) = Null Then Wscript.Echo Int(Dice2 + Dice3)
   If die(1) Then Wscript.Echo Int((Dice2 + Dice3) * die(1))

End If

If die(0) = "6" Then

   If die(0) and die(1) = Null Then Wscript.Echo Int(Dice6)
   If die(1) Then Wscript.Echo Int(Dice6 * die(1))

End If

If die(0) = "7" Then

   If die(0) and die(1) = Null Then Wscript.Echo Int(Dice3 + Dice4)
   If die(1) Then Wscript.Echo Int((Dice3 + Dice4) * die(1))

End If

If die(0) = "8" Then

   If die(0) and die(1) = Null Then Wscript.Echo Int(Dice8)
   If die(1) Then Wscript.Echo Int(Dice8 * die(1))

End If

If die(0) = "9" Then

   If die(0) and die(1) = Null Then Wscript.Echo Int(Dice4 + (Dice2 + Dice3))
   If die(1) Then Wscript.Echo Int((Dice4 + (Dice2 + Dice3)) * die(1))

End If

If die(0) = "10" Then

   If die(0) and die(1) = Null Then Wscript.Echo Int(Dice10)
   If die(1) Then Wscript.Echo Int(Dice10 * die(1))

End If

If die(0) = "11" Then

   If die(0) and die(1) = Null Then Wscript.Echo Int((Dice3 + Dice2) + Dice6)
   If die(1) Then Wscript.Echo Int(((Dice3 + Dice2) + Dice6) * die(1))

End If

If die(0) = "12" Then

   If die(0) and die(1) = Null Then Wscript.Echo Int(Dice12)
   If die(1) Then Wscript.Echo Int(Dice12 * die(1))

End If

If die(0) = "13" Then

   If die(0) and die(1) = Null Then Wscript.Echo Int((Dice3 + Dice4) + Dice6)
   If die(1) Then Wscript.Echo Int(((Dice3 + Dice4) + Dice6) * die(1))

End If

If die(0) = "14" Then

   If die(0) and die(1) = Null Then Wscript.Echo Int((Dice3 + Dice4) + (Dice3 + Dice4))
   If die(1) Then Wscript.Echo Int(((Dice3 + Dice4) + (Dice3 + Dice4)) * die(1))

End If

If die(0) = "15" Then

   If die(0) and die(1) = Null Then Wscript.Echo Int((Dice3 + Dice4) + Dice8)
   If die(1) Then Wscript.Echo Int(((Dice3 + Dice4) + Dice8) * die(1))

End If

If die(0) = "16" Then

   If die(0) and die(1) = Null Then Wscript.Echo Int(Dice8 + Dice8)
   If die(1) Then Wscript.Echo Int((Dice8 + Dice8) * die(1))

End If

If die(0) = "17" Then

   If die(0) and die(1) = Null Then Wscript.Echo Int(Dice8 + (Dice4 + (Dice2 + Dice3)))
   If die(1) Then Wscript.Echo Int((Dice8 + (Dice4 + (Dice2 + Dice3))) * die(1))

End If

If die(0) = "18" Then

   If die(0) and die(1) = Null Then Wscript.Echo Int((Dice4 + (Dice2 + Dice3)) + (Dice4 + (Dice2 + Dice3)))
   If die(1) Then Wscript.Echo Int(((Dice4 + (Dice2 + Dice3)) + (Dice4 + (Dice2 + Dice3))) * die(1))

End If

If die(0) = "19" Then

   If die(0) and die(1) = Null Then Wscript.Echo Int((Dice4 + (Dice2 + Dice3)) + Dice10)
   If die(1) Then Wscript.Echo Int(((Dice4 + (Dice2 + Dice3)) + Dice10) * die(1))

End If

If die(0) = "20" Then

   If die(0) and die(1) = Null Then Wscript.Echo Int(Dice20)
   If die(1) Then Wscript.Echo Int(Dice20 * die(1))

End If

Function Dice2 Dim Die2 Randomize Die2 = Int((2 * Rnd) + 1) 'Wscript.Echo Die2 Dice2 = Die2 Set Die2 = Nothing End Function

Function Dice3 Dim Die3 Randomize Die3 = Int((3 * Rnd) + 1) 'Wscript.Echo Die3 Dice3 = Die3 Set Die3 = Nothing End Function

Function Dice4 Dim Die4 Randomize Die4 = Int((4 * Rnd) + 1) 'Wscript.Echo Die4 Dice4 = Die4 Set Die4 = Nothing End Function

Function Dice6 Dim Die6 Randomize Die6 = Int((6 * Rnd) + 1) 'Wscript.Echo Die6 Dice6 = Die6 Set Die6 = Nothing End Function

Function Dice8 Dim Die8 Randomize Die8 = Int((8 * Rnd) + 1) 'Wscript.Echo Die8 Dice8 = Die8 Set Die8 = Nothing End Function

Function Dice10 Dim Die10 Randomize Die10 = Int((10 * Rnd) + 1) 'Wscript.Echo Die10 Dice10 = Die10 Set Die10 = Nothing End Function

Function Dice12 Dim Die12 Randomize Die12 = Int((12 * Rnd) + 1) 'Wscript.Echo Die12 Dice12 = Die12 Set Die12 = Nothing End Function

Function Dice20 Dim Die20 Randomize Die20 = Int((20 * Rnd) + 1) 'Wscript.Echo Die20 Dice20 = Die20 Set Die20 = Nothing End Function

Error.Clear


Set die = Nothing