crzftx Posted November 3, 2006 Posted November 3, 2006 I understand that there is another similar post about a function that restarts the code, but it is a bit different and not answered. I have a simple game and I want it to start over when I press F2. I want a function set from HotKeySet (any alternatives to HotKeySet other than AdlibEnable with _IsPressed??) that would restart the code from a certain spot, or the beginning, if nothing else is possible. I could easily do this if Goto was still around, but it's not. Any suggestions?
Rad Posted November 3, 2006 Posted November 3, 2006 What if you litterally make it 'restart' the game, close it and open it again? If it really is a simple game, you could move all the objects back where they were and set scores etc to 0... but we dont know what it is yet
cppman Posted November 3, 2006 Posted November 3, 2006 (edited) maybe something like this: Global $nRestartCount = 0 _Main($nRestartCount) ;Call the main function Func _Main($nRestartCountW) ;We do our main code in here MsgBox(0, "Program Restart Count", $nRestartCountW) $hWnd = GUICreate("MyTitle") GUISwitch($hWnd) $nMyButton = GUICtrlCreateButton("Restart Script", 0, 0, 100) GUISetState() While (1) $uMsg = GUIGetMsg() if ($uMsg == -3) then ExitLoop if ($uMsg == $nMyButton) Then $nRestartCount += 1 GUIDelete($hWnd) _Main($nRestartCount) EndIf WEnd Return 0 EndFunc oÝ÷ Úâ*.Ƭy«¢+Ø)!½Ñ-åMÐ ÅÕ½ÐííÕôÅÕ½Ðì°ÅÕ½Ðí}5¥Ñ½ÈÅÕ½Ðì¤)±½°ÀÌØí¹IÍÑÉÑ ½Õ¹ÐôÀ)±½°ÀÌØí¡]¹ôÀ)}5¥¸ ÀÌØí¹IÍÑÉÑ ½Õ¹Ð¤í ±°Ñ¡µ¥¸Õ¹Ñ¥½¸()Õ¹}5¥¸ ÀÌØí¹IÍÑÉÑ ½Õ¹Ñ¤($í]¼½Õȵ¥¸½¥¸¡É(%5Í ½à À°ÅÕ½ÐíAɽɴIÍÑÉÐ ½Õ¹ÐÅÕ½Ðì°ÀÌØí¹IÍÑÉÑ ½Õ¹Ñ¤($ÀÌØí¡]¹ôU% ÉÑ ÅÕ½Ðí5åQ¥Ñ±ÅÕ½Ðì¤(%U%MÝ¥Ñ ÀÌØí¡]¹¤($ÀÌØí¹5å ÕÑѽ¸ôU% Ñɱ ÉÑ ÕÑѽ¸ ÅÕ½ÐíIÍÑÉÐMÉ¥ÁÐÅÕ½Ðì°À°À°ÄÀÀ¤(%U%MÑMÑÑ ¤(%]¡¥± Ĥ($$ÀÌØíÕ5ÍôU%Ñ5Í ¤($%¥ ÀÌØíÕ5Íôô´Ì¤Ñ¡¸á¥Ñ1½½À($$í¥ ÀÌØíÕ5ÍôôÀÌØí¹5å ÕÑѽ¸¤Q¡¸M¹ ÅÕ½ÐííÄÉôÅÕ½Ðì¤(%]¹(%IÑÕɸÀ$)¹Õ¹()Õ¹}5¥Ñ½È ¤($ÀÌØí¹IÍÑÉÑ ½Õ¹Ð¬ôÄ(%U%±Ñ ÀÌØí¡]¹¤(%}5¥¸ ÀÌØí¹IÍÑÉÑ ½Õ¹Ð¤)¹Õ¹ Edited November 3, 2006 by CHRIS95219 Miva OS Project
crzftx Posted November 4, 2006 Author Posted November 4, 2006 (edited) removed Edited August 9, 2017 by crzftx
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now