OLD Wolph42's 'Drop-in' Bag of MT Tricks OLD

These are tools and utilities that make it easier to run games. This includes Lib: macro tokens dropped into MapTool to manage the game, a conversion file for CharacterTool to allow use in MapTool, or just about anything else you can think of -- except graphics with macros and anything specific to a particular campaign framework. Those are already covered by the Tilesets subforum and the Links and External Resources forum.

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

ZatriX
Kobold
Posts: 11
Joined: Mon Jun 10, 2013 4:44 am

Re: Wolph42's 'Drop-in' Bag of MT Tricks v.40 [FEATURE CHOIC

Post by ZatriX »

Ok, thanks, got it. Will have to maybe setup portals as border teleports.

Dracwrym
Cave Troll
Posts: 28
Joined: Mon Apr 10, 2017 5:50 am

Re: Wolph42's 'Drop-in' Bag of MT Tricks v.40 [FEATURE CHOIC

Post by Dracwrym »

I have this strange issue with MT 1.4.1.7 and BoT v42. When I choose to animate a door with a switch, a switch will not be added to the map. I first need to find the switch icon, add it to the map, do the settings to animate a door, and then the switch will be added to the map. I even added the folder of icons as a resource library. Is it hard coded to a specific directory?

Thanks.


trrpt
Kobold
Posts: 7
Joined: Tue Jan 10, 2017 12:17 pm

Re: Wolph42's 'Drop-in' Bag of MT Tricks v.40 [HEX GRIDS]

Post by trrpt »

My apologies if this an old question, but are the limit movement functions in the BOT not fully compatible with hex grids? I have been experimenting with this and am finding that "difficult areas" and movement-blocking VBL lines are not lining up with the hex grid. In contrast, these functions work really well on square grids.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Wolph42's 'Drop-in' Bag of MT Tricks v.40 [FEATURE CHOIC

Post by wolph42 »

Not sur e thuis had ever come up before. To be short: I've never looked at hex and have no clue whether this works correctly or not (well apparently it does not). Given how its created i woud expect it to work. So I'm guessing hex requires some love from the devs

trrpt
Kobold
Posts: 7
Joined: Tue Jan 10, 2017 12:17 pm

Re: Wolph42's 'Drop-in' Bag of MT Tricks v.40 [FEATURE CHOIC

Post by trrpt »

When you define special areas with BOT on a hex grid, the effects on a token's movement are felt one hex high and to the left of where they are supposed to be. Similarly, a token trying to move right on a hex grid is stopped by a VBL line at least a half hex before the token gets to the VBL line, while a token trying to move left on a hex grid can move on top of the VBL line, and thereby expose the FOW for the area beyond the VBL line.

I suspect that the BOT code that is used to locate special areas and the MT code used to compute VBL sight-lines (isVisible) is based on the geometry of square grids and square tokens. When you switch to a hex grid, neither the grid nor the token are square, and therefore the code has a problem with the relative locations of the token, the special areas, and the VBL lines.

User avatar
jfrazierjr
Deity
Posts: 5176
Joined: Tue Sep 11, 2007 7:31 pm

Re: Wolph42's 'Drop-in' Bag of MT Tricks v.40 [FEATURE CHOIC

Post by jfrazierjr »

trrpt wrote:When you define special areas with BOT on a hex grid, the effects on a token's movement are felt one hex high and to the left of where they are supposed to be. Similarly, a token trying to move right on a hex grid is stopped by a VBL line at least a half hex before the token gets to the VBL line, while a token trying to move left on a hex grid can move on top of the VBL line, and thereby expose the FOW for the area beyond the VBL line.

I suspect that the BOT code that is used to locate special areas and the MT code used to compute VBL sight-lines (isVisible) is based on the geometry of square grids and square tokens. When you switch to a hex grid, neither the grid nor the token are square, and therefore the code has a problem with the relative locations of the token, the special areas, and the VBL lines.
That's likely right. square grids "center point" is the top left of the square. On hex grids, its the actual center of the square. At least that's what I seem to remember from the code years ago. There is a reason for this that can't be changed in the code at least not easily. Wolph however, may be able to figure out a solution in his macros as long as the map grid type is something he can query(I don't know if it is or not).

I would be a bit surprised that the VBL does not limit movement properly on the hex grid though....
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..

trrpt
Kobold
Posts: 7
Joined: Tue Jan 10, 2017 12:17 pm

