Forts
Not enough ratings
Dump - Moonshot Commander Scripts
   
Award
Favorite
Favorited
Unfavorite
Mods: Mod, Misc
Vanilla
File Size
Posted
211.071 KB
20 Jul, 2019 @ 11:15am
1 Change Note ( view )

Subscribe to download
Dump - Moonshot Commander Scripts

In 1 collection by Endo
Endo's Mods
14 items
Description
Dumps the Lua logic of Moonshot commanders in Base-64 format.

Instructions:
0) Run a skirmish or multiplayer game with the commander selected
1) Find your log and search through it until you find the data of the commander you need
How to find your log:
Your_Steamapps_Directory\common\Forts\users\Your_Username\log.txt

—— If you don't need to find out what a function of the commander script does, you're basically finished here. Just copy-'n'-paste the start and end of the dump in the log to another text file
If you need a Lua function decompiled, follow the next steps:

2) Find function to dump in the log. They take the format of:
-- <function_name> function: <some_hex_number> <function_name> = loadstring(Base64dec([[ <base64-encoded_function_dump> ]]))
3) Grab the <base64-encoded_function_dump> part and put it into a Base64 decoder that allows you to DL the decoded data as a file, like this one[base64converter.com]
4) Optional: Rename download.bin to something else
5.1) Download UnLuaC[sourceforge.net], a Java-based Lua 5.1 decompiler
5.2) Make sure you have the Java Runtime[java.com] installed (you must have Java in your PATH variable[kingluddite.com])
6) Put the script next to the unluac jar file
7) Hold [shift] + [right-click] on the folder containing the two files and click "Open command window here"
8) Type:
java -jar <name_of_unluac_jar_file> <your_decoded_base64_file> > <output_script_file_path>
Important: Don't forget the > sign before the <output_script_file_path>
9) Open the output file, scroll to the end; If you don't see anything with "stacktrace", you're good—but if there are errors, then you're likely out of luck


Copying
Copying any part of this mod is allowed under attribution.
5 Comments
kevplayclahs 16 Jan, 2024 @ 10:51am 
Hello Endo, i use you mod from steam workshop to get the scripts from Moonshoot commanders ,but i got small problem ,i did all that things in you description but i got the problem that i cant use 2 off the needed programms and i saw it the commands that you have that script data that i need ,I am asking if you can send me that data ??
Harder_天使的花园 4 Sep, 2021 @ 7:44pm 
You can use Log to output code.

skipperwraith 30 Dec, 2019 @ 8:02am 
@EndoRPY the unluac file cant be accesed by powershell
Endo  [author] 14 Aug, 2019 @ 11:02am 
@ Tea And Toast It dumps the functions from the commander.lua files of the DLC, but because of tight restrictions on what you can do in mods, all the instructions above are required.

Since the devs seemed too preoccupied with other things, this is just a simple workaround for being able to reverse-engineer and document some aspects of the modding API.
Though currently, there has yet to be someone that uses this mod to document the inner workings of the DLC's commander.lua scripts. Usually I'm the one posting cleaned-up dumps of the scripts on the Forts Discord, however currently, real life takes precedence.
Toasty 9 Aug, 2019 @ 11:47am 
What exactly does this mod do Endo?