I would like to be able to make my Small Basics Program submit multiple votes

639 views Asked by At

So I am making a program with small basics and this is my code:

initialiseprogram()

Sub initialiseprogram
  GraphicsWindow.Show()
  GraphicsWindow.Clear()
  GraphicsWindow.FontBold = "True"
  GraphicsWindow.BrushColor = "Green"
  GraphicsWindow.BackgroundColor = "lightgreen"
  GraphicsWindow.Title = "Favorite Football Teams"
  GraphicsWindow.Width = "700"
  GraphicsWindow.CanResize = "false"
  GraphicsWindow.Height = "430"
  GraphicsWindow.FontSize = "20"
  GraphicsWindow.DrawText(50,55, "Please enter the names of five football teams.")
  GraphicsWindow.DrawText(230, 15, "Favorite Football Teams")
  GraphicsWindow.DrawText(230, 20, "___________________")
  ImageLoc = "H:\My Documents\banner-footballpitch.jpg"
  Image = ImageList.LoadImage(ImageLoc)
  GraphicsWindow.DrawImage(Image, 400, 100)  
  'team1:
  GraphicsWindow.DrawText(50, 105, "Team 1:")
  team1textbox = Controls.AddTextBox(180, 100)
  'team2:
  GraphicsWindow.DrawText(50, 155, "Team 2:")
  team2textbox = Controls.AddTextBox(180, 150)
  'team3:
  GraphicsWindow.DrawText(50, 205, "Team 3:")
  team3textbox = Controls.AddTextBox(180, 200)
  'team4:
  GraphicsWindow.DrawText(50, 255, "Team 4:")
  team4textbox = Controls.AddTextBox(180, 250)
  'team5:
  GraphicsWindow.DrawText(50, 305, "Team 5:")
  team5textbox = Controls.AddTextBox(180, 300)
  submitTeamNames = Controls.AddButton("Submit Teams", 460, 320)
  Controls.ButtonClicked = buttonclickedfunction
EndSub

Sub buttonclickedfunction
    If (Controls.LastClickedButton = submitTeamNames) Then
    'team 1:
    team1name = Controls.GetTextBoxText(team1textbox)
    'team 2:
    team2name = Controls.GetTextBoxText(team2textbox)
    'team 3:
    team3name = Controls.GetTextBoxText(team3textbox)
    'team 4:
    team4name = Controls.GetTextBoxText(team4textbox)
    'team 5:
    team5name = Controls.GetTextBoxText(team5textbox)
    If Text.GetLength(team1name) = 0 Then
      GraphicsWindow.ShowMessage("You must enter a team name for team 1", "Alert")
    ElseIf Text.GetLength(team2name) = 0 Then
      GraphicsWindow.ShowMessage("You must enter a team name for team 2", "Alert")
    ElseIf Text.GetLength(team3name) = 0 Then
      GraphicsWindow.ShowMessage("You must enter a team name for team 3", "Alert")
    ElseIf Text.GetLength(team4name) = 0 Then
      GraphicsWindow.ShowMessage("You must enter a team name for team 4", "Alert")
    ElseIf Text.GetLength(team5name) = 0 Then 
      GraphicsWindow.ShowMessage("You must enter a team name for team 5", "Alert")
    Else
      GraphicsWindow.Clear()
      ImageLoc = "H:\My Documents\banner-footballpitch.jpg"
      Image = ImageList.LoadImage(ImageLoc)
      GraphicsWindow.DrawImage(Image, 400, 100)  
      'Drawing team 1 name on next slide
      GraphicsWindow.DrawBoundText(50,105, 265 team1name + ":")
      'Drawing team 2 name on next slide
      GraphicsWindow.DrawBoundText(50,155, 265 team2name + ":")
      'Drawing team 3 name on next slide
      GraphicsWindow.DrawBoundText(50,205, 265 team3name + ":")
      'Drawing team 4 name on next slide
      GraphicsWindow.DrawBoundText(50,255, 265 team4name + ":")
      'Drawing team 5 name on next slide
      GraphicsWindow.DrawBoundText(50,305, 265 team5name + ":")
      initialisenextslide()

    EndIf
  EndIf  
EndSub

