Posted: 4th Feb 2022 16:58
Hi,

I can't figure out why the program runs fine until my DifficultyLevel #Include file. It opens it and shows the menu on screen for about a half second and moves on to the next menu. I don't have any variables being saved yet, just getting button detection working for now. The only league button thatcurrently has anything after it is the "English" league.

List of code is in order of use
Main code source
+ Code Snippet
// intro screen menu #includes in order of use
#Include "DisplaySettings.agc"
#Include "SplashScreen.agc"
#Include "PlayerNumberSelection.agc"
#Include "EnterSirName.agc"
#Include "SelectLeague.agc"
#Include "SelectTeam.agc"
#Include "DifficultyLevel.agc"

// includes used during game play
#Include "TeamRoster.agc"
#Include "ShortList.agc"
#Include "FootballField.agc"

SetErrorMode(2)
SetSyncRate(60, 0)
SetErrorMode(2)

SBL = GetScreenBoundsLeft()
SBT = GetScreenBoundsTop()
SBR = GetScreenBoundsRight()
SBB = GetScreenBoundsBottom()

MdeviceW = GetMaxDeviceWidth()             // get the device width
MdeviceH = GetMaxDeviceHeight()           // get the device height

#constant False = 0
#constant True = 1

// GLOBALS VARIABLES--------------------------------------------------------------------------------------------------
Global SBL, SBT, SBR, SBB         // SBL = screen bounds left, SBT = screen bounds top, SBR = screen bounds right, SBB = screen bounds bottom
Global DeviceW, DeviceH                 // DW = device width, DH = device height, TW = text width
Global MdeviceW, MdeviceH
Global VwinW, VwinH

Global TextW

// user input
Global text$

// Select league 
Global League$, English$, French$, German$, Italian$, Scottish$, Spanish$, Dutch$

Global Account_Name$, Game_Level$, Account_Num_Players            // user (player name and game level(meaning manager or coach)

// team

Global Team_Name$, Pos_Num$

Global Sort_Plyrs, Plyr_1$, Plyr_2$

Global Reserves

Global T_Wallet#

//-------------------------------------------------------------------------------------------------------------------------------
Global Plyr_PosX#, Plyr_PosY#, Plyr_PosZ# // player location on field


LoadFont(1, "nevis.ttf")

SplashScreen()

PlayerNumberSelection()

EnterSirName()

SelectLeague()

SelectTeam()

DifficultyLevel()

TeamRoster()

ShortList()

GameField()

do 
	
	Print( ScreenFPS() ) // PRINT FPS( SCREEN UPDATE FRAMES PER SECOND)
        
    Sync()             // SYNC THE SCREEN
    
loop


Splash Screen #Include
+ Code Snippet
// SPLASH SCREEN FUNCTION--------------------------------------------

Function SplashScreen()           // splash screen function starts here
	
	SetScreen()
		
	LoadImage(1, "UFM.png")
	
	CreateSprite(1, 1)
	SetSpritePosition(1, 0, 0)
	SetSpriteSize(1, 1024, 768)
	`SetImageMinFilter(1, 0)
	`SetImageMagFilter(1, 0)
    
    Timer# = Timer()                                   // set timer variable
        Repeat                                        // start repeat until loop
			
			Sync()               // sync or refresh the screen
        Until Timer# + 5 <= Timer()     // end of the repeat until loop

ResetTimer()     // reset the timer to 0

DeleteSprite(1)    // delete sprite 1
DeleteImage(1)    // delete splash screen image	

EndFunction       // end of the function


