Lord of the Rings SBG need macro Help

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. :)
DrnkBstrd
Kobold
Posts: 13
Joined: Thu Mar 31, 2011 4:17 pm

Re: Lord of the Rings SBG need macro Help

Post by DrnkBstrd »

OK, For the Doubled Enteries the rules state that a roll >= to the 1st # followed by a second roll >= to the 2nd #. So you acctually need 2 successful rolls of target #'s back to back. I personaly don't care for this rule, but I'm trying to stick with the original rules as much as possible.

Unfotunately I'm not a good math guy, You spelled it out and I'm still missing something. I see the difference between Str and Def, but the target roll's I'm at a loss. I'll keep looking in hopes it will just click.

In your opinion "should" this framework be simple enough for a new guy to learn, or is this to advanced to start out?

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

Re: Lord of the Rings SBG need macro Help

Post by wolph42 »

Have a look at the list again and maybe you'll notice that
D-S : wound when roll equals or is higher then
< -1 : 3
0 or -1 : 4
1 or 2 : 5
>2 : 6

D-S means defence with strength subtracted.
Eg D = 5, S=4, wound on a roll of 5 or higher.

Do you think you can create an if() structure around that?
Note that || is the OR operator so
If( (DmS==1 || DmS==2) && roll >=5 ): wound=1
He parenthesis are needed as && takes precedence over || same as 2+3*5, where the * takes precedence over the +, so in that case it's 17 and (2+3)*5 = 25.

Also note the == and = the first is an operator (equals to) the latter assigns a value to a variable.

DrnkBstrd
Kobold
Posts: 13
Joined: Thu Mar 31, 2011 4:17 pm

Re: Lord of the Rings SBG need macro Help

Post by DrnkBstrd »

OK thanks, I'm not sure I fully understand but I will play with options to try to figure it out.

In moving forward I decided to go with something simple for the moment. To stay productive I am working on Jump, Climb and Thrown Rider Macros. Not to hard, a simple d6 with 3 outcomes. This is where I am, and suprise to me it works, well mostly. Here's my problem, I am not figuring out the "TokenName" part. I have tried several ways from tutorials and just can't get it to populate, What am I doing wrong? Also Concerning the second if() option is there a way to "Limit" the greater than portion to reflect >2 but <5?

Code: Select all

[h:JumpRoll = 1d6]
<b>[r:JumpRoll]<b>
 [if(JumpRoll == 1): "Failure!, {r:token.name} stumbles and is halted."]
 [if(JumpRoll >= 2): "Success!"]
 [if(JumpRoll == 6): "{r:token.name} effortlessly makes the jump and continues on!"]
Last edited by DrnkBstrd on Fri Jan 31, 2014 7:57 am, edited 1 time in total.

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

Re: Lord of the Rings SBG need macro Help

Post by wolph42 »

Code: Select all

[if(JumpRoll == 6): token.name+" effortlessly makes the jump and continues on!"]
For the other question,: use the && (AND) operator. Look at my former post for an example.

DrnkBstrd
Kobold
Posts: 13
Joined: Thu Mar 31, 2011 4:17 pm

Re: Lord of the Rings SBG need macro Help

Post by DrnkBstrd »

Thanks for all the help so far.

Token name worked, thanx, but is there a way to do this without impersonating the token? I've been looking at tutorials on tokens, I am looking to just use as selected token for macros.
I did, however not figure out the 2nd if() line. What did I do wrong?

Code: Select all

h:JumpRoll = 1d6]
<b>[r:JumpRoll]<b>
 [if(JumpRoll == 1): token.name+" stumbles and is halted."]
 [if(JumpRoll >= 2 || <= 5): "Success!"]
 [if(JumpRoll == 6): token.name+" effortlessly makes the jump and continues on!"]
And for the Wound Chart table, does this look right? I'm trying to build off the Fighting macro from earlier, with no success, and want to know if this is even right.

Code: Select all

  [If( (D-S<= -2) && roll >=3 ): Wounds=1]
  [If( (D==S || D-S== -1) && roll >=4 ): Wounds=1]
  [If( (D-S==1 || D-S==2) && roll >=5 ): Wounds=1]
  [If( (D-S>=2) && roll >=6 ): Wounds=1]
Thanx
Last edited by DrnkBstrd on Fri Jan 31, 2014 7:54 am, edited 1 time in total.

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

Re: Lord of the Rings SBG need macro Help

Post by wolph42 »

Could you pls edit your post and add code tags?

from a quick look it looks like you got the latter part right, save the fact that you made quite some syntax errors (missing (), [, etc), but its annoying to read code without the tags. I would in this case even suggest to edit the tags from
[c ode][/code]
to
[c ode=php][/code]

note that I added the space on purpose so this forum doesnt interpret them, in cause then you would see:

I would in this case even suggest to edit the tags from to which wouldn't make much sense.

User avatar
metatheurgist
Dragon
Posts: 364
Joined: Mon Oct 26, 2009 5:51 am

Re: Lord of the Rings SBG need macro Help

Post by metatheurgist »

Computers are really dumb. You have to spell everything out for them and make sure you get it right. If you're learning to code it's a good idea to run through the code and mentally execute what's on the screen (not what you want to happen, what you've actually told it to do! This is an important distinction).
DrnkBstrd wrote: [if(JumpRoll >= 2 || <= 5): "Success!"]
If JumpRoll is greater than or equal to 2 OR ? is less than or equal to 5 then success!. What am I comparing in the second part of that if? If I plug 1 into JumpRoll and run it through the code then 1 is <=5, if I plug 6 into JumpRoll and run it through the code then 6 is >=2. Seems like anything from 1 to 6 is a success. That can't be right?

This seems more likely:

Code: Select all

[if(JumpRoll >= 2 && JumpRoll<= 5): "Success!"]
If you going to use (D-S) that often you might as well stick it in a variable. It's less important today but it's inefficient to make that calculation multiple times. It's also more readable.
DrnkBstrd wrote: [If( (D-S<= -2) && roll >=3 ): Wounds=1]
[If( (D==S || D-S== -1) && roll >=4 ): Wounds=1]
[If( (D-S==1 || D-S==2) && roll >=5 ): Wounds=1]
[If( (D-S>=2) && roll >=6 ): Wounds=1]

Post Reply

Return to “MapTool”