Packaging and commandline?
baskham
09 Feb 2018, 20:43Hi.
I am new to Quest.
But I must say it looks really exciting!!
I am planning on creating a game for my grandson.
It is going to be a spy thriller.
But I would like to give it to him on a USB stick .
That way the spy stuff would start right away before the game has even started.
Along with a letter like "your assignment, should you choose to accept it, bla bla bla" :-)
So I would like to have a fully runnable instance of Quest on the USB stick along with the game itself.
Is this possible?
I guess I am looking for some sort of portable version :-)
The next thing of course is to actually start the game from a commandline.
Perhaps as an autoplay.
I have tried playing around a little bit with running quest.exe from a command line and then giving the game.quest file as a parameter.
But I can't seem to get it working.
Best Regards
Benny

K.V.
09 Feb 2018, 22:31This should be possible.
Give me a few minutes.

K.V.
09 Feb 2018, 22:58I've pretty much got it working, and I've almost got the post ready.
You mentioned it opening a letter, which I haven't included in the example, but, if you like the way things work, we can include a bit where it opens a file or a website. (I suggest just using Quest for the letter, though. It's just an embedded browser with lots of bells and whistles.)
Be back with code in 10 minutes, max. I'm making sure Quest will run from a USB drive on a PC that's never had Quest installed on it first.

K.V.
09 Feb 2018, 23:46Starting up Quest from the command line
You can do this to play a game, but I think things would behave strangely if you tried to edit from a USB. (I may be mistaken.)
The trick is, you have to enter the full path of Quest.exe and the game file.
The current mission
If Quest is not installed on your current device, install Quest.
The installer will ask where to install it. You can browse to the USB drive and install it there, choosing NOT to create files in your start menu.
If Quest is installed on your current device.
1. Copy the "Quest 5" folder from your "Program Files (x86)" folder.
NOTE: If you have 32 bit Windows, it will be in "Program Files".
2. Paste the Quest 5 folder directly onto your USB drive in F:
Now, you should have the folder "Quest 5" on the USB.
Inside of that, you should see Quest.exe.
NEXT
Make a game and publish it. (Meaning click on "Publish" to compile it, not to actually publish it online.)
We'll say you name that game "Spy Game". This will create the file "Spy Game.quest".
Now, copy that file, and drop it directly onto the USB as well.
Now you should have two things on the USB:
"Quest 5"
"Spy Game.quest"
Now for the batch file:
SECRET_FILE.BAT
@echo off
title INCOMING MESSAGE
set /P =You have a new mission. Press any key to accept.< NUL
pause > NUL
cls
echo RUNNING PROGRAM
"%CD%\Quest 5\Quest.exe" "%CD%\Spy Game.quest"
exit
Drop the .bat file onto the USB.
Now, you can put that USB into another device, run SECRET_FILE.bat, and this will happen:
You can right-click on the two files that aren't SECRET_FILE.BAT, then select 'Properties' to render them 'Hidden'.
Then, the folder will only show the .bat file (if the system isn't set up to show hidden folders).
NOTES:
The internet says you can't make a USB automatically load anything when inserted these days. (I looked around for a while. It seems you can't do that since Windows 7.)
So, you would have to run SECRET_FILE.BAT to start the show.
(You could rename SECRET_FILE.BAT to whatever you wish.)
The .bat script has been edited.
mrangel provided an easy way to avoid worrying about which drive letter might be assigned to the USB .

K.V.
10 Feb 2018, 00:36PS
The system needs to have Microsoft .NET Framework 4 installed.
(I don't think it can be on the USB. I'm fairly certain it has to be installed on the system. Sometimes people have it already, some don't. I don't think it comes built-in with any version of Windows, either. But, again, I'm just thinking all this stuff.)
https://www.microsoft.com/en-us/download/details.aspx?id=17851
You could just put the Quest installer on a USB, along with the game file and the feelies, and I could write a .bat script that installed Quest to the PC then opened the game (and/or feelies) once the installation is complete. The Quest installer installs dotnet40 if it's not on the system.
That way, the game, Quest, and everything else would be on his local drive after the first play.
(Just a suggestion.)
baskham
10 Feb 2018, 07:31Wow!!!
Thank you so much K.V.
This is exactly what I wanted to do.
And it works beutifully.
But I may not have been completely clear about the letter thing.
I am planning ón handing him a physical envelope containing the USB stick, a letter and maybe a pair of dark sunglaces :-)
I am sure he is going to love it.
But once again thank you so much.
BR Benny
mrangel
10 Feb 2018, 11:20If you don't know what the drive letter will be (given that it depends on what drives the computer has), you can use %CD%
to refer to the folder that contains the .bat file.

K.V.
10 Feb 2018, 15:12%CD%
Ha! Sweet!
Thanks, mrangel!
(The script has been edited.)

K.V.
10 Feb 2018, 15:26I'm glad it worked!
...and your letter idea sounds much cooler than what I was thinking you meant.
If I was a kid, I'd dig it! (Heck, I'd dig it as an adult!)
I just realized:
If he saves the game, this script will start him over from the beginning of the game.
Quest creates a save file when you save, and you must open that file to pick up where you left off.
The player chooses where to save the file, but, being that Quest wouldn't actually be installed this way, Windows probably wouldn't associate the save file's extension with Quest (or anything at all, for that matter).
So, hiding the files on the USB may not be a good idea. To open a save, he'd either have to run that script then stop the game and load the saved game, OR go into the 'Quest 5' folder to run Quest.exe, then load the saved game.
Just so I can come back here for it later, and for completion's sake, I plan to post one more script which shows how to do this same thing, only actually installing Quest to the system before running the game, to be sure all saves can be played by simply clicking them.