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

API button not showing properly

July 16 (7 years ago)

I have this and it is not showing properly.  See on the left hand side it works fine, but the right hand side shows up ugly in chat.  Any ideas why?




July 16 (7 years ago)
The Aaron
Pro
API Scripter

If I had to guess, I'd say it's a problem with the new editor inserting <p></p> around each line before it get's dumped to the chat.

Install this script, run the macro, then disable the script and paste back the results from the API log:

on('ready',()=>{
    on('chat:message',(msg)=>{
        log('Begin Chat Message');
        log(msg);
        log('End Chat Message');
    });
});

July 17 (7 years ago)

Edited July 17 (7 years ago)

I hope it makes more sense to you than to me. :-)



"☒☠☒ Initialized It's A Trap! using theme '5E-Generic' ☒☠☒"

"5eShapedScript 1531790687379 INFO : Detected sheet version as : 18.1.11"

"5eShapedScript 1531790687382 INFO : Starting configuration state: {\"version\":5.1,\"config\":{\"genderPronouns\":[{\"matchPattern\":\"^f$|female|girl|woman|feminine\",\"nominative\":\"she\",\"accusative\":\"her\",\"possessive\":\"her\",\"reflexive\":\"herself\"},{\"matchPattern\":\"^m$|male|boy|man|masculine\",\"nominative\":\"he\",\"accusative\":\"him\",\"possessive\":\"his\",\"reflexive\":\"himself\"},{\"matchPattern\":\"^n$|neuter|none|construct|thing|object\",\"nominative\":\"it\",\"accusative\":\"it\",\"possessive\":\"its\",\"reflexive\":\"itself\"}],\"logLevel\":\"INFO\",\"tokenSettings\":{\"number\":true,\"bar1\":{\"attribute\":\"HP\",\"max\":true,\"link\":false,\"showPlayers\":false},\"bar2\":{\"attribute\":\"speed\",\"max\":false,\"link\":true,\"showPlayers\":false},\"bar3\":{\"attribute\":\"\",\"max\":false,\"link\":false,\"showPlayers\":false},\"aura1\":{\"radius\":\"\",\"color\":\"#FFFF99\",\"square\":false},\"aura2\":{\"radius\":\"\",\"color\":\"#59e594\",\"square\":false},\"light\":{\"radius\":\"60\",\"dimRadius\":\"-5\",\"otherPlayers\":false,\"hasSight\":true,\"angle\":360,\"losAngle\":360,\"multiplier\":1},\"showName\":true,\"showNameToPlayers\":false,\"showAura1ToPlayers\":true,\"showAura2ToPlayers\":true,\"monsterTokenName\":\"\"},\"newCharSettings\":{\"sheetOutput\":\"***default***\",\"deathSaveOutput\":\"***default***\",\"initiativeOutput\":\"***default***\",\"showNameOnRollTemplate\":\"{{show_character_name=1}}\",\"rollOptions\":\"1d20\",\"initiativeRoll\":\"***default***\",\"initiativeToTracker\":\"***default***\",\"breakInitiativeTies\":true,\"showTargetAC\":true,\"showTargetName\":true,\"autoAmmo\":true,\"autoRevertAdvantage\":true,\"houserules\":{\"mediumArmorMaxDex\":0,\"saves\":{\"useCustomSaves\":false,\"useAverageOfAbilities\":false,\"fortitude\":{\"fortitudeStrength\":false,\"fortitudeDexterity\":false,\"fortitudeConstitution\":false,\"fortitudeIntelligence\":false,\"fortitudeWisdom\":false,\"fortitudeCharisma\":false},\"reflex\":{\"reflexStrength\":false,\"reflexDexterity\":false,\"reflexConstitution\":false,\"reflexIntelligence\":false,\"reflexWisdom\":false,\"reflexCharisma\":false},\"will\":{\"willStrength\":false,\"willDexterity\":false,\"willConstitution\":false,\"willIntelligence\":false,\"willWisdom\":false,\"willCharisma\":false},\"savingThrowsHalfProf\":true},\"baseDC\":\"***default***\",\"expertiseAsAdvantage\":false,\"inspirationMultiple\":false,\"criticalDamageHouserule\":\"CRITICAL_DAMAGE_IS_MAXIMIZED\",\"proficiencyDice\":true,\"psionics\":true,\"customClasses\":true,\"honorToggle\":false,\"sanityToggle\":true,\"hitPointsRecoveredOnALongRest\":\"***default***\",\"hitDiceRecoveredOnALongRest\":\"***default***\",\"diceSystem\":\"***default***\",\"deathSavingThrowChances\":\"***default***\",\"proficientArmorWeighs\":\"***default***\",\"hitDiceRecoveredOnAShortRest\":\"***default***\"},\"tab\":\"***default***\",\"tokenActions\":{\"initiative\":true,\"abilityChecks\":\"abilChecks\",\"advantageTracker\":\"advantageTrackerShort\",\"savingThrows\":\"saves\",\"statblock\":true,\"traits\":\"traits\",\"actions\":\"actionsMacro\",\"reactions\":\"reactionsMacro\",\"legendaryActions\":\"legendaryA\",\"lairActions\":\"lairA\",\"regionalEffects\":\"regionalE\",\"rests\":true,\"spells\":true,\"showRecharges\":true,\"classFeatures\":\"classFeatures\",\"feats\":\"featsMacro\",\"racialTraits\":\"racialTraits\",\"offense\":\"offenseMacro\",\"utility\":\"utilityMacro\"},\"textSizes\":{\"spellsTextSize\":\"text\",\"abilityChecksTextSize\":\"text\",\"savingThrowsTextSize\":\"text\"},\"hide\":{\"hideAttack\":\"***default***\",\"hideDamage\":\"***default***\",\"hideAbilityChecks\":\"***default***\",\"hideSavingThrows\":\"***default***\",\"hideSavingThrowDC\":\"***default***\",\"hideSavingThrowFailure\":\"***default***\",\"hideRecharge\":\"***default***\",\"hideFreetext\":\"***default***\",\"hideContent\":\"***default***\"},\"applyToAll\":true,\"hitDiceOutput\":\"***default***\",\"display\":{\"showPassiveSkills\":true,\"showWeight\":\"***default***\",\"showEmote\":true,\"showFreetext\":true,\"showFreeform\":true,\"showDiceModifiers\":false,\"showCritRange\":true,\"extraOnACrit\":false},\"measurementSystems\":{\"distanceSystem\":\"***default***\",\"weightSystem\":\"***default***\"},\"automaticHigherLevelQueries\":\"***default***\",\"automaticallyExpendSpellResources\":true,\"automaticallyRollDamageForAttacks\":\"***default***\",\"automaticallyRollDamageForSavingThrows\":\"***default***\"},\"advTrackerSettings\":{\"showMarkers\":false,\"ignoreNpcs\":false,\"advantageMarker\":\"green\",\"disadvantageMarker\":\"red\",\"output\":\"silent\"},\"sheetEnhancements\":{\"rollHPOnDrop\":true,\"autoHD\":true,\"autoTraits\":true,\"turnRecharges\":false,\"ammoRecovery\":true},\"defaultGenderIndex\":2,\"variants\":{\"rests\":{\"longRestHDRecovery\":0.5,\"longRestHPRecovery\":1}},\"playerId\":\"-L7N4cK-8dDHsjgSH6vw\"},\"ammoTracking\":{}}"

