Skip to content

Commit

Permalink
Add VariableFixer script to fix a bug that prevents the game from loa…
Browse files Browse the repository at this point in the history
…ding
  • Loading branch information
Grossley committed Jun 21, 2021
1 parent 2dfea20 commit 8e10f89
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
29 changes: 29 additions & 0 deletions UndertaleModTool/CommunityScripts/VariableFixer.csx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Made by Creepersbane
ScriptMessage(@"This script will most likely fix data files with the following symptoms:
If, after loading the data file after code editing, any of the following occur:
No window appears at all
""Out of memory!"" error appears while loading
No "".gamelog.txt"" is produced
The "".gamelog.txt"" is produced but appears to fail after Steam initialization.
The game window appears but is frozen indefinitely
");
Data.GeneralInfo.DisableDebugger = true;
int globalNum = 0;
int selfNum = 0;
foreach(var vari in Data.Variables)
{
if (vari.InstanceType == UndertaleInstruction.InstanceType.Global)
{
vari.VarID = globalNum++;
}
else if ((vari.InstanceType == UndertaleInstruction.InstanceType.Self) && (vari.VarID >= 0))
{
vari.VarID = selfNum++;
}
}
Data.VarCount1 = (uint)globalNum;
Data.VarCount2 = (uint)selfNum;

ScriptMessage(@"Complete, please save and run the game now to apply and test your changes.");
3 changes: 3 additions & 0 deletions UndertaleModTool/UndertaleModTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
<None Update="CommunityScripts\SimplifyBattlegroupScript.csx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="CommunityScripts\VariableFixer.csx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Corrections\0bf582aa180983a9ffa721aa2be2f273\Main\gml_Object_obj_backgrounder_dock_Other_10.gml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
Expand Down

0 comments on commit 8e10f89

Please sign in to comment.