Error in the code of HP and Health Bars macro at the wiki

Doc requests, organization, and submissions

Moderators: dorpond, trevor, Azhrei

Post Reply
Mad Beard
Kobold
Posts: 3
Joined: Mon May 24, 2010 5:25 pm

Error in the code of HP and Health Bars macro at the wiki

Post by Mad Beard »

First of all, as this is my first post, I must say hi to all of you people. Rptools is wonderful asset to every roleplayer.
I just read about macros on wiki and I think I found an error in code http://lmwcs.com/rptools/wiki/HP_and_Health_Bars
[h:status = input(
"hpChange|0|Number of Hit Points",
"dmgOrHealing|Damage,Healing|Is the character taking damage or being healed?|RADIO|SELECT=0",
"lethalOrNo|Lethal,Nonlethal|Is the damage lethal?|RADIO|SELECT=0")]
[h:abort(status)]

[if(dmgOrHealing == 0),CODE:
{
[if(lethalOrNo == 0),CODE:
{
[h:HP = HP - hpChange]
[h:bar.Health = (HP - Nlthl) / MaxHP]
[r:token.name] loses [r:hpChange] hit points.
};
{
[h:Nlthl = Nlthl + hpChange]
[h:bar.Health = (HP - Nlthl) / MaxHP]
[r:token.name] loses [r:hpChange] hit points.
};]
};
{
[h:diff = MaxHP - HP]
[h:HP = min(HP+hpChange, MaxHP)]
[h:Nlthl = max(Nlthl+hpChange, 0)]
[h:bar.Health = (HP - Nlthl) / MaxHP]
[r:token.name] is healed and gains [r:min(diff,hpChange)] hit points.
};]
In red line i think it should be [h:Nlthl = max(Nlthl-hpChange, 0)].
Minus, not plus.
I'm just beginner so please excuse me if I'm wrong. Just started to write codes.
I'd have to be a warrior
A slave I couldn't be
A soldier and a conqueror
Fighting to be free.

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

Re: Error in the code of HP and Health Bars macro at the wik

Post by Azhrei »

Welcome to RPTools, Mr. Beard. ;)
Mad Beard wrote:In red line i think it should be [h:Nlthl = max(Nlthl-hpChange, 0)].
Minus, not plus.
I'm just beginner so please excuse me if I'm wrong. Just started to write codes.
I'm not that familiar with the example code, but I'd say your right. When a creature is healed, it's hp should go up and the non-lethal damage should go down.

Good catch!

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: Error in the code of HP and Health Bars macro at the wik

Post by aliasmask »

I think it depends on the visual effect you're going for and how the bars are configured and to when you add/subtract values.

I play with health bars in this thread which also includes some of my code.

Mad Beard
Kobold
Posts: 3
Joined: Mon May 24, 2010 5:25 pm

Re: Error in the code of HP and Health Bars macro at the wik

Post by Mad Beard »

aliasmask wrote:I think it depends on the visual effect you're going for and how the bars are configured and to when you add/subtract values.

Sorry I forgot to mention that I'm starting d20 Pathfinder campaign.
"When a spell or ability cures hit point damage, it also removes an equal amount of nonlethal damage."
So with that in mind in that line should be minus. Otherwise when you use macro and select healing, lethal dmg is healed and nonlethal is increased instead of lowered.
I'd have to be a warrior
A slave I couldn't be
A soldier and a conqueror
Fighting to be free.

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: Error in the code of HP and Health Bars macro at the wik

Post by aliasmask »

Have you looked at the 3.5/Pathfinder framework? It handles health bars, among other things.

Mad Beard
Kobold
Posts: 3
Joined: Mon May 24, 2010 5:25 pm

Re: Error in the code of HP and Health Bars macro at the wik

Post by Mad Beard »

Yes I did. I'll take some things from there. Anyway thanks for mentioning.
I play with couple of friends and we communicate over skype (with headphones and mic) so we don't need very complicated things. Also we know each other very well so I trust them not to lie about their rolls and I let them to roll with real dice.
All we need is some map tool for tactical display and there comes rptools into play :D
Before we used glittercom. Also free tool for map display and very simple to use. But one of my players have old Athlon processor which glittercom don't support and we had to use team viewer and that was very lame solution. Then I decided to switch to rptools and now we'll see how it'll go.
Now I'm in the process of tweaking maptool to make my life little easier.

I' don't know what others think but in my opinion it would be real great to have included in maptool several most popular rpg systems, so that you can select which you want to play and thats it. In this way all usual commands and macros would be built in it. :mrgreen:
I'd have to be a warrior
A slave I couldn't be
A soldier and a conqueror
Fighting to be free.

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

Re: Error in the code of HP and Health Bars macro at the wik

Post by Azhrei »

Mad Beard wrote:I' don't know what others think but in my opinion it would be real great to have included in maptool several most popular rpg systems, so that you can select which you want to play and thats it. In this way all usual commands and macros would be built in it. :mrgreen:
But that means that the developers would need to maintain a bunch of different "built-in" features. And the developers don't necessarily play the games that MapTool is used for.

We don't really want MapTool to have things "built-in" unless those things support a bunch of different game systems. Once MapTool starts becoming "only D&D" or "only SavageWorlds" then we lose the allure of MapTool being completely generic and usable for a lot of different games.

That's why we have "campaign frameworks". They are community-supported collections of properties, macros, tables, and other data that work with MapTool but are not part of MapTool. There are frameworks for D&D3/PF, D&D4, SW, nWOD, GURPS, and others.

Post Reply

Return to “Documentation Requests/Discussion”