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

Problem with API and

1522507691

Edited 1522519414
Pktome
Pro
Sheet Author
Estou tendo um problema que antes não tinha. Toda vez que atualizo o API, por causa de alguma coisa na minha ficha dá este erro: Error setting up custom sheet: TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object. I'm having a problem that I did not have before. Every time I update the API, because of something on my sheet gives this error: Error setting up custom sheet: TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object. <script type="text/worker"> // Calculate the total of Feat Points spent on("change:repeating_magias", function() { var pontosGastos = 0; getSectionIDs("repeating_magias", function(featsArray) { if(featsArray.length > 0) { var names = _.map(featsArray, function(currentID) { return "repeating_magias_"+currentID+"_mg_pm2"; }); getAttrs(names,function(v){ var sum = _.reduce(v,function(m,a){ return m+parseInt(a,10); },0); setAttrs({ "pdm": Math.floor(sum) }); }); } }); }); </script>
1522520300
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hmm, as a note, this isn't actually API. This is sheets and sheetworkers. You're script looks fine to me. Do you have any other scripts in the sheet? How about translation files? Also, where is this error showing up?
1522520659
Pktome
Pro
Sheet Author
Scott C. said: Hmm, as a note, this isn't actually API. This is sheets and sheetworkers. You're script looks fine to me. Do you have any other scripts in the sheet? How about translation files? Also, where is this error showing up? Então, o problema é que se há esses sheetworkers na ficha, ao atualizar o API, ele dá esse erro. Se eu removo eles, atualizo o API e salvo a ficha com eles, funciona normal. So the problem is that if there are these sheetworkers in the plug, when updating the API, it gives this error. If I remove them, update the API and save the sheet with them, it works fine.
1522521512

Edited 1522521562
The Aaron
Pro
API Scripter
Probably something being passed to the callbacks is not what you think it is.  Try adding: <script type="text/worker"> // Calculate the total of Feat Points spent on("change:repeating_magias", function() { var pontosGastos = 0; getSectionIDs("repeating_magias", function(featsArray) { if( Array.isArray(featsArray) && featsArray.length > 0) { var names = _.map(featsArray, function(currentID) { return "repeating_magias_"+currentID+"_mg_pm2"; }); getAttrs(names,function(v){ if(Array.isArray(v)){ var sum = _.reduce(v,function(m,a){ return m+parseInt(a,10); },0); setAttrs({ "pdm": Math.floor(sum) }); } }); } }); }); </script>
1522524541
Pktome
Pro
Sheet Author
The Aaron said: Probably something being passed to the callbacks is not what you think it is.  Try adding: <script type="text/worker"> // Calculate the total of Feat Points spent on("change:repeating_magias", function() { var pontosGastos = 0; getSectionIDs("repeating_magias", function(featsArray) { if( Array.isArray(featsArray) && featsArray.length > 0) { var names = _.map(featsArray, function(currentID) { return "repeating_magias_"+currentID+"_mg_pm2"; }); getAttrs(names,function(v){ if(Array.isArray(v)){ var sum = _.reduce(v,function(m,a){ return m+parseInt(a,10); },0); setAttrs({ "pdm": Math.floor(sum) }); } }); } }); }); </script> [Português] Eu testei. E observei algumas coisas; 1) Ao colocar apenas este script, eu consigo salvar normalmente (API), mas ele não contabiliza os valores de dentro do Repeating [voltei como estava antes no primeiro exemplo]. 2) Ao colocar 2x desse script alterando os valores (para teste) dá o erro no API. Então coloquei todos scripts dentro de apenas um [script type="text/worker"></script] para testar e funcionou. Agora vem a dúvida, mudaram as configurações como o API se relaciona com a ficha? Antes isso não acontecia, inclusive minhas fichas tinham vários script type="text/worker" separados. Exemplo de como era e funcionava: <script type="text/worker" ABC </script> <script type="text/worker" ZXY(); </script> Agora como deve ser para funcionar: <script type="text/worker" ABC(); ZXY(); </script> Lembrando que o erro não é o script funcionar dentro da ficha, e sim o API não querer salvar dando o erro do primeiro post. === [Translate] I tested. And I observed some things; 1) By putting only this script, I can save it normally (API), but it does not count the values from within the Repeating [I came back as it was in the first example]. 2) Putting 2x of this script changing the sector (for testing) gives the error in the API. So I put all scripts inside just one script type = "text / worker"> </ script to test and it worked. Now comes the doubt, have changed the settings as the API relates to the sheet? Before this did not happen, even my sheets had several separate type = "text / worker" scripts. Example of how it was and how it worked: Script type = "text / worker" ABC(); </ Script> Script type = "text / worker" ZXY(); </ script> Now how it should work: Script type = "text / worker" ABC(); ZXY(); </ script> Remember that the error is not the script working inside the plug, but the API does not want to run giving the error of the first post.
I have the same problem, an i am using the ad&d sheet from seth. Does anyone have a solution for this?
1523209713
Pktome
Pro
Sheet Author
Karl-Martin P. said: I have the same problem, an i am using the ad&d sheet from seth. Does anyone have a solution for this? Verifique se os códigos "worker" estejam em uma mesma seção. <script type="text/worker"> Todos os códigos aqui </script> No meu caso, minha sheet possuía diversos setores. Então, coloquei todos códigos dentro de apenas uma seção. ==== Make sure that the "worker" codes are in the same section. <script type = "text / worker"> All codes here </ script> In my case, my sheet had several sectors. So, I put all codes within just one section.
Hi I should say thanks, but i work in waste disposal, and scripts aren't my strongest side. :) I don’t use custom sheet, but the standard for AD&D. Have tried too take a look at the scripts but as I mentioned I only work in waste disposal.
Error setting up custom sheet: TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object. Getting that message with every script I am putting in....or trying to. As with Karl I am using the same sheet......just trying to use the Bump API But can't figure where to put the "worker" code to get it to work. If I get that done....might be able to get the other ones, I would like to use...
1524421149

