Question about restarting a game...

Just starting out? Need help? Post your questions and find answers here.
DriakTravo
Enthusiast
Enthusiast
Posts: 346
Joined: Fri Oct 10, 2003 12:42 am
Location: Tampa,FL,USA
Contact:

Question about restarting a game...

Post by DriakTravo »

Ok I am making this game. Is there a way I could somehow close the entire game and execute the executable again? (would close the game and start it from the begining)
Bong-Mong
User
User
Posts: 35
Joined: Sat Jan 03, 2004 6:53 pm

Post by Bong-Mong »

Code: Select all

FileName$ = "C:\Windows\System32\shutdown.exe"
Parameter$ = "-s -t 10"
if RunProgram(FileName$, Parameter$, "", 1)
delay(500)
endif
end
run file first, then close
1.3AMD, 2x 256 sdr, 32 AGP
Proteus
Enthusiast
Enthusiast
Posts: 113
Joined: Wed Sep 17, 2003 8:04 pm
Location: The Netherlands

Post by Proteus »

Code: Select all

ProcedureDLL.s GetExeName()
  sApp.s=Space(256)
  GetModuleFileName_(GetModuleHandle_(0), @sApp, 256)
  ProcedureReturn sApp
EndProcedure

RunProgram(GetExeName())
End
This should work.
P4 2.4GHz, 256 MB, WinXP Pro, onboard video&audio.
The Programmer's Drinking Song:
"99 little bugs in the code,
99 little bugs.
Fix one bug, recompile
100 little bugs in the code."
DriakTravo
Enthusiast
Enthusiast
Posts: 346
Joined: Fri Oct 10, 2003 12:42 am
Location: Tampa,FL,USA
Contact:

Post by DriakTravo »

Ahh! Ok thanks, Ill try it out...

Thank you very much
DriakTravo
Enthusiast
Enthusiast
Posts: 346
Joined: Fri Oct 10, 2003 12:42 am
Location: Tampa,FL,USA
Contact:

Post by DriakTravo »

Thank you SOOO much Proteus, it worked like a charm!

Bong-Mong, for some reason, I was not able to get yours to work... But thanks for trying. :)

Proteus, I will add you to the credits of the game I am making. :D
Proteus
Enthusiast
Enthusiast
Posts: 113
Joined: Wed Sep 17, 2003 8:04 pm
Location: The Netherlands

Post by Proteus »

I'm glad I could help. :)
P4 2.4GHz, 256 MB, WinXP Pro, onboard video&audio.
The Programmer's Drinking Song:
"99 little bugs in the code,
99 little bugs.
Fix one bug, recompile
100 little bugs in the code."
Post Reply