Player Number Selection #Include
+ Code Snippet
// NUMBER OF PLAYERS SELECTION SCREEN FUNCTION-----------------------------------------

 Function PlayerNumberSelection()           // player number selection function
	SetScreen()
	
	WinW = GetWindowWidth()
	WinH = GetWindowHeight()
	VwinW = GetVirtualWidth()
	VwinH = GetVirtualHeight()
	
	LoadImageResized(1, "football.png", 0.5, 1.0, 0)                     // load background image
	   CreateSprite(1, 1)   
	   SetSpriteSize(1, 1024, 768)
	SetSpritePosition(1, 0, 0)                       // set background sprite postion
			
	CreateText(1, "SELECT NUMBER OF PLAYERS")        // create the text used at the top of the menu
		SetTextSize(1, 50)                               // set text size
			`SetTextBold(1, 1)                                 // set text to bold
		SetTextColor(1, 250, 250, 0, 255)                 // set text color
	SetTextFont(1, 1)
	
	TextW = GetTextTotalWidth(1)
	SetTextPosition(1, 512 - TextW / 2, 50)
Remstart
	LoadImage(2, "SwapPositionButton.png")
	  CreateSprite(2, 2)
	    ImageW = GetImageWidth(2)
	    ImageH = GetImageHeight(2)
	   SetSpriteSize(2, 90, 30)
	SetSpritePosition(2, 920, 10)
Remend
	
	AddVirtualButton(1, 422, 349, 45) : SetVirtualButtonText(1, "1") : SetVirtualButtonColor(1, 0, 0, 150) : SetVirtualButtonAlpha(1, 220)
	`SetVirtualButtonImageUp(1, 0)
		
	AddVirtualButton(2, 482, 349, 45) : SetVirtualButtonText(2, "2") : SetVirtualButtonColor(2, 0, 0, 150) : SetVirtualButtonAlpha(2, 220)
	`SetVirtualButtonImageUp(2, 0)
	
	AddVirtualButton(3, 542, 349, 45) : SetVirtualButtonText(3, "3") : SetVirtualButtonColor(3, 0, 0, 150) : SetVirtualButtonAlpha(3, 220)
	`SetVirtualButtonImageUp(3, 0)
	
	AddVirtualButton(4, 602, 349, 45) : SetVirtualButtonText(4, "4") : SetVirtualButtonColor(4, 0, 0, 150) : SetVirtualButtonAlpha(4, 220)
	`SetVirtualButtonImageUp(4, 0)

	AddVirtualButton(5, 422, 419, 45) : SetVirtualButtonText(5, "5") : SetVirtualButtonColor(5, 0, 0, 150) : SetVirtualButtonAlpha(5, 220)
	`SetVirtualButtonImageUp(5, 0)
	
	AddVirtualButton(6, 482, 419, 45) : SetVirtualButtonText(6, "6") : SetVirtualButtonColor(6, 0, 0, 150) : SetVirtualButtonAlpha(6, 220)
	`SetVirtualButtonImageUp(6, 0)
	
	AddVirtualButton(7, 542, 419, 45) : SetVirtualButtonText(7, "7") : SetVirtualButtonColor(7, 0, 0, 150) : SetVirtualButtonAlpha(7, 220)
	`SetVirtualButtonImageUp(7, 0)
	
	AddVirtualButton(8, 602, 419, 45) : SetVirtualButtonText(8, "8") : SetVirtualButtonColor(8, 0, 0, 150) : SetVirtualButtonAlpha(8, 220)
	`SetVirtualButtonImageUp(8, 0)
	
	For b = 1 to 8
		SetVirtualButtonAlpha(b, 250)
	Next


Account_Num_Players = 0

    Repeat                         // start Repeat Until loop
			
       If GetVirtualButtonPressed(1)  // button 1
		  Account_Num_Players = 1
	   Endif
	          
       If GetVirtualButtonPressed(2)  // button 2
		  Account_Num_Players = 2
	   Endif
       
       If GetVirtualButtonPressed(3)  // button 3
		  Account_Num_Players = 3
	   Endif
       
       If GetVirtualButtonPressed(4)  // button 4
		  Account_Num_Players = 4
	   Endif
       
       If GetVirtualButtonPressed(5)  // button 5
		  Account_Num_Players = 5
	   Endif
       
       If GetVirtualButtonPressed(6)  // button 6
		  Account_Num_Players = 6
	   Endif
       
       If GetVirtualButtonPressed(7)  // button 7
		  Account_Num_Players = 7
	   Endif
       
       If GetVirtualButtonPressed(8)  // button 8
		  Account_Num_Players = 8
	   Endif
       
       Sync()                          // sync or refresh the screen
        
    Until Account_Num_Players >= 1       // end of the repeat until loop
			
      DeleteText(1)
      DeleteImage(1)
      DeleteSprite(1)

//  delete all virtual buttons 1 - 8
      For i = 1 to 8
         DeleteVirtualButton(i)
      Next
      
EndFunction


Enter Sir Name #Include
+ Code Snippet
// ENTER SIRNAME SCREEN FUNCTION-----------------------------------------------------------

Function EnterSirName()
	SetScreen()
	LoadImageResized(1, "football.png", 0.5, 1.0, 0)                     // load background image
	   CreateSprite(1, 1)   
	   SetSpriteSize(1, 1024, 768)
	SetSpritePosition(1, 0, 0)                       // set background sprite postion
	`SetImageMinFilter(1, 0)
	`SetImageMagFilter(1, 0)
	
// text object 1--------------------------------------------------------------------------------------------			
		CreateText(1, "PLEASE ENTER NAME")                 // create the text used at top of menu
			SetTextSize(1, 50)                              // set text size
				`SetTextBold(1, 1)                           // set text to bold
					SetTextColor(1, 250, 250, 0, 255)            // set text color
				SetTextFont(1, 1)
			TextW = GetTextTotalWidth(1)                     // get text total width
		SetTextPosition(1, 512 - TextW / 2, 130)            // set text position to the center
	
