Homework
Here's one way of doing it. since the class seemed to be about types I used a type. XD
Option Explicit
Randomize Timer
screen 17
'screenres 640,480,24,1,1
Type charTP
nm As String ' name
ra As String ' race
cl As String ' class
hp As Integer ' hit points
mh As Integer ' max hit points
mp As Integer ' magic points
mm As Integer ' max magic points
st As Integer ' strength
dx As Integer ' dexterity
it As Integer ' intelligence
End Type
Type extraPT
mh As Integer ' max hit points
mp As Integer ' magic points
mm As Integer ' max magic points
st As Integer ' strength
dx As Integer ' dexterity
it As Integer ' intelligence
End type
Type extraSAY
mh As String ' max hit points
mp As String ' magic points
mm As String ' max magic points
st As String ' strength
dx As String ' dexterity
it As String ' intelligence
End type
Dim extra As extraPT
Dim player As charTP
Dim say as extraSAY
Dim choice As String
Do
Cls
Print "Character Generation" : Print
Print "What is your name?"
Input " > ", choice
Loop Until len(choice) > 0
player.nm = choice
Do
Cls
Print "Character Generation" : Print
Print "Name : " ; player.nm : Print
Print "1. Human."
Print "2. Elf."
Print "3. Dwarf."
Print : Print "Pick a race : ( 1 to 3 )"
Input " > ", choice
Loop Until choice >= "1" And choice <= "3"
If choice = "1" Then
player.ra = "Human"
extra.mh = 0
extra.mm = 0
extra.st = 2
extra.it = 2
extra.dx = 2
endif
If choice = "2" Then
player.ra = "Elf"
extra.mh = 0
extra.mm = 0
extra.st = 0
extra.it = 3
extra.dx = 3
endif
If choice = "3" Then
player.ra = "Dwarf"
extra.mh = 1
extra.mm = 2
extra.st = 3
extra.it = 0
extra.dx = 0
endif
Do
Cls
Print "Character Generation" : Print
Print "Name : " ; player.nm
Print "Race : " ; player.ra : Print
Print "1. Fighter."
Print "2. Mage."
Print "3. Thief."
Print : Print "Pick a class : ( 1 to 3 )"
Input " > ", choice
Loop Until choice >= "1" And choice <= "3"
If choice = "1" Then
player.cl = "Fighter"
extra.mh += 3
extra.mm += 1
extra.st += 4
extra.it += 1
extra.dx += 2
endif
If choice = "2" Then
player.cl = "Mage"
extra.mh += 1
extra.mm += 4
extra.st += 1
extra.it += 3
extra.dx+ = 2
endif
If choice = "3" Then
player.cl = "Thief"
extra.mh += 1
extra.mm += 2
extra.st += 2
extra.it += 2
extra.dx += 4
endif
Do
player.mh = Int(Rnd(1)*20)+20
player.mm = Int(Rnd(1)*20)+20
player.st = Int(Rnd(1)*20)+20
player.it = Int(Rnd(1)*20)+20
player.dx = Int(Rnd(1)*20)+20
Cls
Print "Character Generation" : Print
Print "Name : " ; player.nm
Print "Race : " ; player.ra
Print "Class : " ; player.cl : Print
Print "Your stats are :"
Print "Hit Points : " ; player.mh; " +";extra.mh; "("; player.mh + extra.mh; " )"
Print "Magic Points : " ; player.mm; " +";extra.mm; "("; player.mm + extra.mm; " )"
Print "Strength : " ; player.st; " +";extra.st; "("; player.st + extra.st; " )"
Print "Dexterity : " ; player.dx; " +";extra.dx; "("; player.dx + extra.dx; " )"
Print "Intelligence : " ; player.it; " +";extra.it; "("; player.it + extra.it; " )"
Print : Print "Press a key to re-roll."
Print "Press k to keep."
Input " > ", choice
Loop Until LCase(choice) = "k"
player.mh += extra.mh
player.mm += extra.mm
player.st += extra.st
player.it += extra.it
player.dx += extra.dx
Cls
Sleep 1000, 1
? ""
? "Prepare to enter the dungeon."
? ""
Sleep 1500, 1
? " Thanks for trying this sample."
sleep 2000, 1
? ""
? " Perhaps this will become a game, who knows."
sleep 2500, 1
? ""
? " See you, hehe."
sleep 1500, 1
? " Press a key to exit."
while inkey = "":wend
End