Re: Wolph42's 'Drop-in' Bag of MT Tricks v.40 [FEATURE CHOIC

Post by trrpt »

Thanks for the info, jfrazierjr. I will experiment with tweaking the "center" point of the token based on grid type. By the way, I think that the grid type can be queried as follows:

[h: gridType = json.get(json.get(getInfo("map"), "grid"), "type")]

User avatar
jfrazierjr
Deity
Posts: 5176
Joined: Tue Sep 11, 2007 7:31 pm

Re: Wolph42's 'Drop-in' Bag of MT Tricks v.40 [FEATURE CHOIC

Post by jfrazierjr »

trrpt wrote:Thanks for the info, jfrazierjr. I will experiment with tweaking the "center" point of the token based on grid type. By the way, I think that the grid type can be queried as follows:

[h: gridType = json.get(json.get(getInfo("map"), "grid"), "type")]

I seem to think 3-4 years ago when wolph was making changes constantly to this(right after I and some of the others added some of the new macro code) this topic might have come up. I could be remembering wrong, but I would absolutely suggest trying to search within this thread for "hex"
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..

trrpt
Kobold
Posts: 7
Joined: Tue Jan 10, 2017 12:17 pm

Re: Wolph42's 'Drop-in' Bag of MT Tricks v.40 [FEATURE CHOIC

Post by trrpt »

trrpt wrote:I will experiment with tweaking the "center" point of the token based on grid type.
Attached below are the changes that I made to moveVBLToken to set separate X and Y offsets for isVisible() based on the grid type and the token size. I have standardized on 5e sizes in the code below. This seems to be working now for VBL blocking on Square, Hex, and Isometric grids. I have not tried to make it work for no grid. Also, I have not tried to tackle the code for special areas.
Spoiler

Code: Select all

@@ -7,11 +7,49 @@
 [H: hasVision = if(isPC(),1,0)]
 <!-- Calc Size and center of token -->
 <!-- Test FreeSize and make sure it works correctly -->
-[H: tokenSizes = json.append("","Medium","Large","Huge","Gargantuan","FreeSize","Colossal")]
-[H: tokenSizeMod = max(1,json.indexOf(tokenSizes,getSize(id))+1)]
-[H: gridSize = json.get(json.get(getInfo("map"),"grid"),"size")]
-[H: sizeInPixels = gridSize * tokenSizeMod]
-[H: offset = round(sizeInPixels/2)]
+[h: tokSize = getSize(id)]
+[h: tokSize = if(tokSize == "Humongous", "Gargantuan", tokSize)]
+[h: tokenSizes = json.append("","Medium","Large","Huge","Gargantuan")]
+[h: tokenSizeMod = max(1,json.indexOf(tokenSizes,tokSize)+1)]
+[h: gridSize = json.get(json.get(getInfo("map"),"grid"),"size")]
+[h: sizeInPixels = gridSize * tokenSizeMod]
+[h: gridType = json.get(json.get(getInfo("map"),"grid"),"type")]
+[h, switch(gridType), code:
+   case "Square": {
+		[h: xoffset = round(sizeInPixels/2)]
+		[h: yoffset = xoffset]
+   };
+   case "Horizontal Hex": {
+		[h, if(tokSize ==  "Large"), code: {
+			[h: xoffset = round(gridSize/2)]
+			[h: yoffset = round(0.57735 * xoffset)]
+		};{
+			[h: xoffset = 0]
+			[h: yoffset = xoffset]
+		}]
+   };
+   case "Vertical Hex": {
+		[h, if(tokSize ==  "Large"), code: {
+			[h: yoffset = round(gridSize/2)]
+			[h: xoffset = round(0.57735 * yoffset)]
+		};{
+			[h: xoffset = 0]
+			[h: yoffset = xoffset]
+		}]
+   };
+   case "Isometric": {
+		[h: yoffset = round(sizeInPixels/2)]
+		[h: xoffset = 0]
+   };
+   case "None": {
+		[h: xoffset = 0]
+		[h: yoffset = xoffset]
+   };
+   default: {
+		[h: xoffset = 0]
+		[h: yoffset = xoffset]
+   }
+]
 
 <!-- Move token to first position -->
 [H: firstPosition = json.get(path,0)]
@@ -30,7 +68,7 @@
    [H, if(counter < pathLength): next = json.get(path,counter)]
    [H: x = json.get(next,"x")]
    [H: y = json.get(next,"y")]
