Code: Select all
Type Player
Str as Integer
Int as Integer
Chr as Integer
Rel as Integer
End Type
Type Npc
Str as Integer
Int as Integer
Chr as Integer
Rel as Integer
End Type
Code: Select all
Public Sub Player_Creation
Dim MainChar as Player
Randomize
MainChar.Str = Int(Rnd*4)+1
MainChar.Int = Int(Rnd*4)+1
MainChar.Chr = Int(Rnd*4)+1
MainChar.Rel = Int(Rnd*4)+1
Print "These are your stats:"
Print "Strength:" + " " + Str(MainChar.Str)
Print "Intelligence:" + " " + Str(MainChar.Int)
Print "Charisma:" + " " + Str(MainChar.Chr)
Print "Relationship:" + " " + Str(MainChar.Rel)
End Sub
I want the user to be able to reference these values so that they can choose options that increase the values to be able to access special text options in the game.
I want to make a sub like this:
Code: Select all
Sub PlayerStats
Print "These are your stats:"
Print "Strength:" + " " + Str(MainChar.Str)
Print "Intelligence:" + " " + Str(MainChar.Int)
Print "Charisma:" + " " + Str(MainChar.Chr)
Print "Relationship:" + " " + Str(MainChar.Rel)
Sleep
End Sub
I want to know how I can do this.
I am aware that I have to Declare all subs and Dim all variables before use in my code. Let's assume I have already done this.
I am trying to teach myself how to code in BASIC. So please try to keep your answers simple, or at least try to explain in small chunks of code so I can understand better.