HP changing macro

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: dorpond, trevor, Azhrei

Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)
Post Reply
User avatar
Weero
Kobold
Posts: 12
Joined: Tue Sep 30, 2008 2:52 pm

HP changing macro

Post by Weero »

So I'm trying to make a simple macro to change HP with no output in the chat. So far it's been going well...until I wanted to add commands to make sure the TempHP never went below -10, and not over MaxHP. In this one I've tried the -10 command first...

[TempHP]
[HPValue = HPChange]
[NewHP = max(-10, MaxHP + HPValue)]
[TempHP = NewHP]

...What am I doing wrong?

edit: Nevermind...I just had to change MaxHP to TempHP...noob mistake >.<

edit2: Okay...new problem!

[TempHP]
[HPValue = HPChange]
[NewHP = max(MaxHP, min(-10, TempHP - HPValue))]
[TempHP = NewHP]

Sorry if I seem really, really stupid...but I have next to no experience with this kind of stuff. What am I doing wrong now?

edit3: I figured it out...wow, it really helps laying it all out and disassembling everything in the macro before you put it back together.

Here's the finished macro:

[TempHP]
[HPValue = HPChange]
[NewHP = max(MaxHP, min(-10, TempHP + HPValue))]
[TempHP = NewHP]

(All I had to do was change "TempHP - HPValue" to "TempHP + HPValue")

User avatar
PyroMancer2k
Dragon
Posts: 925
Joined: Thu Sep 11, 2008 2:04 pm

Post by PyroMancer2k »

While your macro may work it still displays stuff to the chat box. If you don't want stuff to display in Chat you need to use [H:] in your commands.

So [HPValue = HPChange] becomes [H:HPValue = HPChange]

User avatar
Weero
Kobold
Posts: 12
Joined: Tue Sep 30, 2008 2:52 pm

Post by Weero »

Will do! Thanks for the input. :)

edit: Okay, I changed the macro to this:

[H:TempHP]
[H:HPValue = HPChange]
[H:NewHP = min(MaxHP, max(-10, TempHP + HPValue))]
[H:TempHP = NewHP]

But I still get a line in the chat containing nothing. how would I go about not getting that empty line in the chat?

User avatar
lmarkus001
Great Wyrm
Posts: 1865
Joined: Sat Mar 29, 2008 12:30 am
Location: Layfayette Hill, PA

Post by lmarkus001 »

Pretty sure you can not get rid of that.

User avatar
Mr. Pokeylope
Giant
Posts: 118
Joined: Mon Aug 11, 2008 9:24 pm
Contact:

Post by Mr. Pokeylope »

Try adding either /discard or /do to the beginning of the macro; this should execute it without displaying any output.

User avatar
Weero
Kobold
Posts: 12
Joined: Tue Sep 30, 2008 2:52 pm

Post by Weero »

Nope, /discard and /do didn't work, but I did try /self, and it does a fine job.

User avatar
Mr. Pokeylope
Giant
Posts: 118
Joined: Mon Aug 11, 2008 9:24 pm
Contact:

Post by Mr. Pokeylope »

Hmm, /discard must not have made it in yet. Should be in the next build, I suppose.

Craig
Great Wyrm
Posts: 2107
Joined: Sun Jun 22, 2008 7:53 pm
Location: Melbourne, Australia

Post by Craig »

It was sent a while ago so I dont know if it will ever make it (maybe the patch was too simple ;) ). I will resend it again.

In the meantime you can use the abort function to discard the output, its cant always be used to discard output but it can in this case.

Abort stops the macro processing at the point it is called if the argument is 0 which will discard output so if you tack an [h:abort(0)] on the end of the macro then you will get no output but everything up to that point will still run. It has to be at the end because anything after the abort will not run.

User avatar
Weero
Kobold
Posts: 12
Joined: Tue Sep 30, 2008 2:52 pm

Post by Weero »

Oooh, nice! I'll be sure to not use it in just anything. :P

Post Reply

Return to “MapTool”