gm (roll option)

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
oblisgr
Giant
Posts: 132
Joined: Mon Aug 01, 2011 6:43 am
Location: Crete,Greece
Contact:

gm (roll option)

Post by oblisgr »

Code: Select all

[if(Ranged_Loot_Flag == 1), CODE:{

<b>Attacking with Ranged weapons</b>
<br>
<span:color=gray><b>{Ranged} ({WP_Ranged_Adjustment}%)</b><span>
}]

[g, if(Ranged_Loot_Flag == 1), CODE:{
<br>
<span:color=gray>DPS = {Ranged_Dps} x {WP_Ranged_Adjustment}% = {Ranged_New_Dps_Integer} + {Base_Dps} = {Ranged_DPS_For_Calculations}
}]

[if(Ranged_Loot_Flag == 1), CODE:{
<br>
<b>Target:</b> {Target_String_Name} (DR: {Target_DR})
}]

[g, if(Ranged_Loot_Flag == 1), CODE:{
<br>
<span:color=gray>DPS/DR = {Ranged_DPS_For_Calculations} - {Target_DR} = {FINAL_DPS}
<br>
<span:color=gray>Negative DPS/DR = 0<span>
<br>
<span:color=gray>(1d4 + DPS/DR + STR Modifier + Attack Power) x Damage Multiplier<span>
}]

[if(Ranged_Loot_Flag == 1), CODE:{
<br>
<b>Result:</b> (({Dice4}) + ({FINAL_DPS}) + ({Str_Modifier}) + ({Attack_Power})) x {Damage_Multiplier} = {Final_Damage} = <b>{ Final_Damage_Integer}
}]

I hoped that the lines with g whould show the comments only to GM.
But its not working because the player and the other players can see the comments i dont want them.
h is woking as it should be, hiding the comments from everyone.

Do i have typed anything wrong?
Thanks
High Templar of Ur

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: gm (roll option)

Post by wolph42 »

Strange, I think that that should work. Couple of things you can try:
-Use gm instead of g
-A an extra code block inside the if block with the g option.
Also try something like [g:"can you see this"]. To test.

O and a silly thing, the players *are* logged in as player not gm? I guess they are but it does not hurt to check.

It's possible tat the HTML code somehow omits the g or the double option g,if() does something wrong but I don't think tha that should happen.

Akodo Makama
Giant
Posts: 249
Joined: Mon Apr 20, 2009 9:31 pm

Re: gm (roll option)

Post by Akodo Makama »

Also, are you checking what the players can see by starting a second copy of MapTool and logging in as a player, or are you simply switching to the 'player view'? Only the first method will work. The 'player view' does not affect the contents of the chat window.

oblisgr
Giant
Posts: 132
Joined: Mon Aug 01, 2011 6:43 am
Location: Crete,Greece
Contact:

Re: gm (roll option)

Post by oblisgr »

gm does the same thing as g
I have checked it as player by connecting 2 more players to the server.
I also put the s roll option, but other player cann see the lines too.
Nothing actually works, only h
High Templar of Ur


oblisgr
Giant
Posts: 132
Joined: Mon Aug 01, 2011 6:43 am
Location: Crete,Greece
Contact:

Re: gm (roll option)

Post by oblisgr »

Yes, gm: worked and the line you wrote above.
I get that blue text that appears when i use [] lines.
Text will not appear correctly.
I dont know why this is not working as h does...
High Templar of Ur

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

Re: gm (roll option)

Post by aliasmask »

I'm taking a look, but the first thing that jumps out at me is your html is wrong.

Code: Select all

<span:color=gray> should be <span style="color:gray">


Maybe that's a shortcut way in explorer but MT doesn't recognize it. Also, your first [if:] is missing the false condition for the code and is required. Just put

Code: Select all

[if(condition), code:{...};{}]

You should also use [R:] with the g to insure output to come out nice. I also noticed you put variable names in there which I'm assuming you either assign on the fly or are defined somewhere else (not clear from code). That's a bad practice, use an input to get all the needed variables upfront. If you're not doing that, then good for you. It's also best to post all the code because most of the time when you have a problem in one area it's cause by something else somewhere else.

Beware using {} to display variables. Use [r: varname] because you have a bracket limit in the parser. That's probably why you have 5 if statements instead of 1. Best to get in the habit now, you'll thank me later. Format your output with strformat rather than mixing output and code. It's much easier to read and control your output that way.

Code: Select all

