Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

line break in coding a macro?

Is there a way to do a line break writing  a macro... is very confusing to code anything without a linebreak. i.e. ";" 

October 24 (4 years ago)
Kraynic
Pro
Sheet Author

If you use a roll template, you should be able to use line breaks.  Everyone has access to the default template, but what other templates you may have access to will be determined by what character sheet you are using.

https://wiki.roll20.net/Roll_Templates

October 24 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

If you could post the macro you have so far, we might be able to offer specific advice.

October 24 (4 years ago)

Edited October 25 (4 years ago)

Here's what I've got so far:

&{template:2Edefault}
{{name=@{selected|token_name} uses Contact}}
{{subtitle=Telepathic Science *CompPsi p80*}}
{{Power Score=Wisdom}}
{{PSP Cost:=?{Target level or hit dice|1-5,3/2|6-10,8/4|11-15,13/7|16+,18/9}}}
{{Maintain=1/round}}
{{Range=special}}
{{Preparation Time=0}}
{{Area of Effect=Individual}}
{{Prerequisite=None}}
{{Check:PS=All established contacts are free for 4 rounds}}
{{Check:20=Cannot use Contact on this mind until next level}}
{{desc=Life Order:|PS Mod ||Mammal|-1||Marsupial|-2}}

I need to either add line breaks so I can include a couple of tables, or modify the Power Score twice (possibly three times) the same way I'm modifying the cost.  The table I'm trying to include looks like this:


Life OrderPower Score ModRangePower Score Mod
Mammal-1Line of Sight0
Marsupial-21 mile-1
Bird-310 miles-2
Reptile/Amphibian-4100 miles-3

You get the idea.  Both tables modify the Power Score.  I thought the pipes might function as line breaks or table separations, but they obviously don't.


Edit.  Just realized there are two modifier boxes for the die roll on the character sheet.

If I put 

?{Life Order|Mammal,-1|Marsupial,-2|Bird,-3|Reptile,-4|Fish,-5|Arachnid/Bug,-6|Monster,-7|Plant-8}

into the first box, and 

?{Range|Line of Sight,0|1 mile,-1|10 miles,-3|100 miles,-4|1000 miles,-7|10000 miles,-9}

in the second, it will take care of it for me, I think!

October 25 (4 years ago)

Edited October 25 (4 years ago)

Still, for several other macros, a line break would be really nice.

Something that looks like this:



keithcurtis said:

If you could post the macro you have so far, we might be able to offer specific advice.


I think I am being misunderstood. I don't want to do a linebreack on the result I want to be able to do a linebreak in the code itself without affecting the result. For example, I am using the DnD5e spell template here:

&{template:spell} {{level=@{selected|repeating_spell-2_$0_spellschool} @{selected|repeating_spell-2_$0_spelllevel}}} {{name=@{selected|repeating_spell-2_$0_spellname}}} {{castingtime=@{selected|repeating_spell-2_$0_spellcastingtime}}} {{range=@{selected|repeating_spell-2_$0_spellrange}}} {{target=@{selected|repeating_spell-2_$0_spelltarget}}} @{selected|repeating_spell-2_$0_spellcomp_v} @{selected|repeating_spell-2_$0_spellcomp_s} {@{selected|repeating_spell-2_$0_spellcomp_m}} {{material=@{selected|repeating_spell-2_$0_spellcomp_materials}}} {{duration=@{selected|repeating_spell-2_$0_spellduration}}} {{description=@{selected|repeating_spell-2_$0_spelldescription}}} {{athigherlevels=@{selected|repeating_spell-2_$0_spellathigherlevels}}} @{selected|repeating_spell-2_$0_spellritual} @{selected|repeating_spell-2_$0_spellconcentration} {{charname=charname}}


Waaaay too long and difficult to read the CODE i want to know if it is able to add a line break to the code!
&{template:spell}
{{level=@{selected|repeating_spell-2_$0_spellschool}
@{selected|repeating_spell-2_$0_spelllevel}}}
etc
etc
etc

without affecting the code
October 25 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

Unfortunately no, you cant. The above code is a rolltemplate, and an entire rolltemplate code must be on a single line. If you put a line break, everything after the linebreak will be treated as not part of the template, breaking the output.

October 26 (4 years ago)

Edited October 26 (4 years ago)
Oosh
Sheet Author
API Scripter

You can put linebreaks in while you're putting the macro together, but you'll need to remove them before you run it. I usually break them apart to edit the bit I need (especially with complex rolls) then stitch them back up.

Just checking - you're not trying to edit these in Roll20, are you? Copy and paste the content to Notepad or something, and stretch the window nice and wide. For macros with lots of long Attribute calls, you can usually get a window width where word wrap will group the lines pretty neatly.


You could also use something like VS Code to edit the macro. That will remove all linebreaks from your selection with a single command.

I am actually using VS Code though I did not know of such command! thanks for the idea!

Oosh said:

You can put linebreaks in while you're putting the macro together, but you'll need to remove them before you run it. I usually break them apart to edit the bit I need (especially with complex rolls) then stitch them back up.

Just checking - you're not trying to edit these in Roll20, are you? Copy and paste the content to Notepad or something, and stretch the window nice and wide. For macros with lots of long Attribute calls, you can usually get a window width where word wrap will group the lines pretty neatly.


You could also use something like VS Code to edit the macro. That will remove all linebreaks from your selection with a single command.