game wont end (blitzplus)
Blitz3D Forums/Blitz3D Beginners Area/game wont end (blitzplus)
| ||
Im a newb and im wondering why on case game_exit it doesnt exit, does anyone know?; Game Variables
Global g_account
Global g_password
Global g_connected
Global g_playtime
;APPLICATION MENUS
AppTitle "Orkfius Tournament"
WinMain=CreateWindow("Orkfius Tournament",40,40,640,480)
WM_menu=WindowMenu(WinMain)
If g_connected = False Then ; Game Connected False
;Game
menu_game=CreateMenu("Game",0,WM_menu)
CreateMenu"Connect",game_connect,menu_game
CreateMenu"",NA,menu_game
CreateMenu"Exit",game_exit,menu_game
EndIf
If g_connected = True Then ; Game Connected True
; INGAME
; OVERVIEW
menu_overview=CreateMenu("Overview",0,WM_menu)
CreateMenu"The Tribe",overview_tribe,menu_overview
CreateMenu"Tribe News",overview_tnews,menu_overview
CreateMenu"",NA,menu_overview
CreateMenu"Rankings",overview_rank,menu_overview
; ADVISORS
menu_advisors=CreateMenu("Advisors",0,WM_menu)
CreateMenu"Internal Affairs",advisors_internal,menu_advisors
CreateMenu"Management",advisors_management,menu_advisors
CreateMenu"Actions",advisors_actions,menu_advisors
; MANAGEMENT
menu_management=CreateMenu("Management",0,WM_menu)
CreateMenu"Exploration",management_exploration,menu_management
CreateMenu"Construction",management_construction,menu_management
CreateMenu"Military Training",management_military,menu_management
; ACTIONS
menu_management=CreateMenu("Management",0,WM_menu)
EndIf
;HELP
menu_help=CreateMenu("Help",0,WM_menu)
CreateMenu"About",help_about,menu_help
UpdateWindowMenu WinMain
Repeat
; Wait for an event to occur...
id=WaitEvent()
; exit on a window close event
If ID=$803 Then End
; handle a menu event
If ID=$1001 Then
EID=EventData() ; Event data contains the menu ID specified when creating the menu items
Select EID
Case game_connect
Notify "Will Connect"
Case game_exit
End
End Select
End If
Forever
End ; bye! |
| ||
| Well I see two things wrong with your code. First you have a problem with: id=WaitEvent() ; exit on a window close event If ID=$803 Then End The id Varibale needs to be the same case because if they are not then Blitz sees them as two different variables. So change it to: id=WaitEvent() ; exit on a window close event If ID=$803 Then End |
| ||
| Well I see two things wrong with your code. First you have a problem with: id=WaitEvent() ; exit on a window close event If ID=$803 Then End The id Varibale needs to be the same case because if they are not then Blitz sees them as two different variables. So change it to something like: ID = WaitEvent() ; exit on a window close event If ID = $803 Then End Second on game_exit you have to set that to a variable before assigning it to a menu item. For example : game_exit = 30 CreateMenu "Exit", game_exit, menu_game Try those changes and see if they do anything for you. |
| ||
| #1 - No, that's wrong; Blitz variables are not case-sensitive. #2 - As Mojokool says, it's because your menu identifiers are not intialized. Make sure you initialize them to different values. I would initialize them as CONST (constants). <EDIT> In fact, you don't HAVE to use a name for the identifier... you could just use a number. |