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

Possible bug in Melee Weapon table of ADnD 2E Character sheet

Sorry that I've posted this bug in several places - I'm quite frustrated by it! I and a group I play with are "Old Fogies" and love playing 2E - we're too old to learn the new tricks of 5E...  The 2E sheet is great for us!  Well done and thank you for creating & maintaining it. However, I have found a bug (?) in the creation of the melee weapons table on the sheet.  One macro library I have created is for DMs to generate character sheets with the appropriate sized repeating tables for the creature they are creating - I found that having one, fully expanded character sheet with all tables expanded to fit any eventuality was very resource hungry, so this library is necessary to support DMs in creating the appropriate character sheets easily. I use the ChatSetAttr API Script in the macros to create the lines in the tables.  Using this line below 2 times should add two rows at index $0 and $1 to the melee weapons table: !setattr --charid @{selected|character_id} --repeating_weapons_-CREATE_weaponname|Melee weapon name The entry at index $0 is created fine.  However the next time this is called, the index at $1 does not seem to be created.  @{selected|repeating_weapons_$1_weaponname} returns empty string.  So does @{selected|repeating_weapons_$2_weaponname}.  However, @{selected|repeating_weapons_$3_weaponname} returns Melee weapon name !  If I carry on adding lines, indexes are created in what appear to be groups of 3 at ever higher indexes.  The sheet appears normal when opened, but using !setattr --charid @{selected|character_id} --repeating_weapons_$1_weaponname|New weapon name sets row $3 to be New weapon name, and trying to access for instance $3 in the above example using: !setattr --charid @{selected|character_id} --repeating_weapons_$3_weaponname|New weapon name causes an error as the CharSetAttr API Script does not think row $3 exists.  There are not 5 rows visible on the character sheet when I open it, so I agree with ChatSetAttr that something is odd here. The only way around it I have found is to manually use the [Modify] button on the table, and drag the last row to before the second row, then click [Done].  This seems to fix the issue, and $0 & $1 indexes then perform as expected, and $3 no longer exists. Has anyone else come across this bug?  Is anyone able to fix it?  Sorry, but I'm not that good at programming in HTML or Java to fix the sheet myself.
1605398306

Edited 1605398384
Gold
Forum Champion
Several places, haha! I saw your same question on the TestADND2e character sheet game. This copy is in the Character Sheets sub-forum. If you haven't, I highly recommend that this question belongs in API sub-forum of Roll20. It's probably an API question about CharSetAttr and Repeating Fields. The fact it's 2e and we are old-fogeys isn't even particularly germane to the specific question. Sure, smaller chance this might involve some bug on the Weapons section repeating field of that character sheet, but I suspect this has more to do with CharSetAttr and how to command it for repeating fields. Someone like The Aaron, Vince, GiGs, or others who understand API scripts and repeating fields, should be able to help with this.
1605435124

Edited 1605435173
Richard @ Damery
Pro
API Scripter
Gold said: Several places, haha! I saw your same question on the TestADND2e character sheet game. This copy is in the Character Sheets sub-forum. If you haven't, I highly recommend that this question belongs in API sub-forum of Roll20. It's probably an API question about CharSetAttr and Repeating Fields. The fact it's 2e and we are old-fogeys isn't even particularly germane to the specific question. Sure, smaller chance this might involve some bug on the Weapons section repeating field of that character sheet, but I suspect this has more to do with CharSetAttr and how to command it for repeating fields. Someone like The Aaron, Vince, GiGs, or others who understand API scripts and repeating fields, should be able to help with thi Thanks, Gold.  The steer is appreciated (on both the extraneous info and the advice on posting to API Forum :) ). Our group is actually called "The Old Fogies", and I was not sure if 2e was part of the issue so that's why I mentioned it. I've done some more investigation: using the [Add] button on the character sheet to manually add rows seems to work OK, if you add 3 rows (the base row with field name "weaponname", and two more at index $0 & $1) using @{selected|repeating_weapons_$1_weaponname} returns what is expected.  However , @{selected|repeating_weapons_$2_weaponname} I would expect to return the error "You tried to use the repeating section row at index 2 for repeating_weapons, but there doesn't seem to be a row at that index." but it does not - it returns empty string .  So does $3.  Only $4 then returns the error.  This might relate to the "groups of 3" I refer to. You may well be right that ChatSetAttr API Script has an issue too, but it could be that the fact that $2 & $3 do not return errors when just using Roll20 functions might have something to do with it.  I'll copy my report there, too, with this added information and see what response I get.
1605504127
Gold
Forum Champion
You're waaaay ahead of me, on programming-speak. I recognize what you're talking about, but I wouldn't be able to figure that out myself. Hopefully one of the API and Character Sheet expert community members see this question and help get to the bottom of it.
1605784938

