RPTools/maptool

[Bug]: @this when defining UDF does not resolve correctly

Closed this issue · 0 comments

Describe the Bug

Using defineFunction() with @this on a Lib:token results in the function definition missing the Lib: prefix.

To Reproduce

  1. Start a new campaign.
  2. Add a token named Lib:Dragon.
  3. Add an onCampaignLoad macro with this line: [h: defineFunction("example", "example@this")]
  4. Save and reload the campaign.
  5. Attempt to call the function: [r: example()].
  6. See this error:
    Must specify a location for the macro "example@Dragon" to be run from.
    Error trace : example@Dragon <<< chat
    
  7. List the defined functions ([r: getDefinedFunctions("json", true)]) and find the "example" entry. Notice the location is "example@Dragon" instead of "example@Lib:Dragon".

Expected Behaviour

@this should result in the full name of the Lib:token being used in the function definition.

Screenshots

No response

MapTool Info

1.18.1

Desktop

Linux Mint 22.1

Additional Context

No response