// text object 2----------------------------------------------------------------------------------------------	
	CreateText(2, "Enter Name Here")           // create the text above the text edit box
		SetTextSize(2, 25)                    // set font size
			SetTextColor(2, 255, 175, 0, 255)   // set the text color
			SetTextFont(1, 1)
		TextW = GetTextTotalWidth(2)          // get text 2 total width
	SetTextPosition(2, 512 - TextW / 2, 285) // set text 2 to center of the screen

// EDIT BOX 1------------------------------------------------------------------------------------------------------	
`	CreateEditBox(1)                              // create the editbox for user input
`		SetEditBoxSize(1, 200, 30)                // set editbox size
`			EBWidth = GetEditBoxWidth(1)            // get editbox width
`			EBHeight = GetEditBoxHeight(1)
`		SetEditBoxPosition(1, 1024 / 2 - EBWidth / 2 , 384 - EBHeight / 2) // find center of the screen left to right and position editbox
`	SetEditBoxTextSize(1, 30)                        // set editbox font size
	
	// TEMPORARY TIMER JUST TO SET MENUS UP. WE NEED TO REPLACE WITH PROPER INPUT DETECTION
	
	`SetClearColor ( 0, 255, 0 )


	StartTextInput ( )
	Text$ = ""

	`Timer# = Timer()                   // assign variable to timer
	Repeat   
		  
			if GetTextInputCompleted () = 1
				Text$ = GetTextInput ()
			endif

    Print (Text$)

		Sync()                       // refresh the screen
	 Until GetTextInputCompleted() = 1
		
	DeleteImage(1)            // delete menu background image
	DeleteSprite(1)            // delete sprite created from background image
	DeleteEditBox(1)            // delete editbox
	DeleteText(1)              // delete menu text title
	DeleteText(2)              // delete text above editbox

EndFunction


