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

User avatar
Oryan77
Dragon
Posts: 452
Joined: Sun Feb 20, 2011 3:14 pm

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

Post by Oryan77 »

I didn't expect that to happen so fast (if at all). Thanks!

Pardon my ignorance, but I don't understand why you would prefer to do it any differently than how MT does it by default when double clicking on a token and using the token's config tab method of changing token sizes.

I understand wanting the BoT to be generic. If MT is using D&D sizes already as the default sizes, aren't those technically the generic sizes? It actually seems more confusing for your average MT user to do it any differently than the generic way MT already does it in the token config tab.

I'm also confused why you mentioned on the macro that the sizes smaller than "medium" will not work in MT 1.4.x. I'm using MT 1.4.5 and the token size radial buttons that I photoshopped in the example image above came straight from a token macro I use to customize my tokens in my own framework. Using my macro to change token sizes smaller than medium works fine for me.

*edit
I know lots of systems use token sizes where the height/width do not match and I understand that is what you are doing with this macro. I only play D&D with MT and have never needed to set a token size like that. Out of curiosity, I loaded up a default MT session and can not figure out how you set a token size to anything other than the D&D sizes. How do players do this in MT?

Is there any chance you could give me the code to make the disguise macro function like it shows in my example photoshopped image so I could create a custom version of the macro for my D&D framework?

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 »

actually, MT did a lot of things right and (at least) one thing wrong: the sizes. The devs wanted to change this for quite some time, however it turns out that these sizes are used all over the code so it will be quite a massive overhaul to change this. This is why they haven't done that so far.

As for other systems, before 1.4 they were stuck with the preset sizes as you say, as of 1.4 you can set ANY size using setTokenWidth/Height, this is what I do in the code. And thus also the reason I do it that way and not using the preset sizes. (although under the hood I still partially do).

As for the code...
in the lib:ontokenmove there is the macro useDisguise (group a.) that you can change.

Code: Select all

line 72: inputStr, "Images from the table 'Polymorph' | " + tTableName + " Table Images | | TAB",
is where you need to make the change.
You need to add the line

Code: Select all