Sub initialisenextslide
  GraphicsWindow.DrawText(230, 15, "Favourite Football Teams")
  GraphicsWindow.DrawText(230, 20, "____________________")
  GraphicsWindow.DrawBoundText(50,45, 640, "Please order your teams in preference, 1 being the favourite and 5 the least favourite")
  'team 1 text box
  team1NewTextBox = Controls.AddTextBox(306, 100)
  Controls.SetSize(team1NewTextBox, 35, 32)
  'team 2 text box
  team2NewTextBox = Controls.AddTextBox(306, 150)
  Controls.SetSize(team2NewTextBox, 35, 32)
  'team 3 text box
  team3NewTextBox = Controls.AddTextBox(306, 200)
  Controls.SetSize(team3NewTextBox, 35, 32)
  'team 4 text box
  team4NewTextBox = Controls.AddTextBox(306, 250)
  Controls.SetSize(team4NewTextBox, 35, 32)
  'team 5 text box
  team5NewTextBox = Controls.AddTextBox(306, 300)
  Controls.SetSize(team5NewTextBox, 35, 32)
  'Adding Submit Button
  ResultsButton = Controls.AddButton("Submit Preferences", 460,320)
  Controls.ButtonClicked = resultsSlideSub
EndSub

Sub resultsSlideSub
  If (Controls.LastClickedButton = ResultsButton) Then
    'team 1:
    t1vote = Controls.GetTextBoxText(team1NewTextBox)
    'team 2:
    t2vote = Controls.GetTextBoxText(team2NewTextBox)
    'team 3:
    t3vote = Controls.GetTextBoxText(team3NewTextBox)
    'team 4:
    t4vote = Controls.GetTextBoxText(team4NewTextBox)
    'team 5:
    t5vote = Controls.GetTextBoxText(team5NewTextBox)
    If Text.GetLength(t1vote) = 0 or Text.GetLength(t1vote) >= 2 Then
      GraphicsWindow.ShowMessage("Team 1: You can only input one number for your preference.", "Alert")
    ElseIf Text.GetLength(t2vote) = 0 or Text.GetLength(t2vote) >= 2 Then
      GraphicsWindow.ShowMessage("Team 2: You can only input one number for your preference.", "Alert")
    ElseIf Text.GetLength(t3vote) = 0 or Text.GetLength(t3vote) >= 2 Then
      GraphicsWindow.ShowMessage("Team 3: You can only input one number for your preference.", "Alert")
    ElseIf Text.GetLength(t4vote) = 0 or Text.GetLength(t4vote) >= 2 Then
      GraphicsWindow.ShowMessage("Team 4: You can only input one number for your preference.", "Alert")
    ElseIf Text.GetLength(t5vote) = 0 or Text.GetLength(t5vote) >= 2 Then 
      GraphicsWindow.ShowMessage("Team 5: You can only input one number for your preference.", "Alert")
    Else
      InitialiseVerification()
    EndIf
  Endif
EndSub

Sub InitialiseVerification
  If (t1vote + t2vote + t3vote + t4vote + t5vote = 15) Then
    If (t1vote = t2vote Or t1vote = t3vote Or t1vote = t4vote Or t1vote = t5vote) Then
      GraphicsWindow.ShowMessage("Please make sure you haven't repeated any numbers for each team.", "Alert")
    ElseIf (t2vote = t1vote Or t2vote = t3vote Or t2vote = t4vote Or t2vote = t5vote) Then
      GraphicsWindow.ShowMessage("Please make sure you haven't repeated any numbers for each team.", "Alert")
    Elseif (t3vote = t1vote Or t3vote = t2vote Or t3vote = t4vote Or t3vote = t5vote) Then
      GraphicsWindow.ShowMessage("Please make sure you haven't repeated any numbers for each team.", "Alert")
    Elseif (t4vote = t1vote Or t4vote = t2vote Or t4vote = t3vote Or t4vote = t5vote) Then
      GraphicsWindow.ShowMessage("Please make sure you haven't repeated any numbers for each team.", "Alert")
    Elseif (t5vote = t1vote Or t5vote = t2vote Or t5vote = t3vote Or t5vote = t4vote) Then
      GraphicsWindow.ShowMessage("Please make sure you haven't repeated any numbers for each team.", "Alert")
    Else 
      InitialiseVerificationStage2()
    EndIf
  Else 
    GraphicsWindow.ShowMessage("Please make sure you haven't entered the same rank twice.", "Alert")
  EndIf