Edited 1524423868
GiGs
Pro
Sheet Author
API Scripter
Your custom sheet probably has more than one block like this <script type="text/worker"> a script </script> <script type="text/worker"> another script </script> What you need to do is remove all script blocks but one, and pit all your scripts inside it, so it looks like this <script type="text/worker"> a script another script all remaining scripts </script>
1524421317

Edited 1524421336
vÍnce
Pro
Sheet Author
I wonder if something changed on roll20.  I'm sure these sheet's(I think this is the 3rd report in the last few weeks) have included these multiple script entries for a while without the API errors...
1524423320
The Aaron
Pro
API Scripter
Interesting.  There are several sheets that have more than 1: AD&D 2E Revised/2ESheet.html:2 Black_Crusade/BlackCrusade.html:2 Blue Planet V2/Blue Planet V2 character sheet.html:25 HarnMaster3/harnsheet.html:8 Krystal (FR)/Krystal character sheet v1.html:82 L5R/L5Rsheet.htm:17 L5R Advanced/L5Rsheet.htm:17 L5R Fantasy Flight Games/L5RFFGSheet.html:30 Legacy - Life Among the Ruins/LegacyRoll20sheets.html:2 the vast majority (184) do not.
1524424048
GiGs
Pro
Sheet Author
API Scripter
yeah, i am sure that my first sheet had two script blocks about a year ago, and I didnt get the custom sheet error. I did notice that something about my scripts wasn't working properly, and got the idea from somwhere (cant remember where, it was a long time ago) that you should only have one script block so i put them together. I am not sure if that fixed the issue, honestly - it was a long time ago and I was still flailing around with javascript even more than i am now - but I think it might have. For whatever reason, it stuck in my memory to make sure you only have one script block.
1524424113

Edited 1524424133
GiGs
Pro
Sheet Author
API Scripter
Regarding that list Aaron: I have a pull request submitted which merges all the l5r sheet's multiple scripts into one. There have been a bunch of issues related to this in the last couple of weeks, maybe since that last update.
1524424271
The Aaron
Pro
API Scripter
I spoke with one of the devs briefly.  He indicated there might be a related change and he will look into it Monday.  He suggested making sure there is only one script block. Quasi-related, be sure you don't have a <body> or <html> element in your character sheets.
1524425121
Pktome
Pro
Sheet Author
[PTBR] Acho que o problema não é alterar, até porque o erro é bem simples. O porém, é que antes não dava problemas, então a partir de um momento começou a dar problemas. Mesmo assim, só para lembrar, meu problema foi resolvido colocando apenas 1 bloco de scripts. {Translate} I think the problem is not to change, because the error is very simple. However, it was that before it did not give problems, then from a moment began to give problems. Even so, just to remember, my problem was solved by putting only 1 block of scripts.
1524425431
GiGs
Pro
Sheet Author
API Scripter
The Aaron said: Interesting.  There are several sheets that have more than 1: AD&D 2E Revised/2ESheet.html:2 Black_Crusade/BlackCrusade.html:2 Blue Planet V2/Blue Planet V2 character sheet.html:25 HarnMaster3/harnsheet.html:8 Krystal (FR)/Krystal character sheet v1.html:82 L5R/L5Rsheet.htm:17 L5R Advanced/L5Rsheet.htm:17 L5R Fantasy Flight Games/L5RFFGSheet.html:30 Legacy - Life Among the Ruins/LegacyRoll20sheets.html:2 the vast majority (184) do not. Aaron, what's the number after the htm in the filenames here?
1524425712

