Microsoft Small Basic

Program Listing: PZK052
GraphicsWindow.Title = "Text Challenge 2 - November 2012 (Graphic Version with Button)"
GraphicsWindow.Width = 728
GraphicsWindow.Height = 500
GraphicsWindow.Top = 0
GraphicsWindow.Left = 0
GraphicsWindow.CanResize = "False"

GraphicsWindow.BackgroundColor = "OrangeRed"
GraphicsWindow.BrushColor = "Black"
Resp = Controls.AddTextBox(189, 20)
Controls.SetSize(Resp, 300, 25)
GraphicsWindow.BrushColor = "Red"
Enter = Controls.AddButton("Enter", 489, 20)
Controls.SetSize(Enter, 50, 25)
GraphicsWindow.BrushColor = "White"
GraphicsWindow.DrawText(50, 1, "Use the provided text box to type in your answers then click the 'Enter' button to save and clear the box.")
GraphicsWindow.DrawText(0, 45, "Questions Appear Here:")
GraphicsWindow.DrawText(430, 45, "You Answered:")
GraphicsWindow.DrawText(0, 47, "________________________________________________________________________________________________")
GraphicsWindow.DrawText(0, 432, "________________________________________________________________________________________________")
GraphicsWindow.DrawText(0, 446, "**For your info, questions are not the same as in previous versions!**")
GraphicsWindow.DrawText(0, 460, "**Grammar may appear inadequate due to user responses.**")
GraphicsWindow.DrawText(0, 482, "Questions/visuals (C) Joman Mied. Source Code (C) NaochanON. Idea for challenge (C) LitDev &/Or respective owners.")
' 7 second delay so the user can read what's been put up on the screen (Instructions, Copyrights)
Program.Delay(7000)
Controls.ButtonClicked = OnButtonClick
question=1
Do_question()

Sub Do_question
If question =1 Then
GraphicsWindow.DrawText(0, 60, "1. Welcome, What is your name?")
Sound.PlayClick()
ElseIf Question= 2 then
GraphicsWindow.DrawText(430, 60, UserAns[1])
GraphicsWindow.DrawText(0, 80, "2. Hello, " + UserAns[1] + "! How are you? [Great, Good, or Bad]")
Sound.PlayClick()
elseif Question= 3 then
If UserAns[2] = "great" Or UserAns[2] = "Great" Then
GraphicsWindow.DrawText(0, 100, "3. That's awesome to hear!")
ElseIf UserAns[2] = "good" Or UserAns[2] = "Good" Then
GraphicsWindow.DrawText(0,100, "3. That's good to hear!")
ElseIf UserAns[2] = "bad" Or UserAns[2] = "Bad" Then
GraphicsWindow.DrawText(0,100, "3. I am sorry to hear that!")
Else
GraphicsWindow.DrawText(0,100, "3. Sorry! I don't follow?")
EndIf
GraphicsWindow.DrawText(430, 80, UserAns [2])
GraphicsWindow.DrawText(175, 100, "What is your hobby, " + UserAns[1] + "?")
Sound.PlayClick()
elseif question = 4 Then
GraphicsWindow.DrawText(430, 100, UserAns[3])
GraphicsWindow.DrawText(0, 120, "4. What city do you live in?")
Sound.PlayClick()
ElseIf question = 5 Then
GraphicsWindow.DrawText(430, 120, UserAns[4])
GraphicsWindow.DrawText(0, 140, "5. Cool! Besides " + UserAns[3] + ", ")
GraphicsWindow.DrawText(1, 152, "what is your favourite thing to do?")
Sound.PlayClick()
ElseIf question = 6 Then
GraphicsWindow.DrawText(430, 145, UserAns[5])
GraphicsWindow.DrawText(0, 170, "6. In what time zone is " + UserAns[4] + "?")
Sound.PlayClick()
ElseIf question = 7 Then
GraphicsWindow.DrawText(430, 170, UserAns[6])
GraphicsWindow.DrawText(0, 190, "7. Mac or Windows?")
Sound.PlayClick()
ElseIf question = 8 Then
GraphicsWindow.DrawText(430, 190, UserAns[7])
If UserAns[7] = "Mac" Or UserAns[7] = "mac" Then
GraphicsWindow.DrawText(150, 190, "Get a real computer!")
ElseIf UserAns[7] = "Windows" Or UserAns[7] = "windows" Then
GraphicsWindow.DrawText(150, 190, "I am so proud of you!")
EndIf
GraphicsWindow.DrawText(0, 210, "8. Out of [Small Basic, Visual Basic, C#, C++, or None],")
GraphicsWindow.DrawText(1, 222, "which do you know best?")
Sound.PlayClick()
ElseIf question = 9 Then
GraphicsWindow.DrawText(430, 215, UserAns[8])
GraphicsWindow.DrawText(0, 240, "9. You said you program in " + UserAns[8] + ",")
GraphicsWindow.DrawText(1, 252, "How difficult is it for you? [Easy, Medium, Hard]")
Sound.PlayClick()
ElseIf question = 10 Then
GraphicsWindow.DrawText(430, 245, UserAns[9])
If UserAns[9] = "easy" Or UserAns[9] = "Easy" Then
GraphicsWindow.DrawText(300, 245, "You're a pro!")
ElseIf UserAns[9] = "Medium" or UserAns[9] = "medium" then
GraphicsWindow.DrawText(300, 245, "Right on!")
ElseIf UserAns[9] = "Hard" or UserAns[9] = "hard" Then
GraphicsWindow.DrawText(300, 245, "It'll get easier!")
EndIf
GraphicsWindow.DrawText(0, 270, "10. Do you want your summary? [Yes, No]")
Sound.PlayClick()
ElseIf question = 11 Then
GraphicsWindow.DrawText(430, 270, UserAns[10])
Sound.PlayClick()
If UserAns[8] = "None" Or UserAns[8] = "none" then
UserAns[8] = "does not program."
Else
UserAns[8] = "programs in " + UserAns[8]
EndIf
If UserAns[10] = "Yes" Or UserAns[10] = "yes" then
GraphicsWindow.DrawText(10, 310, UserAns[1] + " feels " +UserAns[2]+". " + UserAns[1] +"'s hobby is " +UserAns[3]+".")
GraphicsWindow.DrawText(10, 332, UserAns[1] + " lives in " + UserAns[4] + " and enjoys " + UserAns[5] + ".")
GraphicsWindow.DrawText(10, 354, UserAns[4] + " is in the " + UserAns[6] + " time zone.")
GraphicsWindow.DrawText(10, 376, UserAns[1] + " likes " + UserAns[7] + " and " + UserAns[8])
GraphicsWindow.DrawText(100, 400, "****The End!****")
ElseIf UserAns[10] = "no" Or UserAns[10] = "No" Then

EndIf
endif
endsub

Sub OnButtonClick
UserAns[question] = Controls.GetTextBoxText(Resp)
Controls.SetTextBoxText(Resp, "")
question = question+1
Do_question()
EndSub