help with: Reveal hidden tokens macro, PLS?!?!

Doc requests, organization, and submissions

Moderators: dorpond, trevor, Azhrei

User avatar
Slayve2DnD
Dragon
Posts: 455
Joined: Thu Dec 18, 2008 1:06 am

help with: Reveal hidden tokens macro, PLS?!?!

Post by Slayve2DnD »

Ok, so assume I'm pretty much a complete noob at macros (which for the most part I am, I can figure out very basic things and make macros on those, but nothing fancy yet. What I NEED is a macro to reveal some tokens I will have somewhere nearby an encounter triggered by an event during the encounter. I'm trying to streamline things so I don't have to change layers then right click, scroll and left click...it becomes tedious and time consuming during a epic battle, where I feel players would get miffed sitting there unable to continue till the DM is done messing with layers and right click slowness. So can someone write me a macro that can reveal 2 of the same hidden token (only difference is a GM name for my own tracking to keep my players guessing). I'm currently using build 50 and am thinking of updating soon, so hoping it will work from 50+. Thanks in advance.
I'm not retarded...I'm a simple creature...there is a difference.

User avatar
Veggiesama
Dragon
Posts: 619
Joined: Wed Aug 29, 2007 1:18 am

Re: help with: Reveal hidden tokens macro, PLS?!?!

Post by Veggiesama »

Do you think it's too slow to select all the tokens at the same time (click and drag, or hold Shift while clicking each token) and then change the visibility for all of them once?
My D&D 4e Campaign FrameworkMy Shadowrun 4e Campaign Framework
RPGA#: 5223846427 — Skype: Veggiesama — Fear the ferret.

User avatar
Slayve2DnD
Dragon
Posts: 455
Joined: Thu Dec 18, 2008 1:06 am

Re: help with: Reveal hidden tokens macro, PLS?!?!

Post by Slayve2DnD »

I have to go with yes. When MapTool encounters are taking 30-50 minutes each anything slowing the tide of battle for more than half a second click is too long. Especially when the encounter will have stages to it, such as the one I'm trying to plan. I need the macro so I don't have to stop the battle, tel my players "wait a minute while I do this" then resume. Disrupting the flow hurts the immersion.

EDIT: Upon realizing who you were, I checked out your link to the 4e campaign lib tool you have. And now have a few questions that weren't answered reading your post. ONE, does your tool have a "reveal" macro like I'm looking for? TWO, with power macros, does your tool reference the defenses it targets? If it does reference the targeted defense, does it understand that hit would trigger the damage and miss would not unless stated in the power? I guess I'm trying to understand everything your tool can do because I've heard good things, and I'm trying to make things more simple in my campaigns to cut down on time consumed in my BASIC understanding of macros.

Edit2: Also does your tool come with a REAL health bar, meaning something that has a set number versus the percentage bar given by MapTool?
I'm not retarded...I'm a simple creature...there is a difference.

User avatar
Veggiesama
Dragon
Posts: 619
Joined: Wed Aug 29, 2007 1:18 am

Re: help with: Reveal hidden tokens macro, PLS?!?!

Post by Veggiesama »

1. If you want to use macros to locate tokens, make sure they have different names. Otherwise it's difficult to find them, macros will get confused, and so on.

2. The functions you're looking for are Wiki: setLayer() and/or Wiki: setVisible(). Use Wiki: findToken() to get a token's ID by searching for a token's name.

This macro will toggle hiding/unhiding a token named Barney:

Code: Select all

[H: tokenName = "Barney"]
[H: tokenID = findToken(tokenName)]
[H: isVisible = getVisible(tokenID)]
[H: setVisible(!isVisible, tokenID)]
You could make a list of targets to toggle visibility this way:

Code: Select all

[H: tokenNameList = "Barney, Fred, Wilma, Betty"]
[H, FOREACH(tokenName, tokenNameList), CODE: {
  [H: tokenID = findToken(tokenName)]
  [H: isVisible = getVisible(tokenID)]
  [H: setVisible(!isVisible, tokenID)]
}]
3. Don't think I have anything in the tool that messes with visibilities.

