What is IsaacScript Doing?
The isaacscript program will run forever until you close the terminal window or cancel it with Ctrl + c. While it runs, it monitors for changes in your project. In summary, it will:
- automatically recompile your TypeScript as soon as you save a
.tsfile - automatically copy over any files in the
moddirectory - automatically refresh your mod in-game (with the
luamodconsole command)
As a new user, you might want to confirm that each of these functions is working properly as a way to get familiar with the program.
🔄 Confirm That Auto-Mod-Reloading Works
The moment that you save a TypeScript file, isaacscript will detect that something has changed, and it will automatically perform the following steps:
isaacscriptwill re-compile your TypeScript project usingtstl, the TypeScriptToLua tool.tstlwill spit out a file calledmain.luain your project'smodfolder. (e.g.C:\Repositories\revelations\mod\main.lua)isaacscriptwill copy this file to themodsdirectory. (e.g.C:\Program Files (x86)\Steam\steamapps\common\The Binding of Isaac Rebirth\mods\revelations\main.lua)- If you have the game open and are in a run,
isaacscriptwill then send a message to a helper mod calledisaacscript-watcher. isaacscript-watcherwill run theluamodconsole command corresponding to your project. (e.g.luamod revelations)- After the
luamodcommand is executed, your mod has been reloaded - it is now ready to test! - If compilation failed for any reason, then you will be able to see the errors on both the
isaacscriptconsole window and in-game. (Theisaacscript-watchermod will draw it on the screen for you.)
Note that isaacscript will automatically install the isaacscript-watcher helper mod for you, so you don't have to do anything. Just test to see that it works:
- Make sure that
isaacscriptis running in a shell, monitoring for changes in your project. - In-game, go into a run.
- In VSCode, add something new to your
main.tsfile, like:print("hello world"); - In VSCode, save the file.
- In game, you should see text appear on the screen. (i.e. Something along the lines of "Compilation successful.")
- In game, press
`to open the console and see if your "hello world" message is printed there.
📁 Confirm That File Cloning Works
isaacscript will automatically sync the contents of the mod directory in your project to the corresponding folder in mods.
For example:
- Say that you have a project directory of:
C:\Repositories\revelations\ - Then, inside your project mod folder, you make some new subdirectories:
C:\Repositories\revelations\mod\resources\gfx\items\collectibles\- (This is the directory that you are supposed to put graphics files in for new modded items.)
- Next, you put a new file in that directory:
C:\Repositories\revelations\mod\resources\gfx\items\collectibles\collectibles_new_item.png - Now,
isaacscriptautomatically copies thecollectibles_new_item.pngfile to:C:\Program Files (x86)\Steam\steamapps\common\The Binding of Isaac Rebirth\mods\revelations\resources\gfx\items\collectibles\collectibles_new_item.png
For now, just put something in your mod folder and confirm that isaacscript copies it over for you.
Remember that if you add non-code assets to your mod, you have to fully restart the game in order for the game to start using them.