EndSub

Sub InitialiseVerificationStage2
  If (t1vote = 1 Or t1vote = 2 Or t1vote = 3 Or t1vote = 4 Or t1vote = 5) Then
    If (t2vote = 1 Or t2vote = 2 Or t2vote = 3 Or t2vote = 4 Or t2vote = 5) Then
      If (t3vote = 1 Or t3vote = 2 Or t3vote = 3 Or t3vote = 4 Or t3vote = 5) Then
        If (t4vote = 1 Or t4vote = 2 Or t4vote = 3 Or t4vote = 4 Or t4vote = 5) Then
          If (t5vote = 1 Or t5vote = 2 Or t5vote = 3 Or t5vote = 4 Or t5vote = 5) Then
            InitialiseResultsSlide()
          Else
            GraphicsWindow.ShowMessage("Your preferences must only consist of a number between 1 and 5", "Alert")
          EndIf
        EndIf
      EndIf
    EndIf
  EndIf

EndSub


Sub InitialiseResultsSlide
  GraphicsWindow.Clear()
  GraphicsWindow.DrawText(230, 15, "Favourite Football Teams")
  GraphicsWindow.DrawText(230, 20, "____________________")
  ImageLoc = "H:\My Documents\banner-footballpitch.jpg"
  Image = ImageList.LoadImage(ImageLoc)
  GraphicsWindow.DrawImage(Image, 400, 100)  
  GraphicsWindow.DrawBoundText(50,60, 640, "Results Table")
  GraphicsWindow.DrawBoundText(50,175, 640, "Overall: ")
  GraphicsWindow.DrawText(50, 65, "____________________")
  GraphicsWindow.DrawText(50, 180, "____________________")
  'Displaying votes
  If (t1vote > t2vote and t1vote > t3vote and t1vote > t4vote and t1vote > t5vote) then
    preferedTeam = team1name
    preferedTeamVotes = t1vote
  ElseIf (t2vote > t1vote and t2vote > t3vote and t2vote > t4vote and t2vote > t5vote) then
    preferedTeam = team2name
    preferedTeamVotes = t2vote
  ElseIf (t3vote > t1vote and t3vote > t2vote and t3vote > t4vote and t3vote > t5vote) then
    preferedTeam = team3name
    preferedTeamVotes = t3vote
  ElseIf (t4vote > t1vote and t4vote > t2vote and t4vote > t3vote and t4vote > t5vote) then
    preferedTeam = team4name
    preferedTeamVotes = t4vote
  ElseIf (t5vote > t1vote and t5vote > t2vote and t5vote > t3vote and t5vote > t4vote) then
    preferedTeam = team5name
    preferedTeamVotes = t5vote
  EndIf
  GraphicsWindow.DrawBoundText(50,100, 350, "The preffered football team was " + preferedTeam + " which achieved " + preferedTeamVotes + " votes!")
  drawOverallTable()
EndSub

Sub drawOverallTable
  If (t1vote = 1) Then
    GraphicsWindow.DrawBoundText(50,210, 350, "Team 1: " + t1vote + " vote")
  Else 
    GraphicsWindow.DrawBoundText(50,210, 350, "Team 1: " + t1vote + " votes")
  EndIf
  If (t2vote = 1) Then
    GraphicsWindow.DrawBoundText(50,240, 350, "Team 2: " + t1vote + " vote")
  Else 
    GraphicsWindow.DrawBoundText(50,240, 350, "Team 2: " + t1vote + " votes")
  EndIf
  If (t3vote = 1) Then
    GraphicsWindow.DrawBoundText(50,270, 350, "Team 3: " + t1vote + " vote")
  Else 
    GraphicsWindow.DrawBoundText(50,270, 350, "Team 3: " + t1vote + " votes")
  EndIf
  If (t4vote = 1) Then
    GraphicsWindow.DrawBoundText(50,300, 350, "Team 4: " + t1vote + " vote")
  Else 
    GraphicsWindow.DrawBoundText(50,300, 350, "Team 4: " + t1vote + " votes")
  EndIf
  If (t5vote = 1) Then
    GraphicsWindow.DrawBoundText(50,330, 350, "Team 5: " + t1vote + " vote")
  Else 
    GraphicsWindow.DrawBoundText(50,330, 350, "Team 5: " + t1vote + " votes")
  EndIf
  RestartButton = Controls.AddButton("Restart", 520,320)
  controls.ButtonClicked = restartButtonSub
