Library Token Hotkey not working until after macro button clicked?

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
enigmabrand
Kobold
Posts: 5
Joined: Sun Feb 17, 2019 2:36 pm

Library Token Hotkey not working until after macro button clicked?

Post by enigmabrand »

tl;dr - I have an issue with a macro hotkey that I have on a library token. The hotkey doesn't function until after I've selected the token and clicked the macro button in the Selection pane. After that, the hotkey works fine UNLESS in fullscreen mode.

Here's my setup:

I am testing with MapTool 1.4.1.8
I have two instances running: the first is a GM instance that starts a server and the second is a Player instance that connects to the server.

I have created the following macro named "NextPC" which finds all PC tokens on the map and selects the next one.

Code: Select all

[h: pcIds = getPC()]
[h: currentlySelectedPCId = getTokens(",", json.set("{}", "pc", 1, "selected", 1))]
[h: currIx = listFind(pcIds, currentlySelectedPCId)]
[h: pcCount = listCount(pcIds)]
[h: ixToSet = -1]
[h, if(currIx == pcCount - 1): ixToSet = 0; ixToSet = currIx + 1]
[h: selectTokens(listGet(pcIds, ixToSet))]
This works fine as a Global macro but only as the GM (due to the fact that I'm attempting to use trusted macro functions).

I followed the wiki instructions and created a Library Token whose name is "Lib:XboxController" and, using the Selection pane, added the macro there instead. As per the wiki, I have made sure of the following:

* the library token is Visible To Players
* it has the correct naming convention (Lib:XboxController)
* there is only once instance of it in the campaign file
* the token is not owned by anyone
* the macro on the library token has "Allow Players to Edit Macros" unchecked

At this point, I start a server in the GM instance of MapTool and connect to it as a player using the other instance. In the player instance if I select the library token and click the macro button for "NextPC" that is in the Selection pane, I get the following message in chat:
Only Lib:XboxController's owners can impersonate or run macros on it.
This seems to directly contradict what the wiki says (that the token is not owned by anyone). If I change the ownership of this library token to All Players the player instance is then able to run the macro by clicking the button in the Selection pane. Fine, I can change this and it works.

The final step that I need to get working for all this work to be worthwhile to me is for the macro to run when the player instance presses a hotkey.

In this macro I have chosen the Hot Key "F2" from the dropdown. Here are my expectations for how this should all work at this point:

1. GM starts Maptool and loads the campaign file that has exactly 1 copy of the library token "Lib:XboxController" in it
2. The map contains one or more PC tokens
3. GM starts a server
4. Another instance of Maptool connects to the server as a Player instance and enters fullscreen mode (ctrl+alt+enter)
5. The player instance can now press "F2" to cycle through selecting the PC tokens

The issue I am having is that step 5 does not work. After step 4, pressing "F2" on the player instance does exactly nothing. HOWEVER, if in the player instance I find and select the library token, open the Selection pane, and click on the macro button for "NextPC", it will correctly select the first PC token. At this point the "F2" hotkey begins to function as expected but not in fullscreen mode.

I have spent more than a few hours already trying to get this hotkeyed macro to work in fullscreen from the player instance but I've reached the end of the line and need some assistance. If anyone could help me figure out how to do this I would be very grateful. Basically, I want to be able to connect to the GM's server, enter fullscreen, and then be able to hit "F2" and to have my macro execute.

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: Library Token Hotkey not working until after macro button clicked?

Post by aliasmask »

That's the way hotkeys work. If the frame they're in is not visible, then it doesn't function.

enigmabrand
Kobold
Posts: 5
Joined: Sun Feb 17, 2019 2:36 pm

Re: Library Token Hotkey not working until after macro button clicked?

Post by enigmabrand »

Thanks for the response. I guess that makes my use case impossible.

Phergus
Deity
Posts: 7132
Joined: Fri May 12, 2006 8:56 pm
Location: Middle of Nowhere, NM
Contact:

Re: Library Token Hotkey not working until after macro button clicked?

Post by Phergus »

Your not really using lib:tokens as intended. You don't typically access macros directly off of them. Instead you have macros on the Campaign panel or on a character Token (Selected panel) that call into the library macros.

Code: Select all

[MACRO("getDamage@Lib:combat"): damageRoll]
[ resultVar = macro.return ] 
If you have hotkeys assigned to macros on the Campaign panel they will run whether that panel is visible or not. They won't run however in Full Screen.

enigmabrand
Kobold
Posts: 5
Joined: Sun Feb 17, 2019 2:36 pm

Re: Library Token Hotkey not working until after macro button clicked?

Post by enigmabrand »

Thanks for the reply. I actually found one of the forks of MapTool has a new hotkey for the HOME button to cycle through the tokens that you own on the current map. So I cloned that and built it locally and it works great for what I need.

Phergus
Deity
Posts: 7132
Joined: Fri May 12, 2006 8:56 pm
Location: Middle of Nowhere, NM
Contact:

Re: Library Token Hotkey not working until after macro button clicked?

Post by Phergus »

If you had just said what your goal was from the start we could have told you that. :D

The next MapTool release has that as well.

enigmabrand
Kobold
Posts: 5
Joined: Sun Feb 17, 2019 2:36 pm

Re: Library Token Hotkey not working until after macro button clicked?

Post by enigmabrand »

If you had just said what your goal was from the start we could have told you that. :D
I tried to:
I have created the following macro named "NextPC" which finds all PC tokens on the map and selects the next one.
But I'm not sure I was able to get my point across very well.

For anyone wondering, my use case is that the DM and players are in the same room. The DM starts MapTool on his/her computer and then I have a laptop connected to a projector that projects onto a table using a mirror. The projector connects as a player to the DM instance.

Then, I have XPadder set up to add keybindings to an Xbox 360 controller in order to control the PC tokens on the projected surface. I needed to be able to cycle through the PC tokens so that the players could select their own token--otherwise we would have to either have someone manning a mouse to select the token whose turn it is or just rely on the DM to move our tokens.

Since people sit around the table and see the screen from various orientations, I set up multiple "sets" in XPadder that rotate the d-pad based on where you're sitting. The gist is that when it's your turn you tap the right stick in the direction that the projector's "up" is from your point of view. When you do that, it changes the d-pad so that it makes sense from your perspective.

My XPadder config is:
[*] Select - Cycle through owned tokens (HOME)
[*] D-Pad - Move token (ARROW KEYS)
[*] A - Drop token (D)
[*] X - Set path waypoint (SPACE)
[*] Right Stick - Tap projector's "up" direction to change your orientation
[*] Left Stick - Move mouse
[*] Left Bumper - Zoom out (MOUSEWHEEL DOWN)
[*] Right Bumper - Zoom in (MOUSEWHEEL UP)
[*] Left Trigger - Mouse Right Click
[*] Right Trigger - Mouse Left Click

Phergus
Deity
Posts: 7132
Joined: Fri May 12, 2006 8:56 pm
Location: Middle of Nowhere, NM
Contact:

Re: Library Token Hotkey not working until after macro button clicked?

Post by Phergus »

Did you know that the T key also cycles through tokens? That also works in full-screen.

enigmabrand
Kobold
Posts: 5
Joined: Sun Feb 17, 2019 2:36 pm

Re: Library Token Hotkey not working until after macro button clicked?

Post by enigmabrand »

The "T" hotkey almost works but it appears to cycle through every token instead of just the ones owned by the player. I guess worst case scenario it would have worked.

Post Reply

Return to “Macros”