Select Team #Include
+ Code Snippet
// SELECT TEAM SCREEN FUNCTION----------------ENGLISH PRIMARY LEAGUE (PREMIER)------------------------------
Function SelectTeam()
	
	SetScreen()
	LoadImage(1, "MenuBackground1.png")
	CreateSprite(1, 1)              //  CREATE SPRITE FROM LOADED IMAGE TO USE ON SCREEN
			SetSpritePosition(1, 0, 0)  //  SET SPRITE POSITION ON THE SCREEN
				CreateText(1, "Select Team") // CREATE THE TEXT USED AT TOP OF MENU
					SetTextSize(1, 50)           // SET  TEXT SIZE
					SetTextFont(1, 1)
				`SetTextBold(1, 1)            // SET TEXT TO BOLD
			SetTextColor(1, 150, 150, 0, 255) // SET TEXT COLOR
		TextW = GetTextTotalWidth(1)
	SetTextPosition(1, 512 - TextW / 2, 50)

PrimaryLeague() // PRIMARY FUCTION FUNCTION CALL


	
	EndFunction // END OF THE SELECT TEAM FUNCTION

Function PrimaryLeague() // START OF PRIMARY LEAGUE FUNCTION
	
	// PRIMARY DIVISION ----PRIMARY LEAGUE---------------------------------------------------------------------------
// LEFT COLUME BUTTONS--------------------------------------------------------------------------------------------		
	// BUTTON 1 SETTINGS-----ADDICKS
	AddVirtualButton(1, 256, 144, 8) : SetVirtualButtonText(1, "Addicks") : SetVirtualButtonColor(1, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(1, 0)     :  SetVirtualButtonSize(1, 65, 60)     // SET BUTTON IN UP STATE, SIZEOF BUTTON
	
	// BUTTON 2 SETTINGS-----BORO
	AddVirtualButton(2, 256, 214, 8) : SetVirtualButtonText(2, "Boro") : SetVirtualButtonColor(2, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(2, 0)     :  SetVirtualButtonSize(2, 65, 60)      // SET BUTTON IN UP STATE,SIZE OF BUTTON
	
	// BUTTON 3 SETTINGS-----DEVILS
	AddVirtualButton(3, 256, 284, 8) : SetVirtualButtonText(3, "Devils") : SetVirtualButtonColor(3, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(3, 0)     :  SetVirtualButtonSize(3, 65, 60)      // SET BUTTON IN UP STATE,SIZE OF BUTTON
	
	// BUTTON 4 SETTINGS-----FOREST
	AddVirtualButton(4, 256, 354, 8) : SetVirtualButtonText(4, "Forest") : SetVirtualButtonColor(4, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(4, 0)     :  SetVirtualButtonSize(4, 65, 60)      // SET BUTTON IN UP STATE,SIZE OF BUTTON
	
	// BUTTON 5 SETTINGS-----FOXES
	AddVirtualButton(5, 256, 424, 8) : SetVirtualButtonText(5, "Foxes") : SetVirtualButtonColor(5, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(5, 0)     :  SetVirtualButtonSize(5, 65, 60)      // SET BUTTON IN UP STATE,SIZE OF BUTTON
	
	// BUTTON 6 SETTINGS-----GUNNERS
	AddVirtualButton(6, 256, 494, 8) : SetVirtualButtonText(6, "Gunners") : SetVirtualButtonColor(6, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(6, 0)     :  SetVirtualButtonSize(6, 65, 60)      // SET BUTTON IN UP STATE,SIZE OF BUTTON
	
	// BUTTON 7 SETTINGS-----IRONS
	AddVirtualButton(7, 256, 564, 8) : SetVirtualButtonText(7, "Irons") : SetVirtualButtonColor(7, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(7, 0)     :  SetVirtualButtonSize(7, 65, 60)      // SET BUTTON IN UP STATE,SIZE OF BUTTON

// MIDDLE ROW BUTTONS----------------------------------------------------------------------------------------------------------------------------------------
	// BUTTON 8 SETTINGS-----LILLYWHITES
	AddVirtualButton(8, 512, 214, 8) : SetVirtualButtonText(8, "Lillywhites") : SetVirtualButtonColor(8, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(8, 0)     :  SetVirtualButtonSize(8, 65, 60)      // SET BUTTON IN UP STATE,SIZE OF BUTTON
	
	// BUTTON 9 SETTINGS-----MAGPIES
	AddVirtualButton(9, 512, 284, 8) : SetVirtualButtonText(9, "Magpies") : SetVirtualButtonColor(9, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(9, 0)     :  SetVirtualButtonSize(9, 65, 60)      // SET BUTTON IN UP STATE,SIZE OF BUTTON
	
	// BUTTON 10 SETTINGS-----OWLS
	AddVirtualButton(10, 512, 354, 8) : SetVirtualButtonText(10, "Owls") : SetVirtualButtonColor(10, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(10, 0)     :  SetVirtualButtonSize(10, 65, 60)    // SET BUTTON IN UP STATE,SIZE OF BUTTON

	// BUTTON 11 SETTINGS-----PEACOCKS
	AddVirtualButton(11, 512, 424, 8) : SetVirtualButtonText(11, "Peacocks") : SetVirtualButtonColor(11, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(11, 0)     :  SetVirtualButtonSize(11, 65, 60)    // SET BUTTON IN UP STATE,SIZE OF BUTTON
	
	// BUTTON 12 SETTINGS-----PENSIONERS
	AddVirtualButton(12, 512, 494, 8) : SetVirtualButtonText(12, "Pensioners") : SetVirtualButtonColor(12, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(12, 0)     :  SetVirtualButtonSize(12, 65, 60)    // SET BUTTON IN UP STATE,SIZE OF BUTTON
	
	// BUTTON 13 SETTINGS-----RAMS
	AddVirtualButton(13, 512, 564, 8) : SetVirtualButtonText(13, "Rams") : SetVirtualButtonColor(13, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(13, 0)     :  SetVirtualButtonSize(13, 65, 60)    // SET BUTTON IN UP STATE,SIZE OF BUTTON
// LEFT ROW BUTTONS------------------------------------------------------------------------------------------------------------------------------------------	
	// BUTTON 14 SETTINGS-----REDS
	AddVirtualButton(14, 768, 144, 8) : SetVirtualButtonText(14, "Reds") : SetVirtualButtonColor(14, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(14, 0)     :  SetVirtualButtonSize(14, 65, 60)    // SET BUTTON IN UP STATE,SIZE OF BUTTON
	
	// BUTTON 15 SETTINGS-----RIVERSIDERS
	AddVirtualButton(15, 768, 214, 8) : SetVirtualButtonText(15, "Riversiders") : SetVirtualButtonColor(15, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(15, 0)     :  SetVirtualButtonSize(15, 65, 60)    // SET BUTTON IN UP STATE,SIZE OF BUTTON
	
	// BUTTON 16 SETTINGS-----SAINTS
	AddVirtualButton(16, 768, 284, 8) : SetVirtualButtonText(16, "Saints") : SetVirtualButtonColor(16, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(16, 0)     :  SetVirtualButtonSize(16, 65, 60)    // SET BUTTON IN UP STATE,SIZE OF BUTTON
	
	// BUTTON 17 SETTINGS-----SKY-BLUES
	AddVirtualButton(17, 768, 354, 8) : SetVirtualButtonText(17, "Sky-Blues") : SetVirtualButtonColor(17, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(17, 0)     :  SetVirtualButtonSize(17, 65, 60)    // SET BUTTON IN UP STATE,SIZE OF BUTTON
	
	// BUTTON 18 SETTINGS-----TOFFEES
	AddVirtualButton(18, 768, 424, 8) : SetVirtualButtonText(18, "Toffees") : SetVirtualButtonColor(18, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(18, 0)     :  SetVirtualButtonSize(18, 65, 60)    // SET BUTTON IN UP STATE,SIZE OF BUTTON
	
	// BUTTON 19 SETTINGS-----VILLAINS
	AddVirtualButton(19, 768, 494, 8) : SetVirtualButtonText(19, "Villains") : SetVirtualButtonColor(19, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(19, 0)     :  SetVirtualButtonSize(19, 65, 60)    // SET BUTTON IN UP STATE,SIZE OF BUTTON
	
	// BUTTON 20 SETTINGS-----WOMBLES
	AddVirtualButton(20, 768, 564, 8) : SetVirtualButtonText(20, "Wombles") : SetVirtualButtonColor(20, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(20, 0)     :  SetVirtualButtonSize(20, 65, 60)    // SET BUTTON IN UP STATE,SIZE OF BUTTON

// DIVISION BUTTONS AT THE BOTTOM-------------------------------------------------------------------------------
	// BUTTON 21 SETTINGS---------PRIMARY DIVISION-------------------------------------------------------------------
	AddVirtualButton(21, 312, 700, 8) : SetVirtualButtonText(21, "Primary") : SetVirtualButtonColor(21, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(21, 0)     :  SetVirtualButtonSize(21, 65, 60)    // SET BUTTON IN UP STATE,SIZE OF BUTTON
	
	// BUTTON 22 SETTINGS---------DIVISION A
	AddVirtualButton(22, 412, 700, 8) : SetVirtualButtonText(22, "Division A") : SetVirtualButtonColor(22, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(22, 0)     :  SetVirtualButtonSize(22, 65, 60)    // SET BUTTON IN UP STATE,SIZE OF BUTTON

	// BUTTON 23 SETTINGS---------DIVISION B
	AddVirtualButton(23, 512, 700, 8) : SetVirtualButtonText(23, "Division B") : SetVirtualButtonColor(23, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(23, 0)     :  SetVirtualButtonSize(23, 65, 60)    // SET BUTTON IN UP STATE,SIZE OF BUTTON

	// BUTTON 24 SETTINGS---------DIVISION C
	AddVirtualButton(24, 612, 700, 8) : SetVirtualButtonText(24, "Division C") : SetVirtualButtonColor(24, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(24, 0)     :  SetVirtualButtonSize(24, 65, 60)    // SET BUTTON IN UP STATE,SIZE OF BUTTON
	
	// BUTTON 25 SETTINGS---------CONFERENCE
	AddVirtualButton(25, 712, 700, 8) : SetVirtualButtonText(25, "Conference") : SetVirtualButtonColor(25, 0, 10, 150) // ADD BUTTON, BUTTON TEXT AND COLOR
	SetVirtualButtonImageUp(25, 0)     :  SetVirtualButtonSize(25, 65, 60)    // SET BUTTON IN UP STATE,SIZE OF BUTTON
	
	For b = 1 to 25
		SetVirtualButtonAlpha(b, 250)
	Next	
	
		// TEMPORARY TIMER JUST TO SET MENUS UP. WE NEED TO REPLACE WITH PROPER INPUT DETECTION
	Repeat
		
		If GetVirtualButtonPressed(1)  // button 1
		  Team_Name$ = "Addicks"
		Endif
		
		If GetVirtualButtonPressed(2)  // button 2
		  Team_Name$ = "Boro"
		Endif
		
		If GetVirtualButtonPressed(3)  // button 3
		  Team_Name$ = "Devils"
		Endif
		
		If GetVirtualButtonPressed(4)  // button 4
		  Team_Name$ = "Forest"
		Endif
		
		If GetVirtualButtonPressed(5)  // button 5
		  Team_Name$ = "Foxes"
		Endif
		
		If GetVirtualButtonPressed(6)  // button 6
		  Team_Name$ = "Gunners"
		Endif
		
		If GetVirtualButtonPressed(7)  // button 7
		  Team_Name$ = "Irons"
		Endif
		
		If GetVirtualButtonPressed(8)  // button 8
		  Team_Name$ = "Lillywhites"
		Endif
		
		If GetVirtualButtonPressed(9)  // button 9
		  Team_Name$ = "Magpies"
		Endif
		
		If GetVirtualButtonPressed(10)  // button 10
		  Team_Name$ = "Owls"
		Endif
		
		If GetVirtualButtonPressed(11)  // button 11
		  Team_Name$ = "Peacocks"
		Endif
		
		If GetVirtualButtonPressed(12)  // button 12
		  Team_Name$ = "Pensioners"
		Endif
		
		If GetVirtualButtonPressed(13)  // button 13
		  Team_Name$ = "Rams"
		Endif
		
		If GetVirtualButtonPressed(14)  // button 14
		  Team_Name$ = "Reds"
		Endif
		
		If GetVirtualButtonPressed(15)  // button 15
		  Team_Name$ = "Riversiders"
		Endif
		
		If GetVirtualButtonPressed(16)  // button 16
		  Team_Name$ = "Saints"
		Endif
		
		If GetVirtualButtonPressed(17)  // button 17
		  Team_Name$ = "Sky-Blues"
		Endif
		
		If GetVirtualButtonPressed(18)  // button 18
		  Team_Name$ = "Toffees"
		Endif
		
		If GetVirtualButtonPressed(19)  // button 19
		  Team_Name$ = "Villains"
		Endif
		
		If GetVirtualButtonPressed(20)  // button 20
		  Team_Name$ = "Wombles"
		Endif
		
		Sync()           // REFRESH SCREEN
 	
 	Until Team_Name$ = "Addicks" Or Team_Name$ = "Boro" Or Team_Name$ = "Devils" Or Team_Name$ = "Forest" Or Team_Name$ = "Foxes" Or Team_Name$ = "Gunners" Or Team_Name$ = "Irons" Or Team_Name$ = "Lillywhites" Or Team_Name$ = "Magpies" Or Team_Name$ = "Owls" Or Team_Name$ = "Peacocks" Or Team_Name$ = "Pensioners" Or Team_Name$ = "Rams" Or Team_Name$ = "Reds" Or Team_Name$ = "Riversiders"Or Team_Name$ = "Saints" Or Team_Name$ = "Sky-Blues" Or Team_Name$ = "Toffees" Or Team_Name$ = "Villains" Or Team_Name$ = "Wombles"
	
	// DELETE ALL MEDIA	
	DeleteAllImages()
	DeleteAllSprites()
	DeleteAllText()
	
	For i = 1 to 25              // START OF DELETING LOOP
		DeleteVirtualButton(i)    // DELETE ALL BUTTONS
	Next                        // RETURN LOOP TO DELETE THE NEXT BUTTON
	

EndFunction


Difficulty Level #Include
+ Code Snippet
// DIFFICULTY LEVEL SCREEN FUNCTION---------------------------------------------

Function DifficultyLevel()
	
	SetScreen()
	LoadImage(1, "MenuBackground1.png")
	CreateSprite(1, 1)              // create sprite from loaded image
			SetSpritePosition(1, 0, 0)  //  set sprite postion
				CreateText(1, "Difficulty Level") // create text for menu title
					SetTextSize(1, 50)           // set text size
					`SetTextBold(1, 1)            // set font bold
				SetTextColor(1, 150, 150, 0, 255) // set font color
			SetTextFont(1, 1)
		TextW = GetTextTotalWidth(1)
	SetTextPosition(1, 512 - TextW / 2, 90)
		
	// button 1 settings	
	AddVirtualButton(1, 512, 209, 8) : SetVirtualButtonText(1, "Extremely Easy $20,000,000") : SetVirtualButtonColor(1, 0, 10, 150)
	SetVirtualButtonImageUp(1, 0) :  SetVirtualButtonSize(1, 140, 65)
	
	// button 2 settings
	AddVirtualButton(2, 512, 279, 8) : SetVirtualButtonText(2, "Very Easy $10,000,000") : SetVirtualButtonColor(2, 0, 10, 150)
	SetVirtualButtonImageUp(2, 0) :  SetVirtualButtonSize(2, 140, 65)
	
	// button 3 settings
	AddVirtualButton(3, 512, 349, 8) : SetVirtualButtonText(3, "Easy $5,000,000") : SetVirtualButtonColor(3, 0, 10, 150)
	SetVirtualButtonImageUp(3, 0) :  SetVirtualButtonSize(3, 140, 65)
	
	// button 4 settings
	AddVirtualButton(4, 512, 419, 8) : SetVirtualButtonText(4, "Normal $1,000,000") : SetVirtualButtonColor(4, 0, 10, 150)
	SetVirtualButtonImageUp(4, 0) :  SetVirtualButtonSize(4, 140, 65)
	
	// button 5 settings
	AddVirtualButton(5, 512, 489, 8) : SetVirtualButtonText(5, "Hard $100,000") : SetVirtualButtonColor(5, 0, 10, 150)
	SetVirtualButtonImageUp(5, 0) :  SetVirtualButtonSize(5, 140, 65)
	
	// button 6 settings
	AddVirtualButton(6, 512, 559, 8) : SetVirtualButtonText(6, "Very Hard $0") : SetVirtualButtonColor(6, 0, 10, 150)
	SetVirtualButtonImageUp(6, 0) :  SetVirtualButtonSize(6, 140, 65)
	
	For b = 1 to 6
		SetVirtualButtonAlpha(b, 250)
	Next	
	
	// menu main loop
	Repeat
		
		If GetVirtualButtonPressed(1)  // button 1
		  T_Wallet# = 20000000.00
		Endif
		
		If GetVirtualButtonPressed(2)  // button 2
		  T_Wallet# = 10000000.00
		Endif
		
		If GetVirtualButtonPressed(3)  // button 3
		  T_Wallet# = 5000000.00
		Endif
		
		If GetVirtualButtonPressed(4)  // button 4
		  T_Wallet# = 1000000.00
		Endif
		
		If GetVirtualButtonPressed(5)  // button 5
		  T_Wallet# = 100000.00
		Endif
		
		If GetVirtualButtonPressed(6)  // button 6
		  T_Wallet# = 0.00
		Endif
		
		Sync()
		
	Until T_Wallet# = 20000000.00 Or T_Wallet# = 10000000.00 Or T_Wallet# = 5000000.00 Or T_Wallet# = 1000000.00 Or T_Wallet# = 100000.00 Or T_Wallet# = 0.00
				
	DeleteAllImages()
	DeleteAllSprites()
	DeleteAllText()
	
	For i = 1 to 6
		DeleteVirtualButton(i)
	Next
	