EndSub
Sub restartButtonSub
  If (Controls.LastClickedButton = RestartButton) Then
    initialiseprogram()
  EndIf
EndSub

At the moment it works. However, in virtue of my latter knowledge to Small Basics, I have been boggling my brains on how I could make a button on the second slide, that submits the current votes and loads the page again, without going on the next time.

This may not be clear, so I'll start again.

I know how to make a button. But on the second slide, which you submit your rankings, I want another button (as well as the "SubmitPreferences" button) that submits the current ranks, so you can type in more than 1 set of rankings. Then when you are ready, you click the submit preferences button and it goes to the final screen (the results screen).

Thank you. I was told it was only one thing that I need to put in, but they wouldn't succour me further.

1

There are 1 answers

10
Diego López On BEST ANSWER

I checked out your code and came up with this solution, that involves using 5 global variables (A global variable is accessible and modifiable through all the program), adding a second button "Vote button" that sums the textboxes values to these global variables, and changing the behavior of the existing button to only display the results.

    initialiseprogram()

Sub initialiseprogram
  'global variables
  globalTeam1Score = 0
  globalTeam2Score = 0
  globalTeam3Score = 0
  globalTeam4Score = 0
  globalTeam5Score = 0
  'in case nobody votes or all votes are the same
  preferedTeam = "(tie)" 
  preferedTeamVotes = 0

  GraphicsWindow.Show()
  GraphicsWindow.Clear()
  GraphicsWindow.FontBold = "True"
  GraphicsWindow.BrushColor = "Green"
  GraphicsWindow.BackgroundColor = "lightgreen"
  GraphicsWindow.Title = "Favorite Football Teams"
  GraphicsWindow.Width = "700"
  GraphicsWindow.CanResize = "false"
  GraphicsWindow.Height = "430"
  GraphicsWindow.FontSize = "20"
  GraphicsWindow.DrawText(50,55, "Please enter the names of five football teams.")
  GraphicsWindow.DrawText(230, 15, "Favorite Football Teams")
  GraphicsWindow.DrawText(230, 20, "___________________")
  ImageLoc = "H:\My Documents\banner-footballpitch.jpg"
  Image = ImageList.LoadImage(ImageLoc)
  GraphicsWindow.DrawImage(Image, 400, 100)  
  'team1:
  GraphicsWindow.DrawText(50, 105, "Team 1:")
  team1textbox = Controls.AddTextBox(180, 100)
  'team2:
  GraphicsWindow.DrawText(50, 155, "Team 2:")
  team2textbox = Controls.AddTextBox(180, 150)
  'team3:
  GraphicsWindow.DrawText(50, 205, "Team 3:")
  team3textbox = Controls.AddTextBox(180, 200)
  'team4:
  GraphicsWindow.DrawText(50, 255, "Team 4:")
  team4textbox = Controls.AddTextBox(180, 250)
  'team5:
  GraphicsWindow.DrawText(50, 305, "Team 5:")
  team5textbox = Controls.AddTextBox(180, 300)
  submitTeamNames = Controls.AddButton("Submit Teams", 460, 320)
  Controls.ButtonClicked = buttonclickedfunction
EndSub

