These are my first attempts at creating macros in MapTool. I made them for a 7th edition Call of Cthulhu adventure.
They refer to an NPC token, corbitt, which has a custom MP (magic point) property of 18. But both macros report the MP property as being 1 higher than it displayed in the token's Properties panel.
The quick fix is to set the NPC's MP score down by one, but I'd like to know what's going wrong.
Any ideas?
Second question: is it possible to reference a variable or a dice roll inside a string using the "if" command (like below)? Every time I tried I got errors.
Code: Select all
[r: if(CorbitWins,"PC controlled" SpellDuration "round","PC not controlled")]
Code: Select all
[r: if(CorbitWins,"PC controlled" [1d6+1] "rounds","PC not controlled")]
- Richard
Recharge Magic Points
This should increase the MP property of the NPC token corbitt by 1 each time it's run, up to a maximum of 18. But it treats the max value for MP as 19.
Code: Select all
<!-- Corbitt's MP -->
[h: selectTokens("corbitt")]
[h: CorbitMP = getProperty("MP", "corbitt")]
[h: CorbitMP = max(18)]
[h: setProperty("MP", CorbitMP+1, "corbitt")]
["Corbitt's current MP:"] [CorbitMP]
This macro should do the following:
1. Reduce Corbitt's current MP by 1.
2. Ask for the PC's Power ability score (the range is 1-100).
3. Calculate opposed Power rolls for the PC and the NPC.
4. Display the result of the check.
5. Display the NPC's new MP score.
However, CorbitMP always returns a value that is one higher than the token's actual MP score.
Code: Select all
<!-- Corbitt's MP -->
[h: selectTokens("corbitt")]
[h: CorbitMP = getProperty("MP", "corbitt")]
[h: setProperty("MP", CorbitMP-1, "corbitt")]
<!-- PC's Power check -->
[h: PCpow = PCPower]
[h: PCroll = d100]
[h: PCresult = PCpow - PCroll]
<!-- Corbitt's Power check -->
[h: Corpow = 90]
[h: Corroll = d100]
[h: Corresult = Corpow - Corroll]
[h: SpellDuration = (1d6+1) "rounds"]
<!-- Result calculated -->
[h: CorbitWins = if(PCresult<Corresult,1,0)]
[h: CorbitMiss = if(PCresult>Corresult,1,0)]
[r: if(CorbitWins,"PC controlled","PC not controlled")]
[r: if(CorbitWins,SpellDuration,"")]
[r: if(CorbitWins,"rounds","")]
["Corbitt's current MP:"] [CorbitMP]