"compile.bat", task automation for compiling


@ECHO OFF
Rem Below variables should be changed to fit your setup
Rem example zip tool: https://www.7-zip.org/  
set COMPILER="C:\Users\yourname\Desktop\tweego\tweego"
set ZIPTOOL="C:\Program Files\7-Zip\7z.exe"
set SOURCEDIR="src"
set VENDORDIR="vendor"
set IMAGEDIR="images"
set FONTDIR="fonts"
set GAMEFILE="index.html"
set DEVZIP="web.zip"

Rem Public reading version
%COMPILER% -o %GAMEFILE% %VENDORDIR% %SOURCEDIR%

Rem illume.html shows word count and related meta information about the project; remove the "Rem" at the front of the next line if you have illume proofing format
Rem %COMPILER% -f illume -o illume.html %VENDORDIR% %SOURCEDIR%

Rem dotgraph.html shows a flow chart diagram of how the passages connect to each other; remove the "Rem" at the front of the next line if you have dotgraph proofing format
Rem %COMPILER% -f dotgraph -o dotgraph.html %VENDORDIR% %SOURCEDIR%

Rem creates a zip file to upload to itch.io
Rem %ZIPTOOL% a -tzip %DEVZIP% %FONTDIR% %IMAGEDIR% %GAMEFILE%

@ECHO OFF means to not have the command prompt show every line of instruction as it processes them.

Rem is like *comment in ChoiceScript, we can use that to give ourselves notes about what the code is doing. I commented out most commands, especially the last line in this batch file because I don’t know if you want to install 7zip onto your computer. If you want to use this method to automatically zip up compiled game file, then remember to remove the Rem at the beginning of that line.

set COMPILER= is like *set COMPILER in ChoiceScript, just giving a variable a value to later substitute whenever we want its value to be. In this case, make sure the file path of Tweego corresponds to what you have on your computer, otherwise this script can’t find the compiler.

%COMPILER% is how that variable is being used in the instruction, like ${var} in ChoiceScript.

More details on Tweego compiler command here: https://www.motoslave.net/tweego/docs/#usage-basic-examples

After you add your project folder to Visual Studio Code, you can right-click on that folder, then select “Open in Integrated Terminal”
open integrated terminal
integrated terminal

Then from there, you can type in ./compile compile
press Enter, and it should create at least an index.html file.

The next time you want to type the same command, you may try pressing the “up” key to see if the terminal remembers the previous command. If it does, then you don’t even have to type it again. So when you need to make quick edits and re-compile the code to update online, you just change code, press “up” key in the Terminal to call back the previous command, then press Enter to compile. :)

Get SugarCube code collection to emulate the look of ChoiceScript

Leave a comment

Log in with itch.io to leave a comment.