Sub buttonclickedfunction
    If (Controls.LastClickedButton = submitTeamNames) Then
    'team 1:
    team1name = Controls.GetTextBoxText(team1textbox)
    'team 2:
    team2name = Controls.GetTextBoxText(team2textbox)
    'team 3:
    team3name = Controls.GetTextBoxText(team3textbox)
    'team 4:
    team4name = Controls.GetTextBoxText(team4textbox)
    'team 5:
    team5name = Controls.GetTextBoxText(team5textbox)
    If Text.GetLength(team1name) = 0 Then
      GraphicsWindow.ShowMessage("You must enter a team name for team 1", "Alert")
    ElseIf Text.GetLength(team2name) = 0 Then
      GraphicsWindow.ShowMessage("You must enter a team name for team 2", "Alert")
    ElseIf Text.GetLength(team3name) = 0 Then
      GraphicsWindow.ShowMessage("You must enter a team name for team 3", "Alert")
    ElseIf Text.GetLength(team4name) = 0 Then
      GraphicsWindow.ShowMessage("You must enter a team name for team 4", "Alert")
    ElseIf Text.GetLength(team5name) = 0 Then 
      GraphicsWindow.ShowMessage("You must enter a team name for team 5", "Alert")
    Else
      GraphicsWindow.Clear()
      ImageLoc = "H:\My Documents\banner-footballpitch.jpg"
      Image = ImageList.LoadImage(ImageLoc)
      GraphicsWindow.DrawImage(Image, 400, 100)  
      'Drawing team 1 name on next slide
      GraphicsWindow.DrawBoundText(50,105, 265 team1name + ":")
      'Drawing team 2 name on next slide
      GraphicsWindow.DrawBoundText(50,155, 265 team2name + ":")
      'Drawing team 3 name on next slide
      GraphicsWindow.DrawBoundText(50,205, 265 team3name + ":")
      'Drawing team 4 name on next slide
      GraphicsWindow.DrawBoundText(50,255, 265 team4name + ":")
      'Drawing team 5 name on next slide
      GraphicsWindow.DrawBoundText(50,305, 265 team5name + ":")
      initialisenextslide()

    EndIf
  EndIf  
EndSub

Sub initialisenextslide
  GraphicsWindow.DrawText(230, 15, "Favourite Football Teams")
  GraphicsWindow.DrawText(230, 20, "____________________")
  GraphicsWindow.DrawBoundText(50,45, 640, "Please order your teams in preference, 1 being the favourite and 5 the least favourite")
  'team 1 text box
  team1NewTextBox = Controls.AddTextBox(306, 100)
  Controls.SetSize(team1NewTextBox, 35, 32)
  'team 2 text box
  team2NewTextBox = Controls.AddTextBox(306, 150)
  Controls.SetSize(team2NewTextBox, 35, 32)
  'team 3 text box
  team3NewTextBox = Controls.AddTextBox(306, 200)
  Controls.SetSize(team3NewTextBox, 35, 32)
  'team 4 text box
  team4NewTextBox = Controls.AddTextBox(306, 250)
  Controls.SetSize(team4NewTextBox, 35, 32)
  'team 5 text box
  team5NewTextBox = Controls.AddTextBox(306, 300)
  Controls.SetSize(team5NewTextBox, 35, 32)
  'Adding Vote again
  VoteAgainButton = Controls.AddButton("Vote!", 460,280)
  'Adding Submit Button
  ResultsButton = Controls.AddButton("See Results", 460,320)
  Controls.HideControl(ResultsButton)
  Controls.ButtonClicked = resultsSlideSub
EndSub


Sub resultsSlideSub
  'Check if Votes will be added or just jump to results
  If (Controls.LastClickedButton = VoteAgainButton Or Controls.LastClickedButton = ResultsButton) Then
    Controls.ShowControl(ResultsButton)
    'team 1:
    t1vote = Controls.GetTextBoxText(team1NewTextBox)
    'team 2:
    t2vote = Controls.GetTextBoxText(team2NewTextBox)
    'team 3:
    t3vote = Controls.GetTextBoxText(team3NewTextBox)
    'team 4:
    t4vote = Controls.GetTextBoxText(team4NewTextBox)
    'team 5:
    t5vote = Controls.GetTextBoxText(team5NewTextBox)
    If Text.GetLength(t1vote) = 0 or Text.GetLength(t1vote) >= 2 Then
      GraphicsWindow.ShowMessage("Team 1: You can only input one number for your preference.", "Alert")
    ElseIf Text.GetLength(t2vote) = 0 or Text.GetLength(t2vote) >= 2 Then
      GraphicsWindow.ShowMessage("Team 2: You can only input one number for your preference.", "Alert")
    ElseIf Text.GetLength(t3vote) = 0 or Text.GetLength(t3vote) >= 2 Then
      GraphicsWindow.ShowMessage("Team 3: You can only input one number for your preference.", "Alert")
    ElseIf Text.GetLength(t4vote) = 0 or Text.GetLength(t4vote) >= 2 Then
      GraphicsWindow.ShowMessage("Team 4: You can only input one number for your preference.", "Alert")
    ElseIf Text.GetLength(t5vote) = 0 or Text.GetLength(t5vote) >= 2 Then 
      GraphicsWindow.ShowMessage("Team 5: You can only input one number for your preference.", "Alert")
    Else
      InitialiseVerification()
    EndIf
  Endif
