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

Another crappy query in query

1623156071

Edited 1623156178
Matthew C
Pro
Sheet Author
Hey all, before you ask I did look into the nesting of queries and I know I need to use html escaping...but what the hell am I doing wrong? XD ?{Choose roll type | Defence, rolls defence with a result of /roll 1d10 + @{defence} + ?{Bonus Defence|} | Resistance, rolls resistance with a result of /roll 1d10 + @{resistance} + ?{Bonus Resistance|}} This does not work ?{Choose roll type | Defence, rolls defence with a result of /roll 1d10 + @{defence} + ?{Bonus Defence|} | Resistance, rolls resistance with a result of /roll 1d10 + @{resistance} + ?{Bonus Resistance|}} This also doesn't work I do know it is the first part of the query, since if I choose the second part (which should be Resistance, blablabla it does give me the correct bonus resistance query (I have also tried using inline rolling [[]] instead of /roll but nothing seems to work so I think I am overlooking something super super simple
1623156743

Edited 1623156816
GiGs
Pro
Sheet Author
API Scripter
The second one wont work, but I dont see anything wrong with the first (apart from the fact /roll commands only work if they are the start of a line). Try thi: ?{Choose roll type | Defence, rolls defence with a result of [[1d10 + @{defence} + ?{Bonus Defence|0}]] | Resistance, rolls resistance with a result of [[1d10 + @{resistance} + ?{Bonus Resistance|0}]]} And if it doesnt work, check your @{defence} attribute - make sure it's spelled correctly (should it be @{defense} ?), and that the value in the attribute is a number. I tested by using a number in place of the @{defence} attribute, and it worked fine.
1623216318

Edited 1623219483
Matthew C
Pro
Sheet Author
GiGs said: The second one wont work, but I dont see anything wrong with the first (apart from the fact /roll commands only work if they are the start of a line). Try thi: ?{Choose roll type | Defence, rolls defence with a result of [[1d10 + @{defence} + ?{Bonus Defence|0}]] | Resistance, rolls resistance with a result of [[1d10 + @{resistance} + ?{Bonus Resistance|0}]]} And if it doesnt work, check your @{defence} attribute - make sure it's spelled correctly (should it be @{defense} ?), and that the value in the attribute is a number. I tested by using a number in place of the @{defence} attribute, and it worked fine. This is how it looks and if I choose Defence I get this: Here is everything: <button type='roll' class="sheet-button sheet-passiveButton" value=" ?{Choose roll type | Defence, rolls defence with a result of [[1d10 + @{defence} + ?{Bonus Defence|0}]] | Resistance, rolls resistance with a result of [[1d10 + @{resistance} + ?{Bonus Resistance|0}]]}" name='roll_DefenceResistance2' /> <h4>Defence: </h4> <input type="number" style="width:20px" class="sheet-hidden sheet-centered" name="attr_defence" value="0"></input> <h4>Resistance: </h4> <input type="number" style="width:20px" class="sheet-hidden sheet-centered" name="attr_resistance" value="0"></input> I appreciate the time you are taking for me, as far as I can tell this should be working, so I am worried I am doing something stupid XD Edit: FFS, this works: <button type="roll" class="sheet-button sheet-passiveButton" value="?{Choose roll type | Defence, rolls defence with a result of [[1d10 + @{defence} + ?{Bonus Defence&amp#124;0&amp#125;]] | Resistance, rolls resistance with a resistance of [[1d10 + @{resistance} + ?{Bonus Resistance&amp#124;0&amp#125;]]}" name="roll_defenceResistance"/> why do I need to add the &amp rather than just &...but luckily I saw this tip somewhere, does this maybe have something to do with the way the new sandbox handles uploads?
1623219409
GiGs
Pro
Sheet Author
API Scripter
I see a problem in the code that might be causing it. Button is not a self-terminating tag - you cant end it with /> , you need to end it with ></button> and inputs are self-terminative tages, you should delete those </input> 's
1623220265

Edited 1623220468
Matthew C
Pro
Sheet Author
GiGs said: I see a problem in the code that might be causing it. Button is not a self-terminating tag - you cant end it with /> , you need to end it with ></button> and inputs are self-terminative tages, you should delete those </input> 's Thanks, not an expert with html so the self-terminating is kind of new :p but even if I close the button correctly it still wont work, but using &amp instead of & seems to fix it, found it here   I do notice that if I use & and inspect the code in the browser it shows the actual symbol, but if I use &amp it shows the } instead... So I think this may be an issue with uploading the html file to the roll20 sandbox rather than adding it to the normal character sheet page
1623220621
GiGs
Pro
Sheet Author
API Scripter
After some testing, thats not the problem. It's the nesting level of the query. It looks like the character sheet parses the code one extra time, so you need to include & in each html entity. You almost did it, but left out the ; after each amp. So your code should be: <button type='roll' class="sheet-button sheet-passiveButton" value="?{Choose roll type |   Defence, rolls defence with a result of [[1d10 + @{defence} +?{Bonus}]] |   Resistance, rolls resistance with a result of [[1d10 + @{resistance} + ?{Bonus}]]}"   name='roll_DefenceResistance2' ></button> <h4>Defence: </h4> <input type="number" style="width:20px" class="sheet-hidden sheet-centered" name="attr_defence" value="0"> <h4>Resistance: </h4> <input type="number" style="width:20px" class="sheet-hidden sheet-centered" name="attr_resistance" value="0">
1623220681

Edited 1623220752
GiGs
Pro
Sheet Author
API Scripter
I didnt see your reply before posting mine - note the correct & syntax I dont know if this is a sandbox issue - I think the same thing will apply to sheets uploaded to the githib. I think its the way the character sheet code parses the character sheets.
1623222114
Matthew C
Pro
Sheet Author
GiGs said: I didnt see your reply before posting mine - note the correct & syntax I dont know if this is a sandbox issue - I think the same thing will apply to sheets uploaded to the githib. I think its the way the character sheet code parses the character sheets. Either way, thanks a lot for all the help, these nested things are annoying XD