EDIT: I had Apply to Selected Token on. Turning it off solved my issue
For one of my projects, I'm unable to use a UDF if called from the Campaign view and no token is selected.
I get no error message, no output, no change. It is as if the function was never called.
If I use a regular macro() call instead, everything is peachy.
This seems to apply to every UDF in my current project. However, if I create a new project, the UDF I define work just fine.
Maybe there are some strange configuration issues with my current project?
As is, I'm considering replacing all my UDFs with macro calls to avoid this bug.
UDF not working if called without token selected
Moderators: dorpond, trevor, Azhrei
Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior.
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior.
UDF not working if called without token selected
MT Framework: Call of Cthulhu 7th fork, D&D 5e Spell Library
MT Scenario: Uncle Timothy's Will.
MT Utilities: Handouts, VBL Move Block, Date.
MT Scenario: Uncle Timothy's Will.
MT Utilities: Handouts, VBL Move Block, Date.
Re: UDF not working if called without token selected
If you're not going to select a token to run a UDF, then have the Apply to Selected unchecked. This is true for UDFs and regular macro calls. Apply to Selected requires you have a macro selected, duh
So, as a side note the Impersonated Token may not be the currentToken().
There is one weird thing though about running macros and switchToken(). If a player is logged in as the token name switched to, then it also becomes the impersonated token. Not sure if this happens during the macro or after the macro runs. Just another MT quirk.
So, as a side note the Impersonated Token may not be the currentToken().
There is one weird thing though about running macros and switchToken(). If a player is logged in as the token name switched to, then it also becomes the impersonated token. Not sure if this happens during the macro or after the macro runs. Just another MT quirk.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
- Full Bleed
- Demigod
- Posts: 4736
- Joined: Sun Feb 25, 2007 11:53 am
- Location: FL
Re: UDF not working if called without token selected
I've seen this before (some macros seeming to trigger impersonation)... but wasn't sure what was causing it. So this is new info to me and I might be able to use it trigger impersonation of player tokens when my players login so they don't have to do it manually every time.aliasmask wrote: ↑Mon Jul 01, 2019 7:10 pmThere is one weird thing though about running macros and switchToken(). If a player is logged in as the token name switched to, then it also becomes the impersonated token. Not sure if this happens during the macro or after the macro runs. Just another MT quirk.
I've always lamented not being able to setImpersonate via a macro since impersonation is essential in my framework. But last time I brought this up I ended up getting shot down because, of course, we have Wiki: switchToken() and I'm doing it wrong if I don't just use that... had I understood that better early on I probably would have avoided impersonation completely... it just muddies the water.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."
Re: UDF not working if called without token selected
I noticed that if you have "Apply to Selected Tokens" enabled, it automatically impersonates the selected token for the duration of the macro. Not so if you have it disabled.Full Bleed wrote: ↑Mon Jul 01, 2019 10:03 pmI've seen this before (some macros seeming to trigger impersonation)... but wasn't sure what was causing it.
MT Framework: Call of Cthulhu 7th fork, D&D 5e Spell Library
MT Scenario: Uncle Timothy's Will.
MT Utilities: Handouts, VBL Move Block, Date.
MT Scenario: Uncle Timothy's Will.
MT Utilities: Handouts, VBL Move Block, Date.
Re: UDF not working if called without token selected
I would try not to use the language "impersonate". Apply to selected makes the current token the currentToken(). I loops through all the selected tokens and runs the macro for each of them. Impersonation is a chat only thing.Merudo wrote: ↑Tue Jul 02, 2019 4:23 pmI noticed that if you have "Apply to Selected Tokens" enabled, it automatically impersonates the selected token for the duration of the macro. Not so if you have it disabled.Full Bleed wrote: ↑Mon Jul 01, 2019 10:03 pmI've seen this before (some macros seeming to trigger impersonation)... but wasn't sure what was causing it.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Re: UDF not working if called without token selected
I use "impersonation" as what is returned when using the function hasImpersonated() and getImpersonated().aliasmask wrote: ↑Wed Jul 03, 2019 12:33 amI would try not to use the language "impersonate". Apply to selected makes the current token the currentToken(). I loops through all the selected tokens and runs the macro for each of them. Impersonation is a chat only thing.Merudo wrote: ↑Tue Jul 02, 2019 4:23 pmI noticed that if you have "Apply to Selected Tokens" enabled, it automatically impersonates the selected token for the duration of the macro. Not so if you have it disabled.Full Bleed wrote: ↑Mon Jul 01, 2019 10:03 pmI've seen this before (some macros seeming to trigger impersonation)... but wasn't sure what was causing it.
When using getImpersonated() in a macro it returns the impersonated token, unless if you have "Apply to Selected Tokens" enabled in which case getImpersonated() returns the current token... Very nonintuitive to say the least!
MT Framework: Call of Cthulhu 7th fork, D&D 5e Spell Library
MT Scenario: Uncle Timothy's Will.
MT Utilities: Handouts, VBL Move Block, Date.
MT Scenario: Uncle Timothy's Will.
MT Utilities: Handouts, VBL Move Block, Date.