4. Yes, powers in my framework reference which target defense they are aiming for, but they do not compare the attack versus the defense and automatically arbitrate damage. I leave that to be done manually, because sometimes people like it, sometimes they want to interrupt the damage, and sometimes it's difficult to know how to deal with the damage (does the target have resistance? how do players set resistance? what if someone forgets to set their resistance, leaves it on too long, etc.?). Rumble's framework DOES arbitrate, though, so you might want to check out that.

5. Not sure what you mean by real health bar. Do you mean the text "30 / 50 hp", for example? If so, then that's found on the pop-up stat sheet in addition to a green bar that shows a percentage of remaining health (and healing surges). You can even turn the green bar off and rely totally on the stat-sheet HP if so inclined.
My D&D 4e Campaign FrameworkMy Shadowrun 4e Campaign Framework
RPGA#: 5223846427 — Skype: Veggiesama — Fear the ferret.

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: help with: Reveal hidden tokens macro, PLS?!?!

Post by Azhrei »

Slayve2DnD wrote:Edit2: Also does your tool come with a REAL health bar, meaning something that has a set number versus the percentage bar given by MapTool?
Heh-heh, this made me chuckle. I have to wonder what you think a "REAL" health bar would be? I'm inclined to think you haven't thought too hard about exactly what you want. ;)

User avatar
Slayve2DnD
Dragon
Posts: 455
Joined: Thu Dec 18, 2008 1:06 am

Re: help with: Reveal hidden tokens macro, PLS?!?!

Post by Slayve2DnD »

Azhrei wrote:
Slayve2DnD wrote:Edit2: Also does your tool come with a REAL health bar, meaning something that has a set number versus the percentage bar given by MapTool?
Heh-heh, this made me chuckle. I have to wonder what you think a "REAL" health bar would be? I'm inclined to think you haven't thought too hard about exactly what you want. ;)
Whats unclear about I want to show a bar on a token with a finite number at any level and be able to decrease it by increments of 1 instead of a slider bar that ONLY shows a percentage? It's too time consuming to sit there and figure out the percentage of health a player or mob has. I want to show that x-player has 15 out of 37 health at level 1, not "JFC what % should x-players bar be set near to represent 15/37 when the bar shows 0 - 100 in increments of 10%" Yes you can quickly acknowledge a "bloody" with 50% bar and whatever your bloody state image might be, but what good is it when its slowing down the flow?
I'm not retarded...I'm a simple creature...there is a difference.

User avatar
Slayve2DnD
Dragon
Posts: 455
Joined: Thu Dec 18, 2008 1:06 am

Re: help with: Reveal hidden tokens macro, PLS?!?!

Post by Slayve2DnD »

Thanks Veggiesama.
I'm not retarded...I'm a simple creature...there is a difference.

User avatar
Veggiesama
Dragon
Posts: 619
Joined: Wed Aug 29, 2007 1:18 am

Re: help with: Reveal hidden tokens macro, PLS?!?!

Post by Veggiesama »

What the macro systems do is divide your CurrentHP / MaxHP to arrive at a decimal percentage (0.0 to 1.0), then they set the health bar to that. No manual sliding required.
My D&D 4e Campaign FrameworkMy Shadowrun 4e Campaign Framework
RPGA#: 5223846427 — Skype: Veggiesama — Fear the ferret.

User avatar
zEal
Dragon
Posts: 944
Joined: Sun Mar 22, 2009 2:25 am

Re: help with: Reveal hidden tokens macro, PLS?!?!

Post by zEal »

