1

I am using Small Basic, and I am rather new to programming. Here are my subroutines:

Sub MoneyClasses
    If CurrentJob = "Cleaner" Then
        Money = Money + 1
    ElseIf CurrentJob = "Farmer" Then
        Money = Money + 3
    ElseIf CurrentJob = "Factory Worker" Then
        Money = Money + 5
    ElseIf CurrentJob = "Teacher" Then
        Money = Money + 10
    ElseIf CurrentJob = "Shopkeeper" Then
        Money = Money + 20
    ElseIf CurrentJob = "Doctor" Then
        Money = Money + 30
    ElseIf CurrentJob = "Soldier" Then
        Money = Money + 25
    ElseIf CurrentJob = "Officer" Then
        Money = Money + 45
    ElseIf CurrentJob = "General" Then
        Money = Money + 100
    ElseIf CurrentJob = "Supreme Leader" Then
        Money = Money + 10000
    EndIf
EndSub 

Sub Work1
    MoneyClasses()
    Energy = Energy - 10
EndSub

Sub Sleep1
    Energy = Energy + 10
    Money = Money - 1
EndSub

Sub Stats1
    TextWindow.WriteLine(" ")
    TextWindow.WriteLine("You have " + Energy +" Energy.")
    TextWindow.WriteLine("You have " + Money +" Won.")
    TextWindow.Write(" ")
    TextWindow.Read()
EndSub

Sub Menu
    TextWindow.WriteLine("Current Job = " + CurrentJob + "")
    TextWindow.WriteLine("Name = " + Name + "")
    TextWindow.WriteLine("1 - Work")
    TextWindow.WriteLine("2 - Sleep")
    TextWindow.WriteLine("3 - Show Stats")
    TextWindow.WriteLine(" ")
    TextWindow.Write("What to do?: ")
    PlayerInput = TextWindow.Read()
    TextWindow.Clear()
EndSub

Yeah, I have absolutely no idea what is wrong. It's probably a minor error. I should also mention that the game is not fully finished yet, and by that I mean that I am not even halfway done. Just making the "basics".

mkj
  • 2,761
  • 5
  • 24
  • 28
noaho
  • 19
  • 2

1 Answers1

0

"Press an key to continue" is the message that pops up when your program completes. My best guess is that after you call your subroutines the two times advertised your program is done. Without a looping mechanism to get the ball rolling, the program exits.

I would suggest placing a label at the top, before the sub-routine calls and a goto at the bottom jumping back up to top. Something like this:

top:
'Your Program code
Goto top 
codingCat
  • 2,396
  • 4
  • 21
  • 27