This is the opening Screen
But no matter what I do I can't get a click on a picture to open a file.
I need it to
have a open message for each of the levels in the game.
Please How do I code a simple user click on a picture to open a file?
Code that is useless.
Code:
#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=c:\program files (x86)\autoit3\tihgame1\julymenu.kxf $Form1_1 = GUICreate("Trouble In Heaven", 1030, 772, 234, 21) GUISetIcon("C:\Play.ico", -1) $background = GUICtrlCreatePic("C:\Splash.bmp", 0, 0, 1024, 768, BitOR($GUI_SS_DEFAULT_PIC,$SS_CENTERIMAGE)) GUICtrlSetResizing(-1, $GUI_DOCKAUTO+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) $EXIT = GUICtrlCreateButton("EXIT", 936, 40, 75, 25) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetTip(-1, "EXIT") $EXITcontext = GUICtrlCreateContextMenu($EXIT) $MenuItem1 = GUICtrlCreateMenuItem("EXIT", $EXITcontext) $MenuItem2 = GUICtrlCreateMenuItem("On the Run", $EXITcontext) GUICtrlSetState(-1, $GUI_CHECKED) $MenuItem3 = GUICtrlCreateMenuItem("Devils Slide", $EXITcontext) $MenuItem4 = GUICtrlCreateMenuItem("Traitorous Dungeon", $EXITcontext) $MenuItem5 = GUICtrlCreateMenuItem("Into The Dungon", $EXITcontext) $help1 = GUICtrlCreateLabel("Hints and Help", 824, 80, 198, 36) GUICtrlSetFont(-1, 16, 800, 0, "Arial") GUICtrlSetColor(-1, 0x00FF00) GUICtrlSetBkColor(-1, 0x008080) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) GUICtrlSetTip(-1, "Help") $ontherun = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\ONTHERUN.jpg", 16, 144, 292, 68, BitOR($GUI_SS_DEFAULT_PIC,$SS_SUNKEN)) GUICtrlSetTip(-1, "exit") $devilSlide = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\devilSlide.jpg", 336, 168, 332, 52, BitOR($GUI_SS_DEFAULT_PIC,$SS_SUNKEN)) GUICtrlSetTip(-1, "level2") $demonhalls = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\demonhalls.jpg", 344, 224, 332, 52) GUICtrlSetTip(-1, "level 3") $hadies = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\16hadiesexpress.jpg", 688, 168, 332, 52) GUICtrlSetResizing(-1, $GUI_DOCKAUTO+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) GUICtrlSetTip(-1, "level 4") $runningpits = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\runningpits.jpg", 680, 360, 348, 44) GUICtrlSetTip(-1, "level 5") $templepain = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\templepain.jpg", 680, 224, 340, 76) $Underworld = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\Underworld.jpg", 696, 304, 324, 52) $devilSlide2 = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\devilSlide2.jpg", 8, 224, 300, 52) $Traitor2 = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\Traitorousdungeon2.jpg", 8, 288, 300, 52) GUICtrlSetTip(-1, "Traitorous dungeon") $Traitor1 = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\Traitorousdungeon1.jpg", 8, 288, 300, 52, BitOR($GUI_SS_DEFAULT_PIC,$SS_SUNKEN)) GUICtrlSetTip(-1, "Traitorous dungeon") $sewer1 = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\sewer1.jpg", 8, 344, 300, 44) GUICtrlSetTip(-1, "In to the sewer") $Traitor9 = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\Traitor9.jpg", 344, 368, 332, 52) GUICtrlSetTip(-1, "Dead Reborn") Dim $Form1_1_AccelTable[1][2] = [["^q", $EXIT]] GUISetAccelerators($Form1_1_AccelTable) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GuiCreate("Menu", 400, 150) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MenuItem1 Case $MenuItem2 Case $MenuItem3 Case $MenuItem4 Case $MenuItem5 Case $EXIT $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch Case $help1 Case $ontherun Case $devilSlide Case $demonhalls Case $runningpits Case $templepain Case $Underworld Case $devilSlide2 Case $Traitor2 Case $Traitor1 Case $sewer1 Case $Traitor9 EndSwitch WEnd Func MenuItem1Click() EndFunc Func MenuItem2Click() EndFunc Func MenuItem3Click() EndFunc Func MenuItem4Click() EndFunc Func ontherunClick() EndIf EndFunc Func runningpitsClick() EndFunc Func sewer1Click() MsgBox(0, "OK Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle & " CtrlHandle=" & @GUI_CtrlHandle) EndFunc Func templepainClick() EndFunc Func Traitor1Click() EndFunc Func Traitor2Click() EndFunc Func Traitor9Click() EndFunc Func UnderworldClick() EndFunc
See they have to complete each level before they can play the next level.
Code:
#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <Misc.au3> If _Singleton("Trouble In Heaven", 1) = 0 Then ; We know the script is already running. Let the user know. MsgBox(0, "Script Name", "This script is already running. Using multiple copies of this script at the same time is unsupported!") Exit EndIf #Region --- CodeWizard generated code Start --- If Not IsDeclared('Navy') Then Local $Navy = 0x000080 GUICtrlSetColor("controlID",$Navy) #EndRegion --- CodeWizard generated code End --- #Region ### START Koda GUI section ### Form= $Form1_1 = GUICreate("Trouble In Heaven", 1030, 772, 234, 21) GUISetIcon("C:\Play.ico", -1) $Pic1 = GUICtrlCreatePic("C:\Splash.bmp", 0, 0, 1024, 768, BitOR($GUI_SS_DEFAULT_PIC,$SS_CENTERIMAGE)) GUICtrlSetResizing(-1, $GUI_DOCKAUTO+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) ;$Pic1 = GUICtrlCreatePic("C:\Splash.bmp", 0, 0, 612, 428) $Button1 = GUICtrlCreateButton("Button1", 256, 380, 256, 32, $BS_ICON) GUICtrlSetImage(-1, "C:\play1.ico", -1) ;GUICtrlSetColor(-1,0xFF0000) ; Makes instructions Red GUICtrlSetTip(-1, "exit") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg ; Case $GUI_EVENT_CLOSE ; Exit Case $Button1 Exit EndSwitch ; $nMsg = GUIGetMsg() ; Switch $nMsg ; Case $GUI_EVENT_CLOSE ; Exit ; EndSwitch ;WEnd ;;;;;;;;;;;;;; GAME ONE ;;;;;;;;;;;;;; #Region --- CodeWizard generated code Start --- ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Icon=Question If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(36,"Start your escape","Start your escape 'On the Run'") If $iMsgBoxAnswer = 6 Then;Yes FileChangeDir ( "C:\0TIH\1a" ) $file = "C:\0TIH\1a\1a.exe" ShellExecuteWait($file) EndIf ;ShellExecuteWait("C:\0aTest\China1a.exe", "","C:\0aTest", "") If $iMsgBoxAnswer = 7 Then ;No Exit EndIf #EndRegion --- CodeWizard generated code End --- ;;;;;;;;;;;;;;; GAME TWO ;;;;;;;;;;;;;;;;;;;;;;; #Region --- CodeWizard generated code Start --- ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Default Button=Second, Icon=Question If FileExists("C:\0aTest\level1.txt") Then If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(292,"Play Level 2","Play On the Run") ; Select Case $iMsgBoxAnswer = 6 ;Yes FileChangeDir ( "C:\0TIH\2a" ) $file = "C:\0TIH\2a\2a.exe" ShellExecuteWait($file) Case $iMsgBoxAnswer = 7 ;No Exit EndSelect Else MsgBox(4096, "C:\0TIH", "You did not complete last level") EndIf ;EndSelect ;Wend #EndRegion --- CodeWizard generated code End --- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GAME THREE ;;;;;;;;;;;;;;;;;;;;;;; #Region --- CodeWizard generated code Start --- ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Default Button=Second, Icon=None If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(260,"Trouble In Heaven","Enter Devils Slide") Select Case $iMsgBoxAnswer = 6 ;Yes FileChangeDir ( "C:\0TIH\3a" ) $file = "C:\0TIH\3a\3a.exe" ShellExecuteWait($file) Case $iMsgBoxAnswer = 7 ;No Exit EndSelect ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GAME FOUR ;;;;;;;;;;;;;;;;;;;;;;; #Region --- CodeWizard generated code Start --- ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Default Button=Second, Icon=None If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(60,"Play Level 4","Play Level 4") Select Case $iMsgBoxAnswer = 6 ;Yes ShellExecuteWait("C:\0aTest\China4a.exe", "","C:\0aTest", "") Case $iMsgBoxAnswer = 7 ;No Exit EndSelect WEnd #EndRegion --- CodeWizard generated code End --- will repeat to China21a.exe