Slayve2DnD wrote:
Azhrei wrote:
Slayve2DnD wrote:Edit2: Also does your tool come with a REAL health bar, meaning something that has a set number versus the percentage bar given by MapTool?
Heh-heh, this made me chuckle. I have to wonder what you think a "REAL" health bar would be? I'm inclined to think you haven't thought too hard about exactly what you want. ;)
Whats unclear about I want to show a bar on a token with a finite number at any level and be able to decrease it by increments of 1 instead of a slider bar that ONLY shows a percentage? It's too time consuming to sit there and figure out the percentage of health a player or mob has. I want to show that x-player has 15 out of 37 health at level 1, not "JFC what % should x-players bar be set near to represent 15/37 when the bar shows 0 - 100 in increments of 10%" Yes you can quickly acknowledge a "bloody" with 50% bar and whatever your bloody state image might be, but what good is it when its slowing down the flow?
What wasn't clear was what you meant by "REAL". Now that you've explained what makes a health bar "REAL" in your eyes, I have couple questions regarding your "REAL" health bars.

How would the bar determine how many.. I hesitate to use 'increments' since that has a different meaning in reference to bars.. how many 'points' the bar should have the slider move between?

Should it be based on a setting for the bar? If that's the case, would we have to make a separate bar for each token?

Should it based on a token property? If so, which property? My current system of choice doesn't use Hit Points and I would loathe being forced to. Does this mean I wouldn't be able to use "REAL" health bars?

I'm actually rather surprised that someone that seems so keen on shaving seconds off of interface time wherever possible would even use the very slow, and not to mention somewhat clunky, slider interface for bars at all.

User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: help with: Reveal hidden tokens macro, PLS?!?!

Post by Rumble »