"size|unchanged, Small,Medium,Large...etc||RADIO|SPAN=TRUE VALUE=STRING"
at the bottom of that section (note that the lines are seperated by ","

at the bottom you need to add a line:

Code: Select all

[if(size !="unchanged"):setSize(size)]
that should work.

(note that you need to remove my code concerning size changes.

Nildik
Cave Troll
Posts: 76
Joined: Mon Oct 31, 2011 7:32 pm

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

Post by Nildik »

Hello
I'm trying to understand all the process involved in BOT macros. A hard try!!
Can I ask you a question Wolf?
How can you expose FOW when a door with VBL is opened?
I try to do it in code written by me, with commands exposeFow() and exposePCOnlyArea(), but doesn't work. Only when I move one token can I see through the open door. In your code works nicely.
Thanks in advance.

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 »

Figuring out the code of the BoT is hard even for me O.o

here's the full part you need (IRC):

Code: Select all

[me = getSelected]
[toks    = getTokens(",", '{ pc:1 }')]
[if(toks != ""):selectTokens(toks,1,",")]
[exposeFOW()]
[selectTokens(me)] 


point is, expose only works for the selected token, hence you select them all!

Nildik
Cave Troll
Posts: 76
Joined: Mon Oct 31, 2011 7:32 pm

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

Post by Nildik »

Aha! thank you very much!

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

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

Post by JamzTheMan »

So, here's my small contribution back, provided you don't have something similar already (sorry, still on an slightly older version for now)

Basically, using LGM's framework, there's an "invisible" macro which sets the token to "visibleToOwner" on but the red feet still showed! Oh No! Yea, PC's were like, "mmm, I think the invisible guy is right...THERE".

So, made "purple feet", added 2nd if condition, set purple feet to "visibleToOwner" on the token. Me thinks the macro should get the list of owners from the token and apply to the feet but didn't get that far yet as you actually set permissions on the "invisible" token on the object layer which is a shadow copy of the main token which actually creates the foot prints. (not sure why vs main token?) Anyhoo...got something else in the works for that...

2nd change, I set the feet to match the "size" of the token. I needed/wanted to see more clearly all the grid squares that the large token walked through. It got a little spam with all the overlapping feet so did a little "only print foot x paths unless direction change then show foot" logic. It kinda works, but you may be able to come up with some better magic.

Anyhoo, take it or leave it. Thought I'd contribute a slice of code. Note, when getting to Huge & larger tokens, the feet don't represent the whole grid very well. I'm thinking maybe adding a "cracked earth shadow" effect to the image (or in addition to?) that borders the cell a bit to show where that huge+creature really walked. We're playing Pathfinder AP Giantslayer, so, thinking ahead... :D If you have any ideas... (btw, we really LOVE the feet, for Pathfinder, seeing the path like that after the fact makes checking for Attacks of Opportunity a breeze.)


TL;DR; Added 3rd foot color for tokens only visible to owner, and resized feet to match token.
getPath

Code: Select all

[h:'<!-- ------------------- GETPATH (pathType (0 dont /1 do /2 do + no step removal /3 remove step only), Distance in pixels (1/0), Token(id)) ----------------------------------------------------- -->']
[h:'<!-- This function returns ALL points where the direction of a token path changed. For a gridless token these are the way points, for a grid token then also points will be added for non 45 degree angle diagonal movement. This function can also be used to show the entire path including the facing direction  -->']

[h,if(argCount() > 2): me = arg(2); me	= getSelected()]
[h:switchToken(me)]

[h,if(argCount() > 1): units = arg(1); units = 1]
[h:switchToken(me)]

[h,if(argCount() > 0): pathType = arg(0); pathType	= 0]
[h,if(pathType), CODE:{
	[pathFeet		= if(isPC(), "blue feet", "red feet")]
	[pathFeet		= if(getOwnerOnlyVisible(), "purple feet", pathFeet)]
	[directionLst	= "0X0Y,0X1Y,0X-1Y,1X0Y,-1X0Y,1X-1Y,-1X1Y,-1X-1Y,1X1Y"]
	[facingLst		= "none, -90,90,0,180,45,-135,135,-45"]
	[doLastStep		= 0]
	[baseMapName	= getLibProperty('baseMapName','lib:EventMacros')]
	[feetSize		= getSize()]
};{
	[doLastStep		= 1]
}]

[h,if(argCount() > 3): path = arg(3); path = getLastPath(units)]

[h, if(pathType == 3): path = "[]"]
[h:assert(!json.isEmpty(path) || pathType==3, "Token has not last path",0)]

[h,if(units): gs = bot_getGridSize() ; gs = 1]

[h,if(json.length(path)), CODE:{
	['<!-- first step -->']
	[firstStep	= json.get(path, 0)]
	[path			= json.remove(path, 0)]
	[x			= json.get(firstStep, "x")]
	[y			= json.get(firstStep, "y")]
	[direction	= ""]
	[wp			= ""]
	[point		= "{}"]
};{}]

[h: skipCount = 0]
[h, switch(feetSize):
	case "Large": sizeCount = 1;
	case "Huge": sizeCount = 2;
	case "Gargantuan": sizeCount = 3;
	case "Colossal": sizeCount = 4;
	default: sizeCount = 0
]

[h,foreach(step, path), CODE:{
	[nx			= json.get(step, "x")]
	[ny			= json.get(step, "y")]
	[ndirection	= strformat("%sX%sY", (nx-x)/gs, (ny-y)/gs)]
	
	<!-- need to distinguish between the 8 possible paths +/-(hor, vert, bDiag, fDiag)
		If the path is changed THEN the last coord BEFORE the path is changed needs to be saved and the path needs to be reset. 
	-->
		
	[if(pathType), CODE:{
		<!-- add facing to the json object -->
		[ndirection	= strformat("%sX%sY", (nx-x)/gs, (ny-y)/gs)]
		[ndir		= listFind(directionLst, ndirection)]
		[if(ndir > 0): angle = listGet(facingLst, ndir) ; broadcast("unknown or no move: "+ndirection)]
		[point		= json.set(point, "facing", angle)]
	};{}]
	
	[h: skip = pathType]
	[if (sizeCount > skipCount), CODE:{
		[skip = 0]
		[skipCount = skipCount + 1]
	};{
		[skipCount = 0]
	}]
	
	[if (direction != ndirection || skip), CODE:{
		<!-- add point to the step array EITHER always (if pathType) of when the direction changes -->
		[point	= json.set(point, "x", x, "y", y)]
		[wp		= json.append(wp, point)]
		[skipCount = 0]
	};{}] 

	[x			= nx]
	[y			= ny]
	[direction	= ndirection]
}]

[h, if(json.length(path) > 0 && doLastStep), CODE:{
	<!-- add last step as waypoint -->
	[lastStep	= json.get(path, -1,-1)]
	[nx			= json.get(lastStep, "x")]
	[ny			= json.get(lastStep, "y")]
	[ndirection	= strformat("%sX%sY", (nx-x)/gs, (ny-y)/gs)]

	[if(pathType), CODE:{
		[ndirection	= strformat("%sX%sY", (nx-x)/gs, (ny-y)/gs)]
		[ndir		= listFind(directionLst, ndirection)]
		[if(ndir > 0): angle = listGet(facingLst, ndir) ; broadcast("unknown or no move: "+ndirection)]
		[point		= json.set(point, "facing", angle)]
	};{}]
	
	[point	= json.set(point, "x", x, "y", y)]
	[wp		= json.append(wp, point)]
};{}]

[h, if(pathType), CODE:{
	<!-- remove the old steps and copy a set of feet on each step -->

	[if(pathType != 2), CODE:{
		<!-- first remove the old ones -->
		[currentFeet = getTokens(",", json.set("{}", "layer", "OBJECT", "setStates", "pathFeet"))]
		<!-- make sure that you do not delete the originals -->
		[if(listFind(currentFeet, "red feet")!=-1):		currentFeet = listDelete(currentFeet, listFind(currentFeet, "red feet")]
		[if(listFind(currentFeet, "blue feet")!=-1):	currentFeet = listDelete(currentFeet, listFind(currentFeet, "blue feet")]
		[if(listFind(currentFeet, "purple feet")!=-1):	currentFeet = listDelete(currentFeet, listFind(currentFeet, "purple feet")]
		[foreach(feet, currentFeet): removeToken(feet)]
	};{}]
	
	[if(pathType != 3), CODE:{
		<!-- then copy the new ones-->
		[foreach(p, wp,"<br>"): copyToken(pathFeet, 1, baseMapName, json.set(p, "useDistance", units, "layer", "OBJECT", "name", "w42.bot.feet", "size", feetSize))]
	};{}]
	[macro.return	= ""]
};{
	<!-- return all the points where the direction changed. -->
	[macro.return	= wp]
}]
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

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 »

thanks, ill have a look at it and implement if possible! you don't happen to have the purple feet image around?

edit: nvm, got them

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 »

ok, implemented your code and created new feet tokens with cracked earth surrounding them. I've also upgraded the resolution. version 40j. Feet can be found in the zip.

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

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

Post by JamzTheMan »

wolph42 wrote:ok, implemented your code and created new feet tokens with cracked earth surrounding them. I've also upgraded the resolution. version 40j. Feet can be found in the zip.
Oh, that was quick! :) I'll check it out the new feet...
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

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

Post by JamzTheMan »

Nice cracked effect, I'll see how it shows up in random maps as we play but should be good. Do you have that image separate in case I need to play with it's opacity?

Also note, the "purple feet" token needs the "Set Visible to Owners" checked.

And one last piece of code, it looked a little much by default for smaller tokens so I kept the original feet and added the new feet as "huge xxx feet" then added this piece after the switch(feetSize) clause:

[h, if(sizeCount >= 2), CODE:{
[h: pathFeet = "huge " + pathFeet]
}]

Also, I may take the cracked effect and randomize it a bit, throw it over and I'll play with it. Thinking if I 3-4 versions with it rotated and throw a 1d4 on it to pick "huge blue feet 3" for instance...
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

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 »

JamzTheMan wrote:Also note, the "purple feet" token needs the "Set Visible to Owners" checked.
weird I thought I set that...checked and fixed. will look at the rest later.
Attachments
feet.zip
(211.34 KiB) Downloaded 62 times

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 »

Hey Wolf, firstly - awesome job there, took me a while to actually start using BoT, but now am soo happy! Got a couple of questions though that I couldn't figure out for myself and finding an answer in 105 pages in this thread is nigh impossible ))

1. Group movement through teleport pads - is it possible at all? I set group, drag one token to the pad, it jumps, but the others are left behind.
2. Event pads for traps - the alternate image that appears, when trap is triggered (like in pit trap example) - how is that done?

And lastly, just something to do with macros in general how would I go about modifying the trap macro code to do, for example, the following (I struggle with syntax here): Trap fires 2d6 spikes at 1d20+15 vs AC, each one that hits deals 1d4+5 damage?

Thanks in advance!

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 »

Hi Zatrix,

Good to hear that its to your liking! To answer your questions:
1. that should work, I've just tested it and if I move two tokens on a teleport they're both moved? So where do you test this and how?
2. if you open the pad (double click) you will see 3 pictures in the on the config tab. the trap simply switches between those images
3. if you open the selection panel and select lib:eventmacro you'll see macros. One of them is called 'standard pit' that's the macro that is linked to the pit. (linking can be done through the BoT menu). In that macro in the part 'failed Ag test' you can add:

Code: Select all

[h:nSpikes = 2d6]
[h:damage = 0]
[h,count(nSpikes), CODE:{
  [if((1d20+15)>=AC):damage = damage + 1d4+5]
}]
 
IRC this should also work (as it saves you a code level, which are limited to 2 nested levels):

Code: Select all

[h:nSpikes = 2d6]
[h:damage = 0]
[h,count(nSpikes), if((1d20+15)>=AC):damage = damage + 1d4+5]
 

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 »

Thanks, 2 and 3 is sorted. Awesome stuff.

As for number one, see attached screens:

Two tokens in col:34 are assigned to group and the top one steps on PadJump 1 (second one is off the pad and that is exactly what I am trying to achieve, since the pad covers only 2 tiles and the real group will consist of 5 tokens.

One token then arrives at PadDrop 1 (the pentagram, also not sure why he lands not on it but next to it), while the second one remains in the previous room.
Attachments
After TP
After TP
pads2.jpg (147.87 KiB) Viewed 1370 times
Before TP
Before TP
pads1.jpg (157.27 KiB) Viewed 1370 times

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 »

ok two things. only tokens actually moved on the pad are moved, regardless of group. can't change that. so if you want to move tokens at the same time, then all of them need to be moved on the pad.
as for landing next to it, that has to do with sizes of the pads, what you can try is:
in the bot menu run settings and in the general tab check 'scale teleportation' (or uncheck if its checked).

Locked

Return to “Drop-In Macro Resources”