Edited 1524426106
The Aaron
Pro
API Scripter
Number of lines with "text/worker" on them.  Could be some false positives if there were comments with "text/worker" in them, but probably not... AD&D 2E Revised/2ESheet.html 1:<script type="text/worker"> 12817:<script type="text/worker"> Black_Crusade/BlackCrusade.html 2:<script type="text/worker"> 3437:<script type="text/worker"> Blue Planet V2/Blue Planet V2 character sheet.html 182:                    <script type="text/worker"> 217:                    <script type="text/worker"> 273:                    <script type="text/worker"> 329:                    <script type="text/worker"> 370:                <script type="text/worker"> 393:                <script type="text/worker"> 416:                <script type="text/worker"> 439:                <script type="text/worker"> 462:                <script type="text/worker"> 485:                <script type="text/worker"> 508:                <script type="text/worker"> 531:                <script type="text/worker"> 554:                <script type="text/worker"> 577:                <script type="text/worker"> 600:                <script type="text/worker"> 623:                <script type="text/worker"> 646:                <script type="text/worker"> 683:                <script type="text/worker"> 695:                <script type="text/worker"> 716:                <script type="text/worker"> 728:                <script type="text/worker"> 749:                <script type="text/worker"> 761:                <script type="text/worker"> 782:                <script type="text/worker"> 794:                <script type="text/worker"> HarnMaster3/harnsheet.html 944:<script type="text/worker"> 968:<script type="text/worker"> 983:<script type="text/worker"> 999:<script type="text/worker"> 1018:<script type="text/worker"> 1032:<script type="text/worker"> 1054:<script type="text/worker"> 1077:<script type="text/worker"> Krystal (FR)/Krystal character sheet v1.html 255:                    <script type="text/worker"> 268:                    <script type="text/worker"> 288:                        <script type="text/worker"> 301:                        <script type="text/worker"> 321:                        <script type="text/worker"> 334:                        <script type="text/worker"> 354:                        <script type="text/worker"> 367:                        <script type="text/worker"> 386:                        <script type="text/worker"> 399:                        <script type="text/worker"> 418:                        <script type="text/worker"> 431:                        <script type="text/worker"> 451:                        <script type="text/worker"> 464:                        <script type="text/worker"> 484:                        <script type="text/worker"> 497:                        <script type="text/worker"> 517:                        <script type="text/worker"> 530:                        <script type="text/worker"> 549:                        <script type="text/worker"> 562:                        <script type="text/worker"> 581:                        <script type="text/worker"> 594:                        <script type="text/worker"> 613:                        <script type="text/worker"> 626:                        <script type="text/worker"> 645:                        <script type="text/worker"> 658:                        <script type="text/worker"> 677:                        <script type="text/worker"> 690:                        <script type="text/worker"> 709:                        <script type="text/worker"> 722:                        <script type="text/worker"> 741:                        <script type="text/worker"> 754:                        <script type="text/worker"> 774:                        <script type="text/worker"> 787:                        <script type="text/worker"> 807:                        <script type="text/worker"> 820:                        <script type="text/worker"> 840:                        <script type="text/worker"> 853:                        <script type="text/worker"> 872:                        <script type="text/worker"> 885:                        <script type="text/worker"> 905:                        <script type="text/worker"> 918:                        <script type="text/worker"> 938:                        <script type="text/worker"> 951:                        <script type="text/worker"> 971:                        <script type="text/worker"> 984:                        <script type="text/worker"> 1003:                        <script type="text/worker"> 1016:                        <script type="text/worker"> 1035:                        <script type="text/worker"> 1048:                        <script type="text/worker"> 1067:                        <script type="text/worker"> 1080:                        <script type="text/worker"> 1099:                        <script type="text/worker"> 1112:                        <script type="text/worker"> 1132:                        <script type="text/worker"> 1145:                        <script type="text/worker"> 1165:                        <script type="text/worker"> 1178:                        <script type="text/worker"> 1198:                        <script type="text/worker"> 1211:                        <script type="text/worker"> 1230:                        <script type="text/worker"> 1243:                        <script type="text/worker"> 1262:                        <script type="text/worker"> 1275:                        <script type="text/worker"> 1294:                        <script type="text/worker"> 1307:                        <script type="text/worker"> 1326:                        <script type="text/worker"> 1339:                        <script type="text/worker"> 1358:                        <script type="text/worker"> 1371:                        <script type="text/worker"> 1390:                        <script type="text/worker"> 1403:                        <script type="text/worker"> 1423:                        <script type="text/worker"> 1436:                        <script type="text/worker"> 1456:                        <script type="text/worker"> 1469:                        <script type="text/worker"> 1489:                        <script type="text/worker"> 1502:                        <script type="text/worker"> 1521:                        <script type="text/worker"> 1534:                        <script type="text/worker"> 1553:                        <script type="text/worker"> 1566:                        <script type="text/worker"> L5R/L5Rsheet.htm 2635: <script type="text/worker"> 2646: <script type="text/worker"> 2688: <script type="text/worker"> 2698: <script type="text/worker"> 2708: <script type="text/worker"> 2718: <script type="text/worker"> 2731: <script type="text/worker"> 2742: <script type="text/worker"> 2752: <script type="text/worker"> 2762: <script type="text/worker"> 2772: <script type="text/worker"> 2782: <script type="text/worker"> 2793: <script type="text/worker"> 2804: <script type="text/worker"> 2815: <script type="text/worker"> 2830: <script type="text/worker"> 2948:<script type="text/worker"> L5R Advanced/L5Rsheet.htm 2636: <script type="text/worker"> 2647: <script type="text/worker"> 2689: <script type="text/worker"> 2699: <script type="text/worker"> 2709: <script type="text/worker"> 2719: <script type="text/worker"> 2732: <script type="text/worker"> 2743: <script type="text/worker"> 2753: <script type="text/worker"> 2763: <script type="text/worker"> 2773: <script type="text/worker"> 2783: <script type="text/worker"> 2794: <script type="text/worker"> 2805: <script type="text/worker"> 2816: <script type="text/worker"> 2831: <script type="text/worker"> 2949:<script type="text/worker"> L5R Fantasy Flight Games/L5RFFGSheet.html 4491: <script type="text/worker"> 4503: <script type="text/worker"> 4514: <script type="text/worker"> 4526: <script type="text/worker"> 4537: <script type="text/worker"> 4549: <script type="text/worker"> 4561: <script type="text/worker"> 4572: <script type="text/worker"> 4583: <script type="text/worker"> 4689:<script type="text/worker"> 4817:<script type="text/worker"> 4851:<script type="text/worker"> 5030:<script type="text/worker"> 5064:<script type="text/worker"> 5191:<script type="text/worker"> 5225:<script type="text/worker"> 5378:<script type="text/worker"> 5412:<script type="text/worker"> 5565:<script type="text/worker"> 5599:<script type="text/worker"> 5752:<script type="text/worker"> 5786:<script type="text/worker"> 5914:<script type="text/worker"> 6072:<script type="text/worker"> 6275:<script type="text/worker"> 6403:<script type="text/worker"> 6438:<script type="text/worker"> 6566:<script type="text/worker"> 6726:<script type="text/worker"> 6794:<script type="text/worker"> Legacy - Life Among the Ruins/LegacyRoll20sheets.html 3493:<script type="text/worker"> 3504:<script type="text/worker">
1524426724
GiGs
Pro
Sheet Author
API Scripter
That makes sense. The L5R ones were pretty ridiculous. Every single script was in its own script block. Looks like that Krystal one takes it even further!
1524505536
The Aaron
Pro
API Scripter
Can I get an invite to a game that is experiencing this problem, and precise reproduction instructions?
You want an invite to mine...????
1524507660
The Aaron
Pro
API Scripter
Sure, just PM it over with instructions on how to get the error.