An alternate solution to the bar problem (which is tricky, since you'd need an independent bar for every token and potentially have to create new images - if you used unique images - for each possible combination of values) is to use the statsheet (the popup image when you mouseover) and have it display hit points in this fashion:

HP: 36 / 54

To do that, you need to configure the tokens properties with something like:

Code: Select all

CurrentHP:
MaxHP:
*DisplayHP(HP): { CurrentHP } / { MaxHP}
It would look something like:
hpsample.png
hpsample.png (118.19 KiB) Viewed 2333 times
Then, when you mouse over the token, the HP is displayed as an actual number, as well as indicating the maximum possible.

User avatar
Slayve2DnD
Dragon
Posts: 455
Joined: Thu Dec 18, 2008 1:06 am

Re: help with: Reveal hidden tokens macro, PLS?!?!

Post by Slayve2DnD »

I'm less keen on the slider myself, text is very useful, and easier, but I wouldn't know how to begin to program that.
Rumble wrote:An alternate solution to the bar problem (which is tricky, since you'd need an independent bar for every token and potentially have to create new images - if you used unique images - for each possible combination of values) is to use the statsheet (the popup image when you mouseover) and have it display hit points in this fashion:

HP: 36 / 54

To do that, you need to configure the tokens properties with something like:

Code: Select all

CurrentHP:
MaxHP:
*DisplayHP(HP): { CurrentHP } / { MaxHP}
It would look something like:
hpsample.png
Then, when you mouse over the token, the HP is displayed as an actual number, as well as indicating the maximum possible.
This would work VERY well for my purposes, IF I knew where to plug in that code. How would I go about changing the current value without right clicking the token and manually editing it every time a damaging attack is made?

Edit: Veggie n Rumble seem to understand what I'm looking for. I assume it's because they were looking for the same thing when they started here, but unlike me had the knowledge of how to code what they needed.
I'm not retarded...I'm a simple creature...there is a difference.

User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: help with: Reveal hidden tokens macro, PLS?!?!

Post by Rumble »

Slayve2DnD wrote: Edit: Veggie n Rumble seem to understand what I'm looking for. I assume it's because they were looking for the same thing when they started here, but unlike me had the knowledge of how to code what they needed.
You'd do this:

Open Edit > Campaign Properties

In the properties tab (if the window looks messed up, just switch tabs a couple times), select the word Basic on the left side, make sure that the following lines are in the list that shows up (if they aren't, add them or change them):

Code: Select all

CurrentHP:
MaxHP:
*DisplayHP(HP): { CurrentHP } / { MaxHP}
Now, go to the Campaign Macro window (if you can't see it, go to Window > Campaign), right-click, and select Add New Macro. In that macro, enter this:

Code: Select all

[h:status=input(
"hpChange|0|Enter change in HP",
"damageOrHealing|Damage,Healing|Is this damage, or healing?|RADIO|SELECT=0"
)]
[h:abort(status)]
[h:bloodied = floor(MaxHP/2)]

[h,if(damageOrHealing == 0):
{
   [CurrentHP = CurrentHP - hpChange]
   [token.name] takes [hpChange] hit points of damage.
};
{
   [CurrentHP = min(CurrentHP + hpChange, MaxHP)]
   [token.name] is healed and regains [hpChange] hit points.
};]
When you create this macro, make sure to click "Apply to Selected Tokens" in the lower left corner of the macro editing window. Make sure to name the macro something easy to remember!

After that, you can select the token, click the macro button in the campaign macro window, and adjust the HP right there!

User avatar
Slayve2DnD
Dragon
Posts: 455
Joined: Thu Dec 18, 2008 1:06 am

Re: help with: Reveal hidden tokens macro, PLS?!?!

Post by Slayve2DnD »

Rumble wrote:
Slayve2DnD wrote: Edit: Veggie n Rumble seem to understand what I'm looking for. I assume it's because they were looking for the same thing when they started here, but unlike me had the knowledge of how to code what they needed.
You'd do this:

Open Edit > Campaign Properties

In the properties tab (if the window looks messed up, just switch tabs a couple times), select the word Basic on the left side, make sure that the following lines are in the list that shows up (if they aren't, add them or change them):

Code: Select all

CurrentHP:
MaxHP:
*DisplayHP(HP): { CurrentHP } / { MaxHP}
Now, go to the Campaign Macro window (if you can't see it, go to Window > Campaign), right-click, and select Add New Macro. In that macro, enter this:

Code: Select all

[h:status=input(
"hpChange|0|Enter change in HP",
"damageOrHealing|Damage,Healing|Is this damage, or healing?|RADIO|SELECT=0"
)]
[h:abort(status)]
[h:bloodied = floor(MaxHP/2)]

[h,if(damageOrHealing == 0):
{
   [CurrentHP = CurrentHP - hpChange]
   [token.name] takes [hpChange] hit points of damage.
};
{
   [CurrentHP = min(CurrentHP + hpChange, MaxHP)]
   [token.name] is healed and regains [hpChange] hit points.
};]
When you create this macro, make sure to click "Apply to Selected Tokens" in the lower left corner of the macro editing window. Make sure to name the macro something easy to remember!

After that, you can select the token, click the macro button in the campaign macro window, and adjust the HP right there!
Could not execute the command: line 1:1: unexpected char: '{' is what I get after I put in a damage or healing value and ANY value when it gives me a window saying "Value for MaxHP:" Running build50 atm if that makes a difference?
I'm not retarded...I'm a simple creature...there is a difference.

User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: help with: Reveal hidden tokens macro, PLS?!?!

Post by Rumble »

Slayve2DnD wrote: Could not execute the command: line 1:1: unexpected char: '{' is what I get after I put in a damage or healing value and ANY value when it gives me a window saying "Value for MaxHP:" Running build50 atm if that makes a difference?
No, I made a typo - which is typical for me when I do this stuff ;). Change:

Code: Select all

[h,if(damageOrHealing == 0):
to

Code: Select all

[h,if(damageOrHealing==0),CODE:
And that should resolve it.

User avatar
Slayve2DnD
Dragon
Posts: 455
Joined: Thu Dec 18, 2008 1:06 am

Re: help with: Reveal hidden tokens macro, PLS?!?!

Post by Slayve2DnD »

Okay, so now its not tossing me the error, but there's still something not working properly. In the chat window, the token image is showing like it should with run on selected token, however it is not saying the result of values plugged in such as takes 5 damage or anything. CurrentHP and MaxHP are properly changed in Token Properties but they don't change in stat-sheet
CurrentHP 20
MaxHP 30
DisplayHP { 25 } / { 30}
I'm not retarded...I'm a simple creature...there is a difference.

Post Reply

Return to “Documentation Requests/Discussion”