"Sheet Worker ERROR: Unable to find valid character with ID -LH_pj44lNEtcfoYFR7Y"

"Begin Chat Message"

{"content":" {{title=Hybrid Form}} {{text_big=**Attacks**","playerid":"-L7N4cK-8dDHsjgSH6vw","rolltemplate":"5e-shaped","target":"gm","target_name":"GM","type":"whisper","who":"Omegaman (GM)"}

"End Chat Message"

"Begin Chat Message"

{"content":"[Bite](!group-check)","playerid":"-L7N4cK-8dDHsjgSH6vw","type":"general","who":"Omegaman (GM)"}

"End Chat Message"

"Begin Chat Message"

{"content":"[Claws](~Save-Damage)","playerid":"-L7N4cK-8dDHsjgSH6vw","type":"general","who":"Omegaman (GM)"}

"End Chat Message"

"Begin Chat Message"

{"content":"","playerid":"-L7N4cK-8dDHsjgSH6vw","type":"general","who":"Omegaman (GM)"}

"End Chat Message"

"Begin Chat Message"

{"content":"**Hybrid Traits**","playerid":"-L7N4cK-8dDHsjgSH6vw","type":"general","who":"Omegaman (GM)"}

"End Chat Message"

"Begin Chat Message"

{"content":"[Predatory Swiftness-Bonus](~Apply-Damage)","playerid":"-L7N4cK-8dDHsjgSH6vw","type":"general","who":"Omegaman (GM)"}

"End Chat Message"

"Begin Chat Message"

{"content":"[Regenerate](!token-mod --set bar3_reset|0)","playerid":"-L7N4cK-8dDHsjgSH6vw","type":"general","who":"Omegaman (GM)"}

"End Chat Message"

July 17 (7 years ago)
The Aaron
Pro
API Scripter

It does.  So what you are getting is 7 distinct messages (simplified to just the contents here):

"content":" {{title=Hybrid Form}} {{text_big=**Attacks**"
"content":"[Bite](!group-check)"
"content":"[Claws](~Save-Damage)"
"content":""
"content":"**Hybrid Traits**"
"content":"[Predatory Swiftness-Bonus](~Apply-Damage)"
"content":"[Regenerate](!token-mod --set bar3_reset|0)"
but it should be coming across as one like this:
"content":" {{title=Hybrid Form}} {{text_big=**Attacks**<br>\n[Bite](!group-check)<br>\n[Claws](~Save-Damage)<br>\n<br>\n**Hybrid Traits**<br>\n[Predatory Swiftness-Bonus](~Apply-Damage)<br>\n[Regenerate](!token-mod --set bar3_reset|0)"

Try joining each line and then separating it again with shift-enter, and see if that fixes it.


July 17 (7 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Just to double check, since the last line of your macro in the first post is not shown: You are closing the roll template with "}}"?

Because that's exactly the sort of output I see if I forget to close.

July 17 (7 years ago)
The Aaron
Pro
API Scripter

OH!  Thats a great catch, Keith!  He is missing the }} in that last content above and I didn't even notice!

July 17 (7 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

I would not know this because I have never made this mistake. Nope,not me.

July 17 (7 years ago)
The Aaron
Pro
API Scripter


keithcurtis said:

Because that's exactly the sort of output I see if I forget to close.

uh-huh...


July 17 (7 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Drat my past self. Always screwing things up for present me. That guy never exercises or saves money. I'd be rich and beautiful if not for him.

The Aaron said:


keithcurtis said:

Because that's exactly the sort of output I see if I forget to close.

uh-huh...