Game Launcher Program
BlitzPlus Forums/BlitzPlus Beginners Area/Game Launcher Program
| ||
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. |
| ||
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 |
| ||
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! |
| ||
One more question. I would make a new thread but it's related. How would I make it open a link in browser? |
| ||
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. |
| ||
(EDIT: both ninja'd and also wrong.) |
| ||
Thank you! |