Page 2 of 4

Posted: Wed Aug 20, 2008 5:08 pm
by trevor
Moved to documentation forum and stickied

Posted: Fri Aug 22, 2008 7:13 pm
by Elorebaen
Hello,

I am rather new to macro programming. Can I have parts of a macro simply fulfill the function without giving output in the Chat window?

For example:
{token.name} takes {DamageValue} points of damage!
<br>Now {token.name} only has {HP = HP - DamageValue} hit points

If I wanted to place this on NPCs, I would not want the info after the BR to show in the Chat window.

Thanks for the help!
E

Posted: Fri Aug 22, 2008 7:32 pm
by jfrazierjr
Elorebaen wrote:Hello,

I am rather new to macro programming. Can I have parts of a macro simply fulfill the function without giving output in the Chat window?

For example:
{token.name} takes {DamageValue} points of damage!
<br>Now {token.name} only has {HP = HP - DamageValue} hit points

If I wanted to place this on NPCs, I would not want the info after the BR to show in the Chat window.

Thanks for the help!
E

No, you can use /self to only send to yourself or /gm to only send to you and he GM, but it's all or nothing within a macro.

Posted: Fri Aug 22, 2008 9:32 pm
by bobthedog
Elorebaen wrote:Hello,

I am rather new to macro programming. Can I have parts of a macro simply fulfill the function without giving output in the Chat window?

For example:
{token.name} takes {DamageValue} points of damage!
<br>Now {token.name} only has {HP = HP - DamageValue} hit points

If I wanted to place this on NPCs, I would not want the info after the BR to show in the Chat window.

Thanks for the help!
E
What I have done (not really macro related, but) is create a separate property set for monsters/NPCs. Then (among other stuff), I set this property in there:

*#HP

Every macro that changes HP works with it, because it's the same property name, but it'll only show the NPC's HP (on the statsheet) to the GM.

Posted: Fri Aug 22, 2008 9:35 pm
by knizia.fan
Elorebaen wrote:Hello,

I am rather new to macro programming. Can I have parts of a macro simply fulfill the function without giving output in the Chat window?

For example:
{token.name} takes {DamageValue} points of damage!
<br>Now {token.name} only has {HP = HP - DamageValue} hit points

If I wanted to place this on NPCs, I would not want the info after the BR to show in the Chat window.

Thanks for the help!
E
As jfrazier said, you can't have players and GMs see different parts of the output. However, you can comment out the second line (using <!-- -->)so that the effect takes place but nothing is printed to the chat window.

Posted: Sun Aug 24, 2008 4:10 pm
by Elorebaen
Thank you for the responses!

Also, I forgot to mention, thank you for the tutorial!!

Posted: Tue Aug 26, 2008 4:51 am
by Mr. Pokeylope
jfrazierjr wrote:No, you can use /self to only send to yourself or /gm to only send to you and he GM, but it's all or nothing within a macro.
This is on my to-do list of things to fix (allowing multiple commands within a macro), but based on the evaluation I did while waiting on roll syntax feedback, it'll take a fair bit of effort to get it working

So, eventually, maybe.

Posted: Tue Aug 26, 2008 8:10 am
by jfrazierjr
Mr. Pokeylope wrote:
jfrazierjr wrote:No, you can use /self to only send to yourself or /gm to only send to you and he GM, but it's all or nothing within a macro.
This is on my to-do list of things to fix (allowing multiple commands within a macro), but based on the evaluation I did while waiting on roll syntax feedback, it'll take a fair bit of effort to get it working

So, eventually, maybe.
Hmm... I wonder if you can hook into existing mechanics like what you are doing with tooltips. For example:

/me does super foo [/gm "I actually user super bar instead"]

Posted: Tue Aug 26, 2008 1:58 pm
by Mr. Pokeylope
jfrazierjr wrote:Hmm... I wonder if you can hook into existing mechanics like what you are doing with tooltips. For example:

