[Help] Macro tweaking

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
Kazander
Cave Troll
Posts: 26
Joined: Mon Aug 06, 2012 2:56 pm

[Help] Macro tweaking

Post by Kazander »

[Help]
I'm using the GURPS framework, which I think was made by someone named Winter way back now. Don't think that actually matters for my question though.

There is something that's bugging me. There is a "Success_Roll" macro, which has the following code:

Code: Select all

[h:SkillLevel=Skill_Level]
[h:Mod = Modifier]
[h:Skill = SkillLevel+Mod]
[h:Roll = 3d6]
[h:CritFailThreshold = if(Skill<16,min(Skill+10,17),18)]
[h:CritSuccessThreshold = max(min(Skill-10,6),4)]
[h:SuccessCheck = if(Roll <= min(Skill,16),1,0)]
[h:CritSuccessCheck = if(SuccessCheck && Roll <= CritSuccessThreshold,1,0)]
[h:CritFailureCheck = if(SuccessCheck < 1 && Roll >= CritFailThreshold,1,0)]
[h:MoS = Skill-Roll]

[h:BGColor=if(MoS>=0,"green","red")]
[h:dude=token.name]
[h:AbsResult = abs(MoS)]

<span style="font-size:12 pt"><i>{dude}</i> rolls 3d6 and gets <b>{Roll}</b> vs. Skill (<b>{SkillLevel}</b> with a modifier of {Mod})<br>

<table border="0" width=100%><tr bgcolor="{BGColor}"><td style='padding:0px 2px';  width=100%><center><span style="color:white;font-size:12 pt"><i>{dude}</i> {if(CritSuccessCheck,' <b><i>CRITICALLY SUCCEEDS</b></i> ',if(SuccessCheck, ' <b>SUCCEEDS</b> ' ,if(CritFailureCheck,' <b><i>CRITICALLY FAILS</b></i> ' , ' <b>FAILS</b> ' )))}  by <b>{AbsResult}</span></center></b></td></table><br>
It has a minor cosmetic issue, in that when it prompts you (for Skill_Level and Modifier) it uses the GM Name of the token in the header of the prompt box, rather than regular Name. There is no visual reference to the regular Name made, until the macro output is shown. Sometimes these 2 values don't match, and this slows me down as I figure out which is which. I sometimes use this macro for quick contests of skill, selecting 2 tokens at once and it would be a lot nicer to play with if it was prompting using the regular Name instead of the GM Name. Is this possible, and how would you go about doing this?

I'm a beginner at scripting, and I'm hoping this is just a small change to this macro, rather than a redesign from square one.

Thanks.

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

Re: [Help] Macro tweaking

Post by wolph42 »

are you sure you give the entire code, as I don't see any reference in the macro where it 'asks' you for the input.

User avatar
Kazander
Cave Troll
Posts: 26
Joined: Mon Aug 06, 2012 2:56 pm

Re: [Help] Macro tweaking

Post by Kazander »

I just double checked. I copied/pasted the entire thing. All the lines match. The "Auto Execute" and "Apply to Selected Tokens" options are enabled.

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

Re: [Help] Macro tweaking

Post by wolph42 »

Ok, in that case I would suggest that you use Wiki: input() to get the variables

something like this:

Code: Select all

[h:abort(input(
    "junk|<html><b>Enter values for: "+token.name+"<br></html>|-|LABEL|SPAN=TRUE",
    "SkillLevel|0|Skill Level",
    "Mod|0|Modifier"
))]

[h:Skill = SkillLevel+Mod] 

User avatar
Kazander
Cave Troll
Posts: 26
Joined: Mon Aug 06, 2012 2:56 pm

Re: [Help] Macro tweaking

Post by Kazander »

Thank you!

Post Reply

Return to “MapTool”