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

Charactermaker API bug

This API behaves too poorly in conjunction with the roll20 mobile app.  If anyone logs in with mobile devices for some reason my players are constantly generating a bunch of empty character sheets and they are telling me they are not doing that.  I have had to disable this script because of this as I'm sick of deleting 10+ empty sheets a day.  
1625169488
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
What is the Charactermaker API? I don't see anything by that name in One Click. Do you have a link?
I thought I had a link to it and I also thought I named it properly but apparently I did not.&nbsp; I've tried to match its script to the google searches but I'm coming up dry here.&nbsp; I don't know whose work it is so all I can do is share the script here in hopes someone recognizes it.&nbsp;&nbsp; on('ready',()=&gt;{ const IN_PLAYER_JOURNALS = true; const TIME_TO_CHECK = 1000; const styles = { box: 'display: block; border: 1px solid #999; border-radius: .3em; padding: .3em; background-color: white; box-shadow: 0 0 25px 2px #999; margin: 1em 0 1em 0;', charRow: 'display: block; border-top: 1px solid #ccc; margin: .2em;', img: 'max-width: 2em; max-height: 3em;width:auto;height:auto;border:1px solid #999;float:left;margin: .1em; display: inline-block;', link: 'color: #07c; border: 1px solid #999; border-radius: .3em; padding: .3em 1em; background-color:#ccc;font-weight: bold;display: inline-block;float: right;margin: .1em;', addBtn: 'color: #fff; border: 1px solid #9f9; border-radius: .3em; padding: .3em 1em; background-color:#3c3;font-weight: bold;display: inline-block;float: right;margin: .1em;' }; const defaultImg = '<a href="https://app.roll20.net/images/character.png" rel="nofollow">https://app.roll20.net/images/character.png</a>'; const clear = ()=&gt;`&lt;div style="clear:both"&gt;&lt;/div&gt;`; const GetCharImage = (c) =&gt; c.get('avatar')||defaultImg; const GetShowCharacter = (c) =&gt; `&lt;div style="${styles.charRow}"&gt;&lt;a style="${styles.link}" href="<a href="http://journal.roll20.net/character/${c.id}&quot;&gt;Open&lt;/a&gt;&lt;img" rel="nofollow">http://journal.roll20.net/character/${c.id}"&gt;Open&lt;/a&gt;&lt;img</a> style="${styles.img}" src="${GetCharImage(c)}"/&gt;${c.get('name')}${clear()}&lt;/div&gt;`; const AddButton = () =&gt; `&lt;a style="${styles.addBtn}" href="!add-player-character"&gt;+&lt;/a&gt;`; const AddPlayerCharacter = (player) =&gt; { let c = createObj('character',{ controlledby: player.id, name: `${player.get('displayname')}'s New Character`, inplayerjournals: (IN_PLAYER_JOURNALS ? 'all' : '') }); return c; }; const ShowPlayerCharacters = (player,chars)=&gt;{ chars = chars||findObjs({ type: 'character', archived: false }).filter(c=&gt;c.get('controlledby').split(/\s*,\s*/).includes(player.id)); sendChat('',`/w "${player.get('displayname')}" &lt;div style="${styles.box}"&gt;&lt;div&gt;${AddButton()}Your Characters:${clear()}&lt;/div&gt;${chars.map(GetShowCharacter).join('')}&lt;/div&gt;`); }; const CheckPlayerCharacters = (player) =&gt; { if(playerIsGM(player.id)){ return; } let chars = findObjs({ type: 'character', archived: false }).filter(c=&gt;c.get('controlledby').split(/\s*,\s*/).includes(player.id)); if( ! chars.length){ chars.push(AddPlayerCharacter(player)); } ShowPlayerCharacters(player,chars); }; on('chat:message', (msg) =&gt; { if('api' === msg.type &amp;&amp; /^!add-player-character\b/i.test(msg.content)){ let player = getObj('player',msg.playerid); if(player){ AddPlayerCharacter(player); ShowPlayerCharacters(player); } } }); const checkAll = () =&gt; { findObjs({ type: 'player' }).forEach(CheckPlayerCharacters); }; setTimeout(()=&gt;{ checkAll(); on('change:player:_online',(obj)=&gt;{ if(true === obj.get('online')){ setTimeout(()=&gt;CheckPlayerCharacters(obj),TIME_TO_CHECK); } }); }, TIME_TO_CHECK ); });
Very specifically something about the roll20 app on phones is making character sheets nonstop when the players navigate to their session while fiddling at work and on offnights from our sessions.&nbsp; They are telling me they are not making sheets or clicking the buttons, yet every day I'm deleting 10ish blank sheets for the two guys using their phones.&nbsp;&nbsp;