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

All Scripts Causing "Error setting up custom sheet: TypeError: Cannot read property 'split' of undefined"

I saw a thread about a similar issue but it was closed because it was over a year old. I am trying to add some custom scripts to my game and even with a "barebones" function based on example code it causes this error message: "Error setting up custom sheet: TypeError: Cannot read property 'split' of undefined" My test script: on('add:graphic',function(obj){ return false; }); I'm wondering if something has changed in the api that I'm missing? Is this happening for others or just me for some odd reason? Thanks everyone!
1492188194
The Aaron
Pro
API Scripter
This sounds like you have part of a custom character sheet setup and it has a sheet worker which is bad.  Try switching your Game's character sheet to none and then restart the API by saving a script.  That should make the error go away. Character sheet sheet workers get loaded on the API, so if their code has an error, it will prevent the API from starting up.
1492188521

Edited 1492189234
Very strange! Especially since my custom character sheet is super basic (I think!) with no obvious sheet workers... Are "repeating_*" fields considered workers? I'm going to start a tag at a time and see if I can find the issue...I have a quest! I'll report my findings once I've tracked it down.
1492189665
The Aaron
Pro
API Scripter
No, they'd be in a <script type="text/worker"> tag.   If you disable the sheet entirely, do you still get the crash? 
I have found the cause, and it makes no sense! This works with scripts: Custom Character Sheet <input type="text" name="bob" /> This does not work with scripts Custom Character Sheet <input type="text" name="attr_bob" /> I kind of need the attr_ part to reference in a button, so I'm not sure what to do at this point. I am going to assume this is a bug and not an intended thing...
1492190714
The Aaron
Pro
API Scripter
Try changing it to: <input type="text" name="attr_bob" value="0"/>
Scripts still error out. Here is the custom character sheet in its current form: <h3>Attributes</h3> <fieldset>     <div class="2colrow">         <div class="sheet-col">AGILITY</div>         <div class="sheet-col">             <input type="text" name="attr_bob" value="0" />       </div>     </div> </fieldset>
1492192716
The Aaron
Pro
API Scripter
I got nothing. =D  I'll highlight it to the devs and maybe they can duplicate it.
Great, thanks! I'm scratching my head over it too!
1492202579

Edited 1492202610
Lithl
Pro
Sheet Author
API Scripter
The forum may have eaten it, but make sure to include class="repeating_foo" on your fieldset. (The forum like to eat class attributes pasted in, so it may not be your fault.) Also, do you have any other scripts installed at all?
1492202856

Edited 1492202931
I realized that and then discovered the code formatter! Here are the contents of my files currently: Custom Character Sheet <h3>Attributes</h3> <fieldset>     <div class="2colrow">         <div class="sheet-col">AGILITY</div>         <div class="sheet-col">             <input type="text" name="attr_bob" value="0" />       </div>     </div> </fieldset> Test.js on('change:campaign:turnorder',function(obj){}); If I remove "attr_" from the input name field then the script works fine. I can also add an existing roll20 script and it blows up to under this situation.
1492203623
The Aaron
Pro
API Scripter
<h3>Attributes</h3> <fieldset class="repeating_something">     <div class="2colrow">         <div class="sheet-col">AGILITY</div>         <div class="sheet-col">             <input type="text" name="attr_bob" value="0" />       </div>     </div> </fieldset> Try that.
1492207077
Lithl
Pro
Sheet Author
API Scripter
While it won't solve the problem, I'll also point out that the / on the input is completely ignored in HTML5; <input> and <input /> are treated identically (and it's actually incorrect in HTML4, where <input /> should result in <input>> according to spec). It's required in XHTML, but that's a standard that gained almost no traction.
Good call! Clean markup is good markup. Old habits die hard.
1492220830

Edited 1492221604
OK! The trigger for this is having an "attr_*" name value inside a fieldset... This is fine: <input type="text" name="attr_bob"> This breaks scripts: <fieldset> <input type="text" name="attr_bob"> </fieldset> I'm going to try putting my full markup back in and get rid of the fieldsets and see what happens then. Now that I think about it, I don't even need fieldsets...it was a holdover from markup that I borrowed from an existing sheet as sample. This may be useful for someone else though. UPDATE: I stripped out all of the fieldsets EXCEPT for my repeating area <fieldset class="repeating_skills"> <div class="sheet-2colrow">     <div class="sheet-col">         <input type="text" name="attr_skillname" />      </div>     <div class="sheet-col">          <select name="attr_dtype">                               <option value="d4">d4</option>               <option value="d6">d6</option>               <option value="d8">d8</option>               <option value="d10">d10</option>               <option value="d12">d12</option>           </select><button type="roll" name="attr_skillroll" value="&{template:default} {{name=@{skillname} Roll}} {{result=[[{@{dtype}!,d6!}kh1]]}}" />       </div> </div> </fieldset> Scripting now works! So that was a bit of silliness on my part in addition to a not so obvious issue. Now I'm wondering if it was because I had fieldsets without a class associated, or if it expects only fieldsets with the class of "repeating_*"... UPDATE UPDATE: I tried a fieldset with the class name of "test" and got an error that the script engine couldn't find a repeating section inside a fieldset. This makes me think that fieldsets are only valid for repeating sections? Doesn't Work: <fieldset class="test">     <input type="text" name="attr_bob"> </fieldset> Does Work: <fieldset class="repeating_test">     <input type="text" name="attr_bob"> </fieldset>
1492222947
The Aaron
Pro
API Scripter
The repeating class is required.