UndertaleModTool icon indicating copy to clipboard operation
UndertaleModTool copied to clipboard

Using 'self' Throws Error "Expected token kind ProcVariable, got ProcFunction"

Open tmaster-terrarian opened this issue 3 years ago • 6 comments

Describe the bug

When using self it throws an error when it should work (I tested in actual gamemaker and it works there) Image: image

Reproducing steps

  1. write self.<insert any local function here>
  2. attempt to compile
  3. viola, error

Setup Details

UndertaleModTool Version: bleeding-edge c897860 OS: Windows 10 Game: Benbo Quest 2: BenboWars https://thumbtack.itch.io/benbowars

tmaster-terrarian avatar Dec 06 '22 02:12 tmaster-terrarian

Has any workaround been found for this?

vorechick69 avatar Feb 15 '23 21:02 vorechick69

You should be able to edit it in the disassembly bytecode. Maybe the following steps:

  1. call it as a global function (center_camera(0, x, y))
  2. Switch to Disassembly tab
  3. Change the following bytecode from
call.i center_camera(argc=3)

to

call.i @@This@@(argc=0)
push.v builtin.center_camera
callv.v 3
  1. Type "center_camera" into the tool search bar.
  2. Delete the bottom result from Functions.

Jacky720 avatar Feb 16 '23 01:02 Jacky720

Any way to do this through the CLI? Using Linux.

vorechick69 avatar Feb 16 '23 16:02 vorechick69

Try Wine or a Windows VM if you can. It might be possible to script, but the assembler isn't as open as the compiler. Wait, there are ExportASM and ImportASM, right? You could use those. Deleting the function should be easier to script too.

Jacky720 avatar Feb 16 '23 16:02 Jacky720

Does the workaround still work? While this solution does make the code compile, in-game, it's just causing a "Variable not set before reading it." error.

Lionmeow avatar Oct 21 '23 20:10 Lionmeow

The only reason I could guess that happening is if you also edited the function's definition and it broke as a result. At that point I might just recommend using a user event or global script.

Jacky720 avatar Oct 22 '23 02:10 Jacky720

@colinator27 status?

Miepee avatar Mar 22 '25 17:03 Miepee

This should be fixed now, on latest bleeding edge.

colinator27 avatar Mar 22 '25 20:03 colinator27