[if(Ranged_Loot_Flag), code: {
   [R: strformat('
      <b>Attacking with Ranged weapons</b><br>
      <span style="color:gray"><b>%{Ranged} (%{WP_Ranged_Adjustment}%)</b></span><br>
   ')]
   [R,G: strformat('
      <span style="color:gray">DPS = %{Ranged_Dps} x %{WP_Ranged_Adjustment}% = %{Ranged_New_Dps_Integer} + %{Base_Dps} = %{Ranged_DPS_For_Calculations}</span><br>
   ')]
   [R: strformat('
      <b>Target:</b> %{Target_String_Name} (DR: %{Target_DR})<br>
   ')]
   [R,G: strformat('
      <span style="color:gray">DPS/DR = %{Ranged_DPS_For_Calculations} - %{Target_DR} = %{FINAL_DPS}<br>
      Negative DPS/DR = 0<br>
      (1d4 + DPS/DR + STR Modifier + Attack Power) x Damage Multiplier<span><br>
   ')]
   [R: strformat('
      <b>Result:</b> ((%{Dice4}) + (%{FINAL_DPS}) + (%{Str_Modifier}) + (%{Attack_Power})) x %{Damage_Multiplier} = %{Final_Damage} = <b>%{Final_Damage_Integer}</b>
   ')]
};{}] 

oblisgr
Giant
Posts: 132
Joined: Mon Aug 01, 2011 6:43 am
Location: Crete,Greece
Contact:

Re: gm (roll option)

Post by oblisgr »

Those lines with =grey were actually working. Only somethimes they didnt worked as they supposed.
I think ="grey" will work better...

Oh man your are a god! Thanks
This code worked for me but i still have some questions...

Code: Select all

[if(Ranged_Loot_Flag), code: {
1. How this recognizes the values of 1 or 0 the rest of the code (from other makros) gives to the token?

Code: Select all

[R: strformat('
      <b>Attacking with Ranged weapons</b><br>
      <span style="color:gray"><b>%{Ranged} (%{WP_Ranged_Adjustment}%)</b></span><br>
   ')]
2. I suppose you put strformat because you used R: right?
3. Why you used % before { }

4. How you managed to disable the effect of [ ]? You know those blue letters that appear with calculations.
High Templar of Ur

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: gm (roll option)

Post by wolph42 »

oblisgr wrote:Those lines with =grey were actually working. Only somethimes they didnt worked as they supposed.
I think ="grey" will work better...

Oh man your are a god! Thanks
This code worked for me but i still have some questions...

Code: Select all

[if(Ranged_Loot_Flag), code: {
1. How this recognizes the values of 1 or 0 the rest of the code (from other makros) gives to the token?

Code: Select all

[R: strformat('
      <b>Attacking with Ranged weapons</b><br>
      <span style="color:gray"><b>%{Ranged} (%{WP_Ranged_Adjustment}%)</b></span><br>
   ')]
2. I suppose you put strformat because you used R: right?
3. Why you used % before { }

4. How you managed to disable the effect of [ ]? You know those blue letters that appear with calculations.
#1 don't understand the question
#2 and #3 no. Wiki: strformat ()is a function that allows for formatting a string (duh). There are lots of options with it, e.g.

Code: Select all

 [r:strformat("this shows a number: %d and this a string: %s", 5, "hello world")]
however you can also put variables inside like this:

Code: Select all

 [h:justANumber = 5]
[h:justAString = "hello world"]
[r:strformat("this shows a number: %{justANumber } and this a string: %{justAString}")]
this makes it easier to read then:

Code: Select all

 [r:"this shows a number: "+justANumber+"  and this a string: "+justAString]
also the {} inside double quots "" don't count towards the max {} levels of 2.

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

Re: gm (roll option)

Post by aliasmask »

#1 - I was assuming Ranged_Loot_Flag from your code was either a 1 or 0. As long as it is always a number, you can just put the name in the condition. If the condition is 0, it's false, if it's anything else it's true.

#2 & #3 - Read up on Wiki: strformat(). Using %{varname} and %s as a reference is easier (imo) than [r: varname] and looks cleaner in the code highlighting. Using {} presents the code limit as mentioned before. {} inside quotes or [] ignores the {} for the parser's code limit for nesting code.

#4 []s are a part of the macroscript and the parser tries to translate what's inside and doesn't include them in the output.

As for the gray, yes it worked. When I first tested it I accidentally used "grey" which didn't work.

Code: Select all

1) <span:color=grey>Test<span> Text<br>
2) <span:color=gray>Test<span> Text<br>
3) <span:color=gray>Test</span> Text<br>
4) <span style="color:gray">Test</span> Text<br>
5) <span style=color:gray>Test</span> Text<br>
6) <span color=gray>Test</span> Text<br>
7) <i color=gray>Test</i> Text
Output wrote:
Image1.jpg
Image1.jpg (6.19 KiB) Viewed 753 times
Using "color" in any valid tag will give you the same results. The html 3.0 parser is fairly forgiving with that particular entity, and I remember MS Frontpage using that method of format. I just don't think it's a widely accepted way of doing it, but to each their own. I know I don't bother with some proper formatting like <br />.

neofax
Great Wyrm
Posts: 1694
Joined: Tue May 26, 2009 8:51 pm
Location: Philadelphia, PA
Contact:

Re: gm (roll option)

Post by neofax »

oblisgr wrote:4. How you managed to disable the effect of [ ]? You know those blue letters that appear with calculations.
You can turn this off in the options something like inline rolls or some such. Play with the checkbox and it will turn off the <<blah,blah,blah>> that shows up in chat.
Image
Time-Zone information UTC -5

oblisgr
Giant
Posts: 132
Joined: Mon Aug 01, 2011 6:43 am
Location: Crete,Greece
Contact:

Re: gm (roll option)

Post by oblisgr »

Thanks you guys!
All of you!
High Templar of Ur

Post Reply

Return to “Macros”