Skip to content

Controlling Lock View Using Macros

Material Foundry edited this page Nov 8, 2025 · 2 revisions

This wiki is outdated. Use this documentation for Lock View v2+.

Moving the Player View by Specific Grid Spaces

This macro will allow the GM to move the player view by a specified amount of grid spaces. There's 3 versions, one without using macro arguments, one with arguments for Foundry v10 and one with arguments for Foundry v11.
Using arguments can be useful since you'll only need to make 1 macro for any kind of move.

No Macro Arguments

Create a new script macro and copy and paste the code below.
Specify the amount of grid spaces to move in the first 2 lines and call this macro whichever way you like.

const x = 5;  //Amount of grid spaces to move in x-direction
const y = 5;  //Amount of grid spaces to move in y-direction

game.socket.emit(`module.LockView`, {"msgType": "newView","users": "all","shiftX": x,"shiftY": y,"scaleSett": 0,"rotateSett": null, "type": "grid"});

Macro Arguments in Foundry v10

To use macro arguments in Foundry v10 you'll need to install and enable the Advanced Macros module. Make sure you get the v10 compatible one (v1.19).

To use it, create a new script macro and copy the code below.
Calling the macro from chat (replace "Move Player View" with the name of the macro), type: /amacro "Move Player View" 1 2
Calling the macro using Material Deck: Configure a macro action to call a macro by name or from the macro board, configure it to use this macro, and fill in the following as macro arguments: 1 2
Either way will move the view 1 space to the right and 2 to the bottom. Change the numbers to change how the view should move.

const x = args[0];
const y = args[1];

game.socket.emit(`module.LockView`, {"msgType": "newView","users": "all","shiftX": x,"shiftY": y,"scaleSett": 0,"rotateSett": null, "type": "grid"});

Macro Arguments in Foundry v11

In Foundry v11 you don't need to install a module to use macro arguments.
Calling the macro from the console (replace "Move Player View" with the name of the macro): game.macros.find(m => m.name === "Move Player View").execute({x:1, y:2})
Calling the macro using Material Deck: Configure a macro action to call a macro by name or from the macro board, configure it to use this macro, and fill in the following as macro arguments: {"x":1, "y":2}
Either way will move the view 1 space to the right and 2 to the bottom. Change the x and y values to change how the view should move.

const x = scope.x;
const y = scope.y;

game.socket.emit(`module.LockView`, {"msgType": "newView","users": "all","shiftX": x,"shiftY": y,"scaleSett": 0,"rotateSett": null, "type": "grid"});

Clone this wiki locally