EndFunction


I will be reducing some code to one routine to get rid of the mess. Like the button color I know I can put SetVirtualButtonColor() into a For Next loop to set the buttons all to the same color
Posted: 4th Feb 2022 18:14
Might be that T_Wallet#, which is set in the main code as Global T_Wallet# is probably already = 0.00, so the line, Until T_Wallet# = 20000000.00 Or T_Wallet# = 10000000.00 Or T_Wallet# = 5000000.00 Or T_Wallet# = 1000000.00 Or T_Wallet# = 100000.00 Or T_Wallet# = 0.00[, in the difficulty level will execute.
Posted: 4th Feb 2022 18:36
Might be that T_Wallet#, which is set in the main code as Global T_Wallet# is probably already = 0.00, so the line, Until T_Wallet# = 20000000.00 Or T_Wallet# = 10000000.00 Or T_Wallet# = 5000000.00 Or T_Wallet# = 1000000.00 Or T_Wallet# = 100000.00 Or T_Wallet# = 0.00[, in the difficulty level will execute.


Thank you JosephB,
To test it I remmed out Or T_Wallet = 0.00 and it worked.

I need to figure out how I can include T_Wallet = 0.00 as one of the options because it will allow the user to choose to start the game with $0

I have also removed unnecessary SetVirtualButtoncolor() and SetVirtualButtonAlpha() commands because I set it up after button creation in a For/Next loop. I had to do that in numerous #Include files LOL. I'm trying to clean up the code + make it more versitile.
Posted: 4th Feb 2022 22:38
I changed the loop from Repeat/Until to Do/Loop and added the Exit command to each button detection If statement and it works perfectly
Posted: 4th Feb 2022 22:43
Maybe try something as follows for the Until statement:

Until GetVirtualButtonReleased(1) OrGetVirtualButtonReleased(2) Or GetVirtualButtonReleased(3) Or GetVirtualButtonReleased(4) Or GetVirtualButtonReleased(5) Or GetVirtualButtonReleased(6)

While there are several ways to do this, using the above code would not require much change to your current code.
Posted: 6th Feb 2022 3:46
Until GetVirtualButtonReleased(1) OrGetVirtualButtonReleased(2) Or GetVirtualButtonReleased(3) Or GetVirtualButtonReleased(4) Or GetVirtualButtonReleased(5) Or GetVirtualButtonReleased(6)


Thank you JosephB I might try that. Currently with the way I have it with the do/loop it works great, but I might switch it. I actually perfer not to use the do/loop