Edited 1605784989
Richard @ Damery
Pro
API Scripter
Further update on this bug - and it is definitely a bug that is causing me major grief, if anyone is reading this... The same issue as with the melee weapons table above (repeating_weapons_$n_weaponname) is seen on the first column of spell book, (repeating_spells_$n_spellname), but not on any other table including the other columns of the spellbook (repeating_spells2_$n_spellname2, repeating_spells3_$n_spellname3, ...) or any of the weapon-damage, ammo, weaponprof, prof, potion or other repeating row tables. Is this an API bug with ChatSetAttr, or with the ADnD 2E character sheet?  I've not tried other character sheet formats as I am not familiar with them.  I have posted the same bug to the API forum, and I'd love to know where the bug is and have a fix or a macro-based work-around (I know the manual one, but the other DMs I support are not so system-savvy as I am... which is why I'm programming this macro library). Please help!
1605786720

Edited 1605786957
Andreas J.
Forum Champion
Sheet Author
Translator
Richard @ Damery said: Is this an API bug with ChatSetAttr, or with the ADnD 2E character sheet?  I've not tried other character sheet formats as I am not familiar with them. That's what what were asking you about. Did this bug only occur in one specific repeating section of the AD&D2E sheet, or does it happen with ever repeating sections on the sheet? If I'm reading your last comment right, this bug happens with weapons and spells, but not other repeating sections. If it occurs on every sections of the sheet, then please try use ChatSetAttr with any other sheet in a similar manner, and see if this repeats. As other's said, it feels unlikely that the bug is on the 2E sheet(as in it somehow managing to mess up entries in some fundamental way), or to be a bug restricted to ChatSetAttr while using the 2E sheet, but we don't know, as non of us have tried to replicate your issue. You can do this troubleshooting step yourself, and then report back with the results, after which we'll have a better idea what we're looking at. Edit: On second thought, there is a chance the 2E sheet have some sheetworkers that triggers when you create the new row with ChatSetAttr, and somehow create extra rows. Are these empty rows visible in the repeating section?
Looking at the code for ChatSetAttr v1.10 on Github, the code at line 398 & 399 is probably where the issue occurs.  My limited programming knowledge seems to indicate it sets the  finalId  for the to-be-created repeating row to be the length of the array of existing rowIds -1.  However, from experimentation I know that after the first repeating row is created for the weapons table, 2 "ghost" rows are created (see the final paragraph in the initial post) that don't appear on the character sheet, so the highest index is $2 when it should be $0, so this will create the "every 3 rows" gaps I am seeing.  This happens if you use the [Add+] button on the character sheet to add the rows, and not !setAttr, so that would indicate to me that it is a character sheet issue! Regards trying other character sheets, sorry but the only others I have are for 5e, and the attributes of those are totally obscured and I don't know what repeating tables or otherwise they use.
1605788621

Edited 1605789534
Richard @ Damery
Pro
API Scripter
ᐰndreas J. said: Richard @ Damery said: Is this an API bug with ChatSetAttr, or with the ADnD 2E character sheet?  I've not tried other character sheet formats as I am not familiar with them. That's what what were asking you about. Did this bug only occur in one specific repeating section of the AD&D2E sheet, or does it happen with ever repeating sections on the sheet? If I'm reading your last comment right, this bug happens with weapons and spells, but not other repeating sections. If it occurs on every sections of the sheet, then please try use ChatSetAttr with any other sheet in a similar manner, and see if this repeats. As other's said, it feels unlikely that the bug is on the 2E sheet(as in it somehow managing to mess up entries in some fundamental way), or to be a bug restricted to ChatSetAttr while using the 2E sheet, but we don't know, as non of us have tried to replicate your issue. You can do this troubleshooting step yourself, and then report back with the results, after which we'll have a better idea what we're looking at. Edit: On second thought, there is a chance the 2E sheet have some sheetworkers that triggers when you create the new row with ChatSetAttr, and somehow create extra rows. Are these empty rows visible in the repeating section? On the Edit, the extra "ghost" rows are present (see the bottom of the original post) - if just have $0 row present, both $1 & $2 are also created but do not appear.  Thus I think this is a character sheet issue. Edit:  just set ChatSetAttr triggering sheet workers to off, and no joy - still the same - two "ghost" rows are created at $1 & $2 when row $0 is added (via ChatSetAttr or using the [Add+] button on the character sheet) so that the next row created by ChatSetAttr is at $3 (when looked for by @{selected|repeating_weapons_$n_weaponname}) but ChatSetAttr thinks it is $1 (i.e. !setattr --sel --repeating_weapons_$1_weaponname|new-weapon-name works, but sets the weapon name for $3 when queried using @{selected|repeating_weapons_$3_weaponname}, @{selected|repeating_weapons_$1_weaponname} returns empty string , and the new-weapon-name  does not appear in the table.  !setattr --sel --repeating_weapons_$3_weaponname|new-weapon-name  returns an error. I think this is definately a character sheet bug.
1605790281
Andreas J.
Forum Champion
Sheet Author
Translator
Richard @ Damery said: Looking at the code for ChatSetAttr v1.10 on Github, the code at line 398 & 399 is probably where the issue occurs.  My limited programming knowledge seems to indicate it sets the  finalId  for the to-be-created repeating row to be the length of the array of existing rowIds -1.  However, from experimentation I know that after the first repeating row is created for the weapons table, 2 "ghost" rows are created (see the final paragraph in the initial post) that don't appear on the character sheet, so the highest index is $2 when it should be $0, so this will create the "every 3 rows" gaps I am seeing.  This happens if you use the [Add+] button on the character sheet to add the rows, and not !setAttr, so that would indicate to me that it is a character sheet issue! You mean, this bug happens both with using the add button, as well as when you're creating the with SettAttr? If this is true, then this bug have likely nothing to do with ChatSetAttr, and is self-contained in the sheet. Does this bug happen on every repeating section of the sheet, or have you at least one repeating section you've confirmed that the bug does not exist on? If we can confirm at least on non-bugged rep section, then the code related to the normal & the bugged rep sections could be compared, to see if the html or the sheetworkers contains some bugs that creates these ghost entries. On the Edit, the extra "ghost" rows are present (see the bottom of the original post) - if just have $0 row present, both $1 & $2 are also created but do not appear.  Thus I think this is a character sheet issue. This didn't really clarify things. Are the extra/ghost rows visible on the character sheet's repeating section, or are they only detectable through ChatSetAttr? And if they are visible, have you tired removing the ghost rows before trying to add new rows? It's possible this only occurs with the first entry, as long as there aren't extra rows around when more rows are made.
Andreas J., the info you seek is in the posts I made, but perhaps buried and not clear enough... However, I think it might be a timing thing, perhaps associated with clean-up in the sheet- workers?  If I wait 20 seconds between each row creation using !setattr, it all seems to work fine.  Either that or, while I've been posting these error reports, someone has fixed the sheet! Whatever, I will try to use !delay to force a time space between calls to !setattr to allow the sheet-workers or whatever time to wrap-up.  I'll see if that works.
1605800149
Andreas J.
Forum Champion
Sheet Author
Translator
Richard @ Damery said: However, I think it might be a timing thing, perhaps associated with clean-up in the sheet- workers? If I wait 20 seconds between each row creation using !setattr, it all seems to work fine. Interesting. But you're right, the issue seems to be with the sheet, ChatSetAttr was just a red herring in the end. Give a short summary of your conclusions in the thread that exists in the test game so the sheet author understands what you've found, so that he can look into it. Clearly state which repeating sections you found had the bug, and mention sections you're sure&nbsp; didn't have it. Either that or, while I've been posting these error reports, someone has fixed the sheet! Nope, there is no update on the public sheet recently: <a href="https://github.com/Roll20/roll20-character-sheets/pulls" rel="nofollow">https://github.com/Roll20/roll20-character-sheets/pulls</a> Anyway, good that it got more or less figured out, now either the sheet author looks into the character sheet, or you can take a look at the sheet's sourcecode yourself. You'll have to ask him to show the latest version bc it seems on roll20's github the sheet was last edited in 2018, which doesn't sound quite right.
1605857431
Gold
Forum Champion
ᐰndreas J. said: Nope, there is no update on the public sheet recently: <a href="https://github.com/Roll20/roll20-character-sheets/pulls" rel="nofollow">https://github.com/Roll20/roll20-character-sheets/pulls</a> Anyway, good that it got more or less figured out, now either the sheet author looks into the character sheet, or you can take a look at the sheet's sourcecode yourself. You'll have to ask him to show the latest version bc it seems on roll20's github the sheet was last edited in 2018, which doesn't sound quite right. Thanks for helping here. Great work. Is this the 2E (Simple Sheet), or the red-and-tan colored AD&amp;D 2e sheet? Aqua Alex edits the first, Peter B edits the later. I have a line of communication to either of them through roll20 2nd edition group on Discord, or their roll20 profiles, or their existing Character Sheets forum threads on here taking feedback. Richard Let me know if you need any help with contacting them. They're pretty easy to find, and are active around the VTT.
It's the more complex AD&amp;D 2e sheet. The easiest way to contact Peter B. is via the AD&amp;D 2E character sheet thread at&nbsp; <a href="https://app.roll20.net/forum/post/9311682/official-ad-and-d-2e-revised-update-thread" rel="nofollow">https://app.roll20.net/forum/post/9311682/official-ad-and-d-2e-revised-update-thread</a> .&nbsp; I've not posted there yet, but actually I'm now in contact with Jakob, the ChatSetAttr author, and I'm investigating that route first, as through testing I now think he is the best route to provide further insight, as he can see what ChatSetAttr is doing.
1605898298
Gold
Forum Champion
Good work Richard! Peter B is known to be responsive also. Hope you are able to resolve this fully with their help.
1605981024
Peter B.
Pro
Sheet Author
Richard @ Damery said: It's the more complex AD&amp;D 2e sheet. The easiest way to contact Peter B. is via the AD&amp;D 2E character sheet thread at&nbsp; <a href="https://app.roll20.net/forum/post/9311682/official-ad-and-d-2e-revised-update-thread" rel="nofollow">https://app.roll20.net/forum/post/9311682/official-ad-and-d-2e-revised-update-thread</a> .&nbsp; I've not posted there yet, but actually I'm now in contact with Jakob, the ChatSetAttr author, and I'm investigating that route first, as through testing I now think he is the best route to provide further insight, as he can see what ChatSetAttr is doing. Hello Richard Glad to hear that someone is helping you investigate the ChatSetAttr API. I will be honest with you and say that I will have a very hard time to investigate your issue, as I am not a Plus or Pro member myself, so I do not have access to the API and all the endpoints there. So I cannot test this myself. I will need very specific step by step guides with screen shots in order to have any chance of finding the error. Generally I have no experience with API Scripting and only very little with Macros. That being said, I have had other users report problems when using macros on the sheet. On of the issues can be that the sheet does not conform to minimum requirements for a sheet when it comes to repeating sections. Specifically the problem is that many repeating sections' attributes share names with static attributes. Ie. There is both a&nbsp; static attribute &nbsp;and a repeating attribute&nbsp; called 'weaponname'. When using the buttons on the sheet it does not pose any problems. But when using macros to either access the attributes or roll the buttons it create problems. This could be one of the reasons why you are having problems with weapons, and the first spell column, but not the other spell columns. &nbsp;All of this is just a guess, as I have no idea how far reaching this error is.
1605984766

Edited 1605984837
Andreas J.
Forum Champion
Sheet Author
Translator
Richard have spread out his comments on so many thread is hard to keep track of all the conversations, but I think Jacob made the best summary of the situation, which I'm paraphrasing here from memory: Richard claims to have duplicated the bug by simply adding new entries to the rep section by using the [+Add] button, so the API isn't really relevant Jacob suspects the sheet's sheetworkers are potentially so slow/ineffective, that the bug is triggered when the too fast API creates new entries, and sometimes when you add new entries manually. Peter B. said: Specifically the problem is that many repeating sections' attributes share names with static attributes. Ie. There is both a&nbsp; static attribute &nbsp;and a repeating attribute&nbsp; called 'weaponname'. When using the buttons on the sheet it does not pose any problems. But when using macros to either access the attributes or roll the buttons it create problems. This could be one of the reasons why you are having problems with weapons, and the first spell column, but not the other spell columns. &nbsp;All of this is just a guess, as I have no idea how far reaching this error is. This is an interesting observation.
FYI, I am now restricting current updates to this bug to the Thread in the API Forum.&nbsp; See&nbsp; <a href="https://app.roll20.net/forum/permalink/9512915/" rel="nofollow">https://app.roll20.net/forum/permalink/9512915/</a> &nbsp;for the latest in that thread.&nbsp; I'll not be posting here or anywhere else while ChatSetAttr is investigated.&nbsp; If I need to come back, I'll post a new thread. Richard claims to have duplicated the bug by simply adding new entries to the rep section by using the [+Add] button, so the API isn't really relevant Recently (in the last 5 days) I have retried to create the issue with the [Add+] button, and it seems to have gone away.&nbsp; I definitely&nbsp;know it used to be there, as I've corrected many of my Character Sheets (using the modify &amp; drag manual solution that fixes the indexing) over the last 6 months of gaming.&nbsp; So perhaps some recent change has solved that one? Specifically the problem is that many repeating sections' attributes share names with static attributes. Ie. There is both a&nbsp; static attribute &nbsp;and a&nbsp; repeating attribute&nbsp; called 'weaponname'. When using the buttons on the sheet it does not pose any problems. But when using macros to either access the attributes or roll the buttons it create problems. This could be one of the reasons why you are having problems with weapons, and the first spell column, but not the other spell columns. All my macros take the variation in names into account.&nbsp; I have needed quite complex redirecting and indirecting macros in order to do this, but it all works.&nbsp; If the duplication causes issues with ChatSetAttr or inside the Sheet itself, then those areas need fixing - however, if you change the sheet very much including removing the current naming conventions, I'll have a lot of recoding to do! I have again found an automated macro fix to deal with the problems with the Melee Weapons table and the 1st column of spells - essentially, I have to have API buttons that create 1 line at a time in these tables by themselves, and don't do anything else which seems to avoind creating the "ghost" lines.&nbsp; It means more complex macro programming (again) but it is now reliable and stable, and my suite of macros to allow non-savvy DMs to use API button menus create bespoke ADnD2e character sheets with varying sized repeating tables and the appropriate Ability macros &amp; Attributes to populate &amp; access them is well on the way to completion.&nbsp; So while the bug fix would be sensible, it is no longer as frustrating for me as it was.