EndSub

Sub InitialiseVerification
  If (t1vote + t2vote + t3vote + t4vote + t5vote = 15) Then
    If (t1vote = t2vote Or t1vote = t3vote Or t1vote = t4vote Or t1vote = t5vote) Then
      GraphicsWindow.ShowMessage("Please make sure you haven't repeated any numbers for each team.", "Alert")
    ElseIf (t2vote = t1vote Or t2vote = t3vote Or t2vote = t4vote Or t2vote = t5vote) Then
      GraphicsWindow.ShowMessage("Please make sure you haven't repeated any numbers for each team.", "Alert")
    Elseif (t3vote = t1vote Or t3vote = t2vote Or t3vote = t4vote Or t3vote = t5vote) Then
      GraphicsWindow.ShowMessage("Please make sure you haven't repeated any numbers for each team.", "Alert")
    Elseif (t4vote = t1vote Or t4vote = t2vote Or t4vote = t3vote Or t4vote = t5vote) Then
      GraphicsWindow.ShowMessage("Please make sure you haven't repeated any numbers for each team.", "Alert")
    Elseif (t5vote = t1vote Or t5vote = t2vote Or t5vote = t3vote Or t5vote = t4vote) Then
      GraphicsWindow.ShowMessage("Please make sure you haven't repeated any numbers for each team.", "Alert")
    Else 
      InitialiseVerificationStage2()
    EndIf
  Else 
    GraphicsWindow.ShowMessage("Please make sure you haven't entered the same rank twice.", "Alert")
  EndIf
EndSub

Sub InitialiseVerificationStage2
  If (t1vote = 1 Or t1vote = 2 Or t1vote = 3 Or t1vote = 4 Or t1vote = 5) Then
    If (t2vote = 1 Or t2vote = 2 Or t2vote = 3 Or t2vote = 4 Or t2vote = 5) Then
      If (t3vote = 1 Or t3vote = 2 Or t3vote = 3 Or t3vote = 4 Or t3vote = 5) Then
        If (t4vote = 1 Or t4vote = 2 Or t4vote = 3 Or t4vote = 4 Or t4vote = 5) Then
          If (t5vote = 1 Or t5vote = 2 Or t5vote = 3 Or t5vote = 4 Or t5vote = 5) Then
              globalTeam1Score = globalTeam1Score + t1vote
              globalTeam2Score = globalTeam2Score + t2vote
              globalTeam3Score = globalTeam3Score + t3vote
              globalTeam4Score = globalTeam4Score + t4vote
              globalTeam5Score = globalTeam5Score + t5vote
             If (Controls.LastClickedButton = VoteAgainButton) Then
               VoteAgain()
               GraphicsWindow.ShowMessage("Thanks for your vote!","Alert")
             ElseIf  (Controls.LastClickedButton = ResultsButton) Then
               InitialiseResultsSlide()
             EndIf

          Else
            GraphicsWindow.ShowMessage("Your preferences must only consist of a number between 1 and 5", "Alert")
          EndIf
        EndIf
      EndIf
    EndIf
  EndIf
EndSub

Sub VoteAgain
  Controls.SetTextBoxText(team1NewTextBox,"")
  Controls.SetTextBoxText(team2NewTextBox,"")
  Controls.SetTextBoxText(team3NewTextBox,"")
  Controls.SetTextBoxText(team4NewTextBox,"")
  Controls.SetTextBoxText(team5NewTextBox,"")
EndSub