-   [H: canSee = isVisible(x+offset,y+offset)]
+   [H: canSee = isVisible(x+xoffset,y+yoffset)]
    [H, if(canSee), code: {
       [H: moveToken(x,y,1,id)]
       [H, if(hasVision): exposeFOW()]
@@ -74,5 +112,5 @@
 <!-- This is needed to override the tokens.denyMove when using moveToken (draw order problem) -->
 [H: z = eval("0"+getProperty("elevation"))]
 <!-- set draw order based on x, y, z and token size -->
-[H: drawOrder = (y + offset) * 1000 + (x + offset) - (tokenSizeMod -1) * gridSize + floor(z/5) * gridSize]
+[H: drawOrder = (y + yoffset) * 1000 + (x + xoffset) - (tokenSizeMod -1) * gridSize + floor(z/5) * gridSize]
 [H: setTokenDrawOrder(drawOrder,id)]
\ No newline at end of file

jjensen6823
Kobold
Posts: 8
Joined: Fri Mar 10, 2017 11:25 am

Re: Wolph42's 'Drop-in' Bag of MT Tricks v.40 [FEATURE CHOIC

Post by jjensen6823 »

I'm still a Maptool and BoT novice, so I've likely done something wrong, but I am having a very strange problem on only campaigns with BoT installed. It has to do with moving tokens around. Any tokens on the object layer work just fine, but tokens on the token layer behave weirdly. With Snap to Grid off, I can drag a token around, and it moves smoothly with the pointer (as opposed to jumping from square to square the way it does when Snap to Grid is on, but the moment I release the mouse button, the token jumps onto the nearest grid square. With Snap to Grid turned on, when I move tokens around, the jump from square to square, following the mouse pointer, but when I release the button, they SOMETIMES jump diagonally one square up and to the left. If a particular token is doing it, then it does it all the time. I've closed and reopened Maptool, loaded campaigns without BoT installed, and everything is fine. But I've tried two campaigns with BoT, and they both do this. I'm sure I've screwed something up, but I'd really appreciate it if someone could help me fix it.


Dracwrym
Cave Troll
Posts: 28
Joined: Mon Apr 10, 2017 5:50 am

Re: Wolph42's 'Drop-in' Bag of MT Tricks v.40 [FEATURE CHOIC

Post by Dracwrym »

I'm now having an issue with BoT v42 and MapTools v1.4.1.7.

I'm using the door opening/closing feature with the switches next to the door. When I'm in the regular view mode, the doors open can close normally. However, when I'm in Fog of War view, I click a switch and the door opens and then closes. I need to click the switch a few times to finally make it stay open. Do you know what could be going on? Also, when I click the Toggle door button on the macro panel, the door opens and closes as normal.

Thanks.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Wolph42's 'Drop-in' Bag of MT Tricks v.40 [FEATURE CHOIC

Post by wolph42 »

yes I now what is going on. the selection of the switch activates the ontokenselection event...4 times. hence the door opens and closes 4 times. To omit this issue I've build in a delay, however when you are using fow things slow down and the delay isn't long enough. In the BoT settings there is a menu item concerning the 'delay' (i can't recall its exact name but it shouldn't be too hard to find) I think its set to 1000 (ms) you can raise that number and see if that resolves the issue. Note thus that eg setting it to 10.000 it will take 10 seconds before you can hit a switch again (or any other tokenselectionevent). HTH

Dracwrym
Cave Troll
Posts: 28
Joined: Mon Apr 10, 2017 5:50 am

Re: Wolph42's 'Drop-in' Bag of MT Tricks v.40 [FEATURE CHOIC

Post by Dracwrym »

wolph42 wrote:yes I now what is going on. the selection of the switch activates the ontokenselection event...4 times. hence the door opens and closes 4 times. To omit this issue I've build in a delay, however when you are using fow things slow down and the delay isn't long enough. In the BoT settings there is a menu item concerning the 'delay' (i can't recall its exact name but it shouldn't be too hard to find) I think its set to 1000 (ms) you can raise that number and see if that resolves the issue. Note thus that eg setting it to 10.000 it will take 10 seconds before you can hit a switch again (or any other tokenselectionevent). HTH
The default was set to 250, increasing it to 1000 made it all work right. Thanks for help. :)

Locked

Return to “Drop-In Macro Resources”