/me does super foo [/gm "I actually user super bar instead"]
Nah, it'd just be done using the multi-line macro editor, and each line would be a separate command. In theory you're supposed to be able to use newlines to automatically insert <br> tags, but since there's a bug that prevents that from working at the moment, I don't feel too bad about changing the (intended) behavior.

Posted: Wed Aug 27, 2008 6:15 pm
by Plissken
Hi, I'm trying to make it so that when a monster reaches its bloodied value, the bloodied state will show up. I tried this and variants of this but wouldn't work.

{ if (HP==30, [state.Bloodied = 1], [state.Bloodied = 0] ) }

What is the correct way to do this?

Posted: Wed Aug 27, 2008 6:28 pm
by jfrazierjr
Mr. Pokeylope wrote:
jfrazierjr wrote:Hmm... I wonder if you can hook into existing mechanics like what you are doing with tooltips. For example:

/me does super foo [/gm "I actually user super bar instead"]
Nah, it'd just be done using the multi-line macro editor, and each line would be a separate command. In theory you're supposed to be able to use newlines to automatically insert <br> tags, but since there's a bug that prevents that from working at the moment, I don't feel too bad about changing the (intended) behavior.


Ummm what? What bug are you talking about, cause it may not be a bug....

Posted: Wed Aug 27, 2008 6:31 pm
by Mr. Pokeylope
Plissken wrote:Hi, I'm trying to make it so that when a monster reaches its bloodied value, the bloodied state will show up. I tried this and variants of this but wouldn't work.

{ if (HP==30, [state.Bloodied = 1], [state.Bloodied = 0] ) }

What is the correct way to do this?
{state.Bloodied = if (HP==30, 1, 0) }

Although {state.Bloodied = if (HP <= MaxHP / 2, 1, 0) } would probably be a better way to do it? (Assuming you've got a MaxHP property set.) Using <= so that the monster doesn't have to be exactly at the bloodied value for it to be set.

Posted: Wed Aug 27, 2008 6:41 pm
by Mr. Pokeylope
jfrazierjr wrote:Ummm what? What bug are you talking about, cause it may not be a bug....
If you have the following macro:

Code: Select all

foo
bar
the documented behavior is that it will replace the newline with a <br> tag. The code to do this exists, but there's a bug in it and the replacement doesn't actually happen. So instead of "foo<br>bar" you get "foo\nbar" (where "\n" represents a newline), which when rendered as HTML is printed as "foo bar".

Posted: Wed Aug 27, 2008 7:41 pm
by jfrazierjr
Mr. Pokeylope wrote:
jfrazierjr wrote:Ummm what? What bug are you talking about, cause it may not be a bug....
If you have the following macro:

Code: Select all

foo
bar
the documented behavior is that it will replace the newline with a <br> tag. The code to do this exists, but there's a bug in it and the replacement doesn't actually happen. So instead of "foo<br>bar" you get "foo\nbar" (where "\n" represents a newline), which when rendered as HTML is printed as "foo bar".
Pretty sure it's NOT a bug. Basically, if I remember corretly, this was changed to NOT insert a br automatically because that messes upformatting of tables when someone tries to "prettify" their HTML code. everywhere there is a br tag, the table gets another empty cell that's about 3 px wide...

Talk to Orchard who originally reported the problem (though I had noted it before and had just not tracked down the cause) to make sure what you are doing won't cause his tables to go haywire...

Posted: Wed Aug 27, 2008 8:04 pm
by Lindharin
I have to say that I really prefer newlines in the macro code to NOT cause automatic <br> tags. That will just make macros so much harder to read, if the macro commands have to be on one long line or have random <br> tags in them.

But I admit I'm biased because I don't do much typing in the chat window directly. It's all in the macro editor, and losing line breaks there will make that little text area that much harder to work with.

If people want that functionality back, at least consider some way to turn it off, maybe with some option/code at the start of the macro or something.