RPTools.net

Discussion and Support

Skip to content

It is currently Thu Nov 23, 2017 1:42 pm 




Forum rules


Posting now open to all registered forum users.



Reply to topic  [ 3 posts ] 

Previous topic | Next topic 

  Print view

Author Message
User avatar  Offline
Kobold
 
Joined: Sun Aug 20, 2017 6:21 am
Posts: 3
 Post subject: String length limit inside if conditional
PostPosted: Sun Aug 27, 2017 5:50 pm 
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:
[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:
[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


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7949
Location: Bay Area
 Post subject: Re: String length limit inside if conditional
PostPosted: Sun Aug 27, 2017 8:26 pm 
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:
[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]

_________________
Downloads:


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9420
Location: Netherlands
 Post subject: Re: String length limit inside if conditional
PostPosted: Mon Aug 28, 2017 2:41 am 
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.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 3 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 2 guests





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman