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

Multi-line macros via the API...

I'm not sure how to go about making a multi-line macro using createObject. Anyone know of a way?
1395584329
Alex L.
Pro
Sheet Author
HoneyBadger said: I'm not sure how to go about making a multi-line macro using createObject. Anyone know of a way? wouldnt you just user \r or \n?
1395584765
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
I have done it.... "\n" if I recall.
How would that work? Wouldn't it just print out as: Character: First line \r Second line AddPCPower("Melee Basic", "First line \r Second line?", Character.id, true); function AddPCPower (powername, powerstring, charid, tokenaction) { createObj("ability", { name: powername, description: "", action: powerstring, istokenaction: tokenaction, characterid: charid });
1395584955

Edited 1395585100
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
{ name: "SavingThrow", description: "", action: "/me [[ 1d20 ]] for save versus\n\ ~~~|Table|~~~\n\ • @{Sav_vs_PPD} Para., Poison, or Death\n\ • @{Sav_vs_RSW} Rod, Staff, or Wand\n\ • @{Sav_vs_PP} Petri. or Polymorph\n\ • @{Sav_vs_BW} Breath Weapon\n\ • @{Sav_vs_Spells} Spell\n" + roll20API.outOfCharacter + "Note: Excludes Wisdom adjustments (@{wis_Magical}) for mind attacks and other adjustments." }, For my character record sheet generator I have all the default macros in an array and then just loop through creating them. //Creates Abilities roll20API.processAbilities = function processAbilities(character) { for (var ability in roll20API.abilities) { createObj("ability", { name: roll20API.abilities[ability].name, description: "", action: roll20API.abilities[ability].action, characterid: character.id }); }; }
Ah, thank you. Will that work as a variable too? var PowerString = "Firstline\n\ Second Line\n\ Third Line";
1395585357
Alex L.
Pro
Sheet Author
HoneyBadger said: Ah, thank you. Will that work as a variable too? var PowerString = "Firstline\n\ Second Line\n\ Third Line"; yeah its a string thing /n is new line.
Woot, got it work. Thanks all!