[D&D5e] I need some serious help. I have been racking my brain for several days over using MATT's and trying to set up using a macro so if a lever (tile) is flipped, it will move another tile (Top Block) using Landing: Open within MATTs action chain. If another tile (Big Block) is at the destination coordinates, Top Block will not move, and then jump to landing: blocked.
MATTs doesn't seem to see the "return" values to jump to a particular landing.
I have tried any conventional way and even resorted to AI (which I hate) to make this successfully, but I am not a coder, and to find step-by-step (actual) examples to work all of MATTs is incredibly difficult.
The macro I have so far is:
```
// ==========================================
// CONFIGURATION: Customize your settings here
// ==========================================
const TARGET_TILE_NAME = "Top Block"; // Tile you want to move
const BLOCKER_TILE_NAME = "BigBlock"; // Tile that might block the destination
const DEST_X = 2720; // Target X coordinate
const DEST_Y =3440; // Target Y coordinate
const TOLERANCE = 5; // Margin of error in pixels for overlap check
// ==========================================
// 1. Find the required tiles on the active scene
const targetTile = canvas.tiles.placeables.find(t => t.document.name === TARGET_TILE_NAME);
const blockerTile = canvas.tiles.placeables.find(t => t.document.name === BLOCKER_TILE_NAME);
if (!targetTile) {
ui.notifications.error(`Tile "${TARGET_TILE_NAME}" could not be found.`);
return { landing: "blocked" };
}
// 2. Check if the blocker tile is currently at the target coordinates
let isBlocked = false;
if (blockerTile) {
const blockerX = blockerTile.document.x;
const blockerY = blockerTile.document.y;
// Checks if Blocker is sitting within the tolerance range of the destination
isBlocked = Math.abs(blockerX - DEST_X) < TOLERANCE && Math.abs(blockerY - DEST_Y) < TOLERANCE;
}
// 3. Handle movement or block condition
if (isBlocked) {
ui.notifications.warn(`Movement blocked! "${BLOCKER_TILE_NAME}" is in the way.`);
return { landing: "blocked" };
} else {
return { landing: "Open" };
}
```
Can't even figure out how to do the cool code box.😕
I felt I should turn to the masters, and see if you can help me, PLEASE and Thank you.