Microsoft Small Basic

Program Listing: PNK298
'(C) 2012 by JOman Mied. Comments throughout code!
GraphicsWindow.Title = "Text Challenge 2 - November 2012 (Graphic Version)"
GraphicsWindow.Width = 852
GraphicsWindow.Height = 500
GraphicsWindow.Top = 0
GraphicsWindow.Left = 0
i = 0

'GraphicsWindow Setup
GraphicsWindow.BackgroundColor = "darkblue"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.DrawText(0, 3, "Use the provided text-box to type your responses. Your answers will be saved and the textbox will be automatically cleared after 20 seconds.")
GraphicsWindow.DrawText(776, 488, "Version 1.25")
GraphicsWindow.BrushColor = "Black"
Resp = Controls.AddTextBox(339, 20)
GraphicsWindow.BrushColor = "White"
GraphicsWindow.DrawText(0, 40, "Questions will appear here:")

'First, a pause so the user can read the instructions, then the questions begin!
Program.Delay(20000)
'Question One
GraphicsWindow.DrawText(0, 60, "1. What is your name?")
Program.Delay(20000)
'You can find the subroutine at the end of this code
GetAnswer()
'Using the user's name, I ask question 2:
GraphicsWindow.DrawText(0, 80, "2. How are you today, " + Answer[1] + "? Available answers are: 'Great', 'Okay', or 'Bad'.")
Program.Delay(20000)
GetAnswer()
'Using the user's input for mood, I create different scenarios with the same question:
If Answer[2] = "Great" Or Answer[2] = "great" Then
GraphicsWindow.DrawText(0, 100, "3. You're feeling great? That's good to hear! Say, " + Answer[1] + ", what is your hobby?")
ElseIf Answer[2] = "Okay" Or Answer[2] = "okay" Then
GraphicsWindow.DrawText(0, 100, "3. You're feeling only 'okay'? What's your hobby? Maybe it'll cheer you up!")
ElseIf Answer[2] = "Bad" or Answer[2] = "bad" then
GraphicsWindow.DrawText(0, 100, "3. I am sorry to hear that, " + Answer[1] + "! Maybe your hobby will make you feel better. What is your hobby?")
EndIf
'Getting the answer for #3 (Burried in the If...ElseIf...EndIf statement.
Program.Delay(20000)
GetAnswer()
'Question 4:
GraphicsWindow.DrawText(0, 120, "4. So you like to " + Answer[3] + "? What time is it? (Format-> HH:MM AM/PM)")
Program.Delay(20000)
GetAnswer()
'Using time:
GraphicsWindow.DrawText(550, 120, "It is " + Answer[4] + ".")
'Question 5, using user's name again:
GraphicsWindow.DrawText(0, 140, "5. May I ask where you live, " + Answer[1] + "?")
Program.Delay(20000)
GetAnswer()
'Question 6, using user's answer to question 5:
GraphicsWindow.DrawText(0, 160, "6. You live in " + Answer[5] + "? Cool! Is that near the Canada-US border? (Yes or No)")
Program.Delay(20000)
GetAnswer()
'Using user's answer to q. 6 to make statements
If Answer[6] = "Yes" Or Answer[6] = "yes" Then
GraphicsWindow.DrawText(0, 180, "7. Good choice, " + Answer[1] + "! Do you want a summary of your answers? (Yes or No)")
CanUsBorder = "near the Canada-US border."
Program.Delay(20000)
ElseIf Answer[6] = "No" Or Answer[6] = "no" Then
GraphicsWindow.DrawText(0, 180, "7. Neat-o, " + Answer[1] + "! Do you want a summary of your answers? (Yes or No)")
CanUsBorder = "away from the Canada-US border."
Program.Delay(20000)
EndIf
'Get the answer for question 7 (hidden in the previous If...ElseIf...EndIf statement)(Summary: Yes or No).
GetAnswer()
If Answer[7] = "Yes" or Answer[7] = "yes" Then
GraphicsWindow.DrawText(0, 200, "Your Name is " + Answer[1] + " and you like to " + Answer[3] + ".")
GraphicsWindow.DrawText(0, 220, "It was " + Answer[4] + " and you live in/at " + Answer[5] + ", which is " + CanUsBorder + ".")
Program.Delay(20000)
ElseIf Answer[7] = "No" Or Answer[7] = "no" Then
GraphicsWindow.DrawText(0, 210, "Hmmmm... Well,")
Program.Delay(5000)
EndIf
GraphicsWindow.DrawText(0, 240, "Thank you for using this program! Ending in 10 seconds.")
Program.Delay(10000)
Program.End()

'My GetAnswer subroutine:
Sub GetAnswer
i = i + 1
Answer[i] = Controls.GetTextBoxText(Resp)
Controls.SetTextBoxText(Resp, "")
EndSub