Game Launcher Program

BlitzPlus Forums/BlitzPlus Beginners Area/Game Launcher Program

Necromancer(Posted 2013) [#1]
Soo, I am trying to make a simple program using inputs to type an input to open different games. Basically, I need to know if there's a way to have something like
game$ = Input("What game would you like to run? ")

If Lower(game) = "minecraft" or Lower(game) = "m" then openfile(minecraft.exe)


Basically, I need to know if something like "OpenFile" exists.


xlsior(Posted 2013) [#2]
ExecFile("minecraft.exe")

Although IIRC minecraft isn't actually an executable, but a java .JAR file that launches java and runs itself when you click on it?)

another tip: rather than checking the lowercase versions for a number of options, you may just want to add a single statement:
game$=lower(game$)


...after which you can just do:

If game$ = "minecraft" or game$="m" then ExecFile("c:\games\minecraft\minecraft.exe")
If game$ = "doom" or game$="d" then ExecFile("c:\games\doom\doom.exe")


without having to repeat your lower() for every check, adding more code and more processing work to the mix


Or, a different kind of notation that may make things more manageable:

Select Game$
	Case "minecraft","m"
		ExecFile("c:\games\minecraft\minecraft.exe")
	Case "doom","d"
		ExecFile("c:\games\doom\doom.exe")
	Default
		Print "Unknown Game, choose a different one!"
		WaitKey()
End Select		



Necromancer(Posted 2013) [#3]
Minecraft is a .exe for windows. On other OS's the launcher is java I believe.

Anyway, back on topic.

ExecFile works perfectly! Thank you!


Necromancer(Posted 2013) [#4]
One more question. I would make a new thread but it's related. How would I make it open a link in browser?


xlsior(Posted 2013) [#5]
One more question. I would make a new thread but it's related. How would I make it open a link in browser?


Exactly the same way:

ExecFile("http://www.yahoo.com")


Which will launch your default webbrowser and open the specified URL.


Yasha(Posted 2013) [#6]
(EDIT: both ninja'd and also wrong.)


Necromancer(Posted 2013) [#7]
Thank you!