Sub InitialiseResultsSlide
  GraphicsWindow.Clear()
  GraphicsWindow.DrawText(230, 15, "Favourite Football Teams")
  GraphicsWindow.DrawText(230, 20, "____________________")
  ImageLoc = "H:\My Documents\banner-footballpitch.jpg"
  Image = ImageList.LoadImage(ImageLoc)
  GraphicsWindow.DrawImage(Image, 400, 100)  
  GraphicsWindow.DrawBoundText(50,60, 640, "Results Table")
  GraphicsWindow.DrawBoundText(50,175, 640, "Overall: ")
  GraphicsWindow.DrawText(50, 65, "____________________")
  GraphicsWindow.DrawText(50, 180, "____________________")
  'Displaying votes
  If (globalTeam1Score > globalTeam2Score and globalTeam1Score > globalTeam3Score and globalTeam1Score > globalTeam4Score and globalTeam1Score > globalTeam5Score) then
    preferedTeam = team1name
    preferedTeamVotes = globalTeam1Score
  ElseIf (globalTeam2Score > globalTeam1Score and globalTeam2Score > globalTeam3Score and globalTeam2Score > globalTeam4Score and globalTeam2Score > globalTeam5Score) then
    preferedTeam = team2name
    preferedTeamVotes = globalTeam2Score
  ElseIf (globalTeam3Score > globalTeam1Score and globalTeam3Score > globalTeam2Score and globalTeam3Score > globalTeam4Score and globalTeam3Score > globalTeam5Score) then
    preferedTeam = team3name
    preferedTeamVotes = globalTeam3Score
  ElseIf (globalTeam4Score > globalTeam1Score and globalTeam4Score > globalTeam2Score and globalTeam4Score > globalTeam3Score and globalTeam4Score > globalTeam5Score) then
    preferedTeam = team4name
    preferedTeamVotes = globalTeam4Score
  ElseIf (globalTeam5Score > globalTeam1Score and globalTeam5Score > globalTeam2Score and globalTeam5Score > globalTeam3Score and globalTeam5Score > globalTeam4Score) then
    preferedTeam = team5name
    preferedTeamVotes = globalTeam5Score
  EndIf
  GraphicsWindow.DrawBoundText(50,100, 350, "The preffered football team was " + preferedTeam + " which achieved " + preferedTeamVotes + " votes!")
  drawOverallTable()
EndSub

Sub drawOverallTable

  If (globalTeam1Score = 1) Then
    GraphicsWindow.DrawBoundText(50,210, 350, "Team 1: " + globalTeam1Score + " vote")
  Else 
    GraphicsWindow.DrawBoundText(50,210, 350, "Team 1: " + globalTeam1Score + " votes")
  EndIf
  If (globalTeam2Score = 1) Then
    GraphicsWindow.DrawBoundText(50,240, 350, "Team 2: " + globalTeam2Score + " vote")
  Else 
    GraphicsWindow.DrawBoundText(50,240, 350, "Team 2: " + globalTeam2Score + " votes")
  EndIf
  If (globalTeam3Score = 1) Then
    GraphicsWindow.DrawBoundText(50,270, 350, "Team 3: " + globalTeam3Score + " vote")
  Else 
    GraphicsWindow.DrawBoundText(50,270, 350, "Team 3: " + globalTeam3Score + " votes")
  EndIf
  If (globalTeam4Score = 1) Then
    GraphicsWindow.DrawBoundText(50,300, 350, "Team 4: " + globalTeam4Score + " vote")
  Else 
    GraphicsWindow.DrawBoundText(50,300, 350, "Team 4: " + globalTeam4Score + " votes")
  EndIf
  If (globalTeam5Score = 1) Then
    GraphicsWindow.DrawBoundText(50,330, 350, "Team 5: " + globalTeam5Score + " vote")
  Else 
    GraphicsWindow.DrawBoundText(50,330, 350, "Team 5: " + globalTeam5Score + " votes")
  EndIf
  RestartButton = Controls.AddButton("Restart", 520,320)
  controls.ButtonClicked = restartButtonSub
EndSub
Sub restartButtonSub
  If (Controls.LastClickedButton = RestartButton) Then
    initialiseprogram()
  EndIf
EndSub

Try this out and let me know if you have questions.