UnderminersTeam / UndertaleModTool

The most complete tool for modding, decompiling and unpacking Undertale (and other GameMaker games!)
GNU General Public License v3.0
1.18k stars 222 forks source link

Creating/Editing a Script not working properly (that i can tell) #1584

Open AcrossTheGames opened 10 months ago

AcrossTheGames commented 10 months ago

Describe the bug

Editing: I have a script that I made awhile back, it worked then and it worked until i changed the script that it was used in, after saving Deltarune threw the error

ERROR in action number 1 of Create Event for object :

Error on load Unable to find function scr_fakegameover_ch1

looking at the script and changing it in any way the script shows this

/ EXCEPTION! System.InvalidOperationException: Sequence contains no matching element at System.Linq.ThrowHelper.ThrowNoMatchException() at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate) at UndertaleModLib.Decompiler.Decompiler.DecompileFromBlock(DecompileContext context, Dictionary`2 blocks, Block block, List`1 tempvars, Stack`1 workQueue) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 1940 at UndertaleModLib.Decompiler.Decompiler.DecompileFromBlock(DecompileContext context, Dictionary`2 blocks, Block block) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 2638 at UndertaleModLib.Decompiler.Decompiler.Decompile(UndertaleCode code, GlobalDecompileContext globalContext, Action`1 msgDelegate) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 3800 at UndertaleModTool.UndertaleCodeEditor.<>c__DisplayClass43_0.b__1() in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModTool\Editors\UndertaleCodeEditor.xaml.cs:line 653 / from here, typing in the code editor can crash the application

Creating: Im more so confused as to how creating a script works, as far i can tell it's: Right Click "Scripts" -> "Add" -> Change name and script name -> edit script -> done But when i do that, the specific script im trying to add throws an error similar to the Editing part, but in a pop up instead, but when i do the normal

function [name]() {}

it works as intended I've tried deleting all references to the old script (minus any from pre-existing code) to no avail, it always throws an error

Reproducing steps

NO clue, the script works one minute, then it doesn't

  1. Edit code
  2. ???
  3. Script broken

  4. Create script with same name as previous script (even if it's gone)?
  5. Write code
  6. No

Setup Details

Version 0.5.1.0 Windows 10 DELTARUNE

AcrossTheGames commented 10 months ago

ok, i fixed it by changing the name of the script under the "Scripts" tab to the name it was expecting, though im still unsure of everything that happened in the first place, it worked up until recently, even earlier today it worked, and it still crashed when i tried editing the errored out code editor