String length limit inside if conditional

Developer discussion regarding MapTool 1.4

Moderators: dorpond, trevor, Azhrei

Forum rules
Posting now open to all registered forum users.
Post Reply
User avatar
Cragrim
Kobold
Posts: 3
Joined: Sun Aug 20, 2017 7:21 am

String length limit inside if conditional

Post by Cragrim »

Heya

This will be my first post here aside from trying out and attempting to learn Maptool so I hope I'm posting this in the proper section. If not then please feel free to point me the right way :)

I can't seem to exceed a certain amount of string characters inside the if conditional operation.
It could just be something I'm blind to or maybe you can point me in the right direction on how to work around this?

Appreciate any advice or help :)
Running Maptool V1.4.1.8

Example macro that works:

Code: Select all

[if(state.Blur == 1), CODE:
{
     [h:state.Blur=0]
};
{
     [h:state.Blur=1]
     <b>[r:token.name] is <u>blurred</u>!<br></b>
*Your body becomes blurred, shifting and wavering to all who can see you. For the Duration, any creature has disadvantage on Attack rolls against you.
}]
Example macro that breaks:

Code: Select all

[if(state.Blur == 1), CODE:
{
     [h:state.Blur=0]
};
{
     [h:state.Blur=1]
     <b>[r:token.name] is <u>blurred</u>!<br></b>
*Your body becomes blurred, shifting and wavering to all who can see you. For the Duration, any creature has disadvantage on Attack rolls against you.<br>
*An attacker is immune to this effect if it doesn't rely on sight, as with blindsight, or can see through illusions, as with truesight.
}]
Screenshot of testing both macros:
Image

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

Re: String length limit inside if conditional

Post by aliasmask »

It's the single quote that is breaking it. I recommend formatting your output and saving it to a variable and then output the variable.

Code: Select all

[H: output = strformat("<b>%{token.name} is <u>blurred</u>!<br></b>
*Your body becomes blurred, shifting and wavering to all who can see you. For the Duration, any creature has disadvantage on Attack rolls against you.<br>
*An attacker is immune to this effect if it doesn't rely on sight, as with blindsight, or can see through illusions, as with truesight.")]
[R: output]

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

Re: String length limit inside if conditional

Post by wolph42 »

yeah, single quotes are b*tch in maptool, they can also screw up macros when you use them in <!-- the comments --> so try to avoid them or make VERY sure that they are in 'pairs'. To give you an idea of the influence of the single quote, read the 'working with two code levels' article linked in my sig.
Also since your new to MT, you might be interested in checking out the first link in my sig. And to all new user who start scripting in MT, at least read the 'read this' article also linked in my sig. Its core to the MT scripting language.

Post Reply

Return to “MapTool 1.4”