Help getting this macro working

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
Envyus
Cave Troll
Posts: 57
Joined: Thu Sep 13, 2012 2:56 am

Help getting this macro working

Post by Envyus »

This macro was from a 3.5 game I was playing and worked there I wanted something like it for 5e so I modified it for that.

Code: Select all

[h: success = input("Skill | Acrobatics, AnimalHandling, Arcana, Athletics, Deception, History, Insight, Intimidation, Investigation, Medicine, Nature, Perception, Performance, Persuasion, Religion, SleightofHand, Stealth, Survival  
 | Roll: | RADIO|value=string")]     

[h: abort(success)]    [H: Result = ""]  <table><tr><td><span><b>Skill Check</b> <tr><td><b>[Skill]</b></td></tr>  - Natural Roll: [Roll = 1d20] <br> 
[H:Result = if(Skill== "Acrobatics", Roll+Acrobatics+DexMod, Result)] 
[H:Result = if(Skill== "AnimalHandling", Roll+AnimalHandling+WisMod, Result)]
[H:Result = if(Skill==  "Arcana", Roll+Arcana+IntMod, Result)] 
[H:Result = if(Skill== "Athletics", Roll+Athletics+StrMod, Result)]
[H:Result = if(Skill==  "Deception", Roll+Deception+ChaMod, Result)] 
[H:Result = if(Skill== "History", Roll+History+IntMod, Result)] 
[H:Result = if(Skill== "Insight", Roll+Insight+WisMod, Result)] 
[H:Result = if(Skill== "Intimidation" ,Roll+Intimidation+ChaMod, Result)] 
[H:Result = if(Skill==  "Investigation", Roll+Investigation+IntMod, Result) 
[H:Result = if(Skill== "Medicine", Roll+Medicine+WisMod, Result)] 
[H:Result = if(Skill== "Nature", Roll+Nature+IntMod, Result)] 
[H:Result = if(Skill== "Perception", Roll+Perception+WisMod, Result)] 
[H:Result = if(Skill==  "Performance", Roll+Performance+ChaMod, Result)] 
[H:Result = if(Skill==  "Persuasion, Roll+Persuasion+ChaMod, Result)] 
[H:Result = if(Skill== "Religion", Roll+Religion+IntMod, Result)] 
[H:Result = if(Skill== "SleightofHand", Roll+SleightofHand+DexMod, Result)] 
[H:Result = if(Skill== "Stealth", Roll+Stealth+DexMod, Result)] 
[H:Result = if(Skill==  "Survival", Roll+Survival+WisMod, Result)]  - Total: <b>[Result]</b>
The problem is that when I use the macro it comes out looking like this.
Skill Check
Acrobatics
- Natural Roll: 7 [H:Result = if(Skill== "Investigation", Roll+Investigation+IntMod, Result) [H:Result = if(Skill== "Medicine", Roll+Medicine+WisMod, Result)] [H:Result = if(Skill== "Nature", Roll+Nature+IntMod, Result)] [H:Result = if(Skill== "Perception", Roll+Perception+WisMod, Result)] [H:Result = if(Skill== "Performance", Roll+Performance+ChaMod, Result)] [H:Result = if(Skill== "Persuasion, Roll+Persuasion+ChaMod, Result)] [H:Result = if(Skill== "Religion", Roll+Religion+IntMod, Result)] [H:Result = if(Skill== "SleightofHand", Roll+SleightofHand+DexMod, Result)] [H:Result = if(Skill== "Stealth", Roll+Stealth+DexMod, Result)] [H:Result = if(Skill== "Survival", Roll+Survival+WisMod, Result)] - Total: [Result]

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Help getting this macro working

Post by aliasmask »

You're missing a " after Persuasion.

Envyus
Cave Troll
Posts: 57
Joined: Thu Sep 13, 2012 2:56 am

Re: Help getting this macro working

Post by Envyus »

aliasmask wrote:You're missing a " after Persuasion.
Thanks though it still doing this
Skill Check
Acrobatics
- Natural Roll: 11 [H:Result = if(Skill== "Investigation", Roll+Investigation+IntMod, Result) [H:Result = if(Skill== "Medicine", Roll+Medicine+WisMod, Result)] [H:Result = if(Skill== "Nature", Roll+Nature+IntMod, Result)] [H:Result = if(Skill== "Perception", Roll+Perception+WisMod, Result)] [H:Result = if(Skill== "Performance", Roll+Performance+ChaMod, Result)] [H:Result = if(Skill== "Persuasion", Roll+Persuasion+ChaMod, Result)] [H:Result = if(Skill== "Religion", Roll+Religion+IntMod, Result)] [H:Result = if(Skill== "SleightofHand", Roll+SleightofHand+DexMod, Result)] [H:Result = if(Skill== "Stealth", Roll+Stealth+DexMod, Result)] [H:Result = if(Skill== "Survival", Roll+Survival+WisMod, Result)] - Total: [Result]

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

Re: Help getting this macro working

Post by wolph42 »

That usually means two things:
1 youre using '
2 you forgot a closing or opening bracket[ ]

I don't see it on my iPad but check with np++ see alias' signature for more info

Envyus
Cave Troll
Posts: 57
Joined: Thu Sep 13, 2012 2:56 am

Re: Help getting this macro working

Post by Envyus »

Uggh I can't find whats out of place.

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Help getting this macro working

Post by aliasmask »

Missing ] at end of Investigation line.

Envyus
Cave Troll
Posts: 57
Joined: Thu Sep 13, 2012 2:56 am

Re: Help getting this macro working

Post by Envyus »

aliasmask wrote:Missing ] at end of Investigation line.
Thank you thank you it works now.

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Help getting this macro working

Post by aliasmask »

Here is another way of doing the same thing:

Code: Select all

[H: skillStatObj = json.set("{}","Acrobatics","Dex","AnimalHandling","Wis","Arcana","Int","Athletics","Str","Deception","Cha","History","Int","Insight","Wis","Intimidation","Cha","Investigation","Int","Medicine","Wis","Nature","Int","Perception","Wis","Performance","Cha","Persuasion","Cha","Religion","Int","SleightofHand","Dex","Stealth","Dex","Survival","Wis"]
[H: skillList = json.fields(skillStatObj)]

[H: abort(input(strformat("skill|%{skillList}|Roll|RADIO|VALUE=STRING")))]

[H: roll = 1d20]
[H: stat = json.get(skillStatObj,skill)]
[H: mod = eval( stat + "Mod")]
[H: result = eval(strformat("roll + %{skill} + %{mod}"))]

[H: output = strformat('
<table>
   <tr>
      <td><b>Skill Check:</b></td> <td><b>%{skill}</b></td>
   </tr>
   <tr>
      <td>Roll:</td> <td>%{roll}</td>
   </tr>
   <tr>
      <td>%{stat} Mod:</td> <td>%{mod}</td>
   </tr>
   <tr>
      <td>Total:</td> <td>%{result}</td>
   </tr>
</table>
')]

[R: output]

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

Re: Help getting this macro working

Post by wolph42 »

wolph42 wrote:That usually means two things:
1 youre using '
2 you forgot a closing or opening bracket[ ]

I don't see it on my iPad but check with np++ see alias' signature for more info
Envyus wrote:
aliasmask wrote:Missing ] at end of Investigation line.
Thank you thank you it works now.
:D

I should have elaborated a bit. Stray use of ' leads to 'truncated' code. that is the code just stops after that '. Sometimes porting to chat and sometimes not.

forgetting a ] will treat the entire segment as text and thus port it straight to chat 'unparsed' thats what you got.

Since it ported ALL the code to the chat window it meant with 90% certainty that it was in fact a missing ].

These things are a LOT easier to find by using aliasmask plugin in notepad++, which, as I said earlier, can be found through his signature.

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: Help getting this macro working

Post by Jagged »

wolph42 wrote: These things are a LOT easier to find by using aliasmask plugin in notepad++, which, as I said earlier, can be found through his signature.
Echo this ^

Also Notepad++ offers other useful things to a Maptool developer, like JSON viewers ( I use JSTool ). It doesn't take long before you wonder how you ever lived without it ;)

Post Reply

Return to “Macros”