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

&{noerror} seems to not be working?

1612784350

Edited 1612811648
Hey there. I've been looking up at these forums because I usually find answers without having to ask for them, but this time I'm stuck. So, I'm not sure how to explain... so I guess I'll try and show it to you guys So this is a character sheet in my game (Tormenta20's one, not self-made). As you can see it lists attacks as repeatable itens, and I managed to copy the roll command into a macro, so that I can use it on my tokens. I created a "generic" macro which I would be able to use with any characters. However, since it's a repeatable item, I pretty much had to copy-paste this macro some times (as you can see by the ones with similar names). So obviously it became a bit too much visual pollution on my token bar. I then added a macro that would put all of those together in a message with buttons for me to select but... well... Error messages and messed up buttons. I initially managed to fix at least the error messages with &{noerror} but then it suddenly just kinda stopped working. Am I using &{noerror} wrong? Is there anyway to really suppress these error messages? (and preferrably the unwanted buttons too, maybe make them become visible only when their macro detects a move in their slots?) I'm sorry if I wasn't clear, I haven't slept much lately. I'll try to clarify later if it's necessary.
1612805550

Edited 1612805572
Here's my code, for reference: &{template:spell}{{character=@{selected|character_name}}}{{spellname=Ataques}}{{description=[@{selected|repeating_attacks_$0_nomeataque}](!
 #Ataque-1)[@{selected|repeating_attacks_$1_nomeataque}](!
 #Ataque-2)[@{selected|repeating_attacks_$2_nomeataque}](!
 #Ataque-3)[@{selected|repeating_attacks_$3_nomeataque}](!
 #Ataque-4)[@{selected|repeating_attacks_$4_nomeataque}](!
 #Ataque-5)[@{selected|repeating_attacks_$5_nomeataque}](!
 #Ataque-6)[@{selected|repeating_attacks_$6_nomeataque}](!
 #Ataque-7)[@{selected|repeating_attacks_$7_nomeataque}](!
 #Ataque-8)[@{selected|repeating_attacks_$8_nomeataque}](!
 #Ataque-9)}}&{noerror} And here's the code from one of those many #Ataque macros: &{template:t20-attack}{{character=@{selected|character_name}}}{{attackname=@{selected|repeating_attacks_$0_nomeataque}}}{{attackroll=[[(1d20cs>@{selected|repeating_attacks_$0_margemcriticoataque})+@{selected|repeating_attacks_$0_bonusataque}+@{selected|repeating_attacks_$0_ataquepericia}]]}} {{damageroll=[[@{selected|repeating_attacks_$0_danoataque}+@{selected|repeating_attacks_$0_modatributodano}+@{selected|repeating_attacks_$0_danoextraataque}]]}} {{criticaldamageroll=[[(@{selected|repeating_attacks_$0_danocriticoataque})+@{selected|repeating_attacks_$0_modatributodano}+@{selected|repeating_attacks_$0_danoextraataque}]]}}{{typeofdamage=@{selected|repeating_attacks_$0_ataquetipodedano}}}{{description=@{selected|repeating_attacks_$0_ataquedescricao}}}
1612814369
GiGs
Pro
Sheet Author
API Scripter
You'll probably need to add the noerror statement to each of those macros too. But note that if you are sending button references repeating section items that dont exist, you'll get bad references like the last 2 buttons in your screenshot. There's no away around this for a free user. Its trying to get the display name for the button, but the attribute name for it doesnt exist on that character.
GiGs said: You'll probably need to add the noerror statement to each of those macros too. but the individual macros don't have any error-inducing stuff on them. Or do you mean I should add noerror to each line of the main macro? But note that if you are sending button references repeating section items that dont exist, you'll get bad references like the last 2 buttons in your screenshot. There's no away around this for a free user. Its trying to get the display name for the button, but the attribute name for it doesnt exist on that character. I thought so... but thanks for confirming
1612819542
GiGs
Pro
Sheet Author
API Scripter
Ulfberht said: GiGs said: You'll probably need to add the noerror statement to each of those macros too. but the individual macros don't have any error-inducing stuff on them. Or do you mean I should add noerror to each line of the main macro? I didnt look closely at the macro, and thought there might be an error in there. To your question: yes, if you have multiple lines in your main macro, you should add noerror to each line. But I only see one line there. An entire rolltemplat is normally considered a single line, and I assumed the linebreaks you have there were for formatting to the forum. If they are in the original macro, you should remove those line breaks so the entire template is a single line.
1612822196

Edited 1612822400
Oosh
Sheet Author
API Scripter
Ulfberht said: But note that if you are sending button references repeating section items that dont exist, you'll get bad references like the last 2 buttons in your screenshot. There's no away around this for a free user. Its trying to get the display name for the button, but the attribute name for it doesnt exist on that character. I thought so... but thanks for confirming There most certainly is a way to hide these. Using the spell5 repeating section as an example, since it's the only one I can see in your screenshot. I'm not sure what it's meant to be linking to, but anyway: [@{selected|repeating_spells5_$0_namespell}](`#macroName1" style="display:none; display:inline@{repeating_spells5_$0_namespell|max}) [@{selected|repeating_spells5_$1_namespell}](`#macroName2" style="display:none; display:inline@{repeating_spells5_$1_namespell|max}) [@{selected|repeating_spells5_$2_namespell}](`#macroName3" style="display:none; display:inline@{repeating_spells5_$2_namespell|max}) [@{selected|repeating_spells5_$3_namespell}](`#macroName4" style="display:none; display:inline@{repeating_spells5_$3_namespell|max}) [@{selected|repeating_spells5_$4_namespell}](`#macroName5" style="display:none; display:inline@{repeating_spells5_$4_namespell|max}) Test that on a character with a couple of entries in that repeating section and see how you go, obviously replace "macroNameX" with the actual macro name. edit - stupid trick here, it's the last example
1612824986

Edited 1612825273
GiGs said: Ulfberht said: GiGs said: You'll probably need to add the noerror statement to each of those macros too. but the individual macros don't have any error-inducing stuff on them. Or do you mean I should add noerror to each line of the main macro? I didnt look closely at the macro, and thought there might be an error in there. To your question: yes, if you have multiple lines in your main macro, you should add noerror to each line. But I only see one line there. An entire rolltemplat is normally considered a single line, and I assumed the linebreaks you have there were for formatting to the forum. If they are in the original macro, you should remove those line breaks so the entire template is a single line. Actually, I just realised something weird is happening: I put the codes as one line when I created the macro, but after I save it, close, and open again to check, it has line breaks and the "
"s are missing (but it still works normally). If I just try to erase the line breaks, the macro stops working. Oosh said: Ulfberht said: But note that if you are sending button references repeating section items that dont exist, you'll get bad references like the last 2 buttons in your screenshot. There's no away around this for a free user. Its trying to get the display name for the button, but the attribute name for it doesnt exist on that character. I thought so... but thanks for confirming There most certainly is a way to hide these. Using the spell5 repeating section as an example, since it's the only one I can see in your screenshot. I'm not sure what it's meant to be linking to, but anyway: [@{selected|repeating_spells5_$0_namespell}](`#macroName1" style="display:none; display:inline@{repeating_spells5_$0_namespell|max}) [@{selected|repeating_spells5_$1_namespell}](`#macroName2" style="display:none; display:inline@{repeating_spells5_$1_namespell|max}) [@{selected|repeating_spells5_$2_namespell}](`#macroName3" style="display:none; display:inline@{repeating_spells5_$2_namespell|max}) [@{selected|repeating_spells5_$3_namespell}](`#macroName4" style="display:none; display:inline@{repeating_spells5_$3_namespell|max}) [@{selected|repeating_spells5_$4_namespell}](`#macroName5" style="display:none; display:inline@{repeating_spells5_$4_namespell|max}) Test that on a character with a couple of entries in that repeating section and see how you go, obviously replace "macroNameX" with the actual macro name. edit - stupid trick here, it's the last example omg thank you so much. I'll read it carefully and try it out, then I'll post some feedback here Edit: I just realized there's a lot I don't understand in that link lol, I'm as good at HTML as a giraffe... but I'll try figuring it out from your example and whatever bits I can understand from the trick, I think I can do that much haha
Oosh said: Ulfberht said: But note that if you are sending button references repeating section items that dont exist, you'll get bad references like the last 2 buttons in your screenshot. There's no away around this for a free user. Its trying to get the display name for the button, but the attribute name for it doesnt exist on that character. I thought so... but thanks for confirming There most certainly is a way to hide these. Using the spell5 repeating section as an example, since it's the only one I can see in your screenshot. I'm not sure what it's meant to be linking to, but anyway: [@{selected|repeating_spells5_$0_namespell}](`#macroName1" style="display:none; display:inline@{repeating_spells5_$0_namespell|max}) [@{selected|repeating_spells5_$1_namespell}](`#macroName2" style="display:none; display:inline@{repeating_spells5_$1_namespell|max}) [@{selected|repeating_spells5_$2_namespell}](`#macroName3" style="display:none; display:inline@{repeating_spells5_$2_namespell|max}) [@{selected|repeating_spells5_$3_namespell}](`#macroName4" style="display:none; display:inline@{repeating_spells5_$3_namespell|max}) [@{selected|repeating_spells5_$4_namespell}](`#macroName5" style="display:none; display:inline@{repeating_spells5_$4_namespell|max}) Test that on a character with a couple of entries in that repeating section and see how you go, obviously replace "macroNameX" with the actual macro name. edit - stupid trick here, it's the last example So, I don't know what I did wrong, but it ended up just hiding everything - not just the ones it can't read. Here's how my code is to get the above: &{template:spell}{{character=@{selected|character_name}}}{{spellname=Ataques}}{{description=[@{selected|repeating_attacks_$0_nomeataque}](`#Ataque-1" style="display:none; display:inline@{repeating_attacks_$0_nomeataque|max})[@{selected|repeating_attacks_$1_nomeataque}](`#Ataque-2" style="display:none; display:inline@{repeating_attacks_$1_nomeataque|max})[@{selected|repeating_attacks_$2_nomeataque}](`#Ataque-3" style="display:none; display:inline@{repeating_attacks_$2_nomeataque|max})[@{selected|repeating_attacks_$3_nomeataque}](`#Ataque-4" style="display:none; display:inline@{repeating_attacks_$3_nomeataque|max})[@{selected|repeating_attacks_$4_nomeataque}](`#Ataque-5" style="display:none; display:inline@{repeating_attacks_$4_nomeataque|max})[@{selected|repeating_attacks_$5_nomeataque}](`#Ataque-6" style="display:none; display:inline@{repeating_attacks_$5_nomeataque|max})[@{selected|repeating_attacks_$6_nomeataque}](`#Ataque-7" style="display:none; display:inline@{repeating_attacks_$6_nomeataque|max})[@{selected|repeating_attacks_$7_nomeataque}](`#Ataque-8" style="display:none; display:inline@{repeating_attacks_$7_nomeataque|max})[@{selected|repeating_attacks_$8_nomeataque}](`#Ataque-9" style="display:none; display:inline@{repeating_attacks_$8_nomeataque|max})}}&{noerror}
1612831155
Oosh
Sheet Author
API Scripter
It's possible that the 'max' value of that attribute is actually not empty... the trick relies on using an Attribute that exists but is always an empty string. For valid rows, the empty string will result in the second display setting, display: inline , being parsed correctly. Anything else, or a non-existent Attribute, will result in display: inline<attribute value or error> , which isn't a valid HTML setting and will be ignored. What do you get if you just put " @{repeating_attacks_$0_nomeataque|max} " in chat? You might need to use a different Attribute from that row if it's not empty - basically the |max version of an Attribute which always exists for a valid row is the best place to look. Zeroes or anything else won't work - it needs to be totally unused.
What do you get if you just put " @{repeating_attacks_$0_nomeataque|max} " in chat? Oosh  said: It's possible that the 'max' value of that attribute is actually not empty... the trick relies on using an Attribute that exists but is always an empty string. For valid rows, the empty string will result in the second display setting,  display: inline  , being parsed correctly. Anything else, or a non-existent Attribute, will result in  display: inline<attribute value or error> , which isn't a valid HTML setting and will be ignored. What do you get if you just put " @{repeating_attacks_$0_nomeataque|max} " in chat? You might need to use a different Attribute from that row if it's not empty - basically the |max version of an Attribute which always exists for a valid row is the best place to look. Zeroes or anything else won't work - it needs to be totally unused. I... don't understand T_T sorry, pretend I'm 5 years old. I'll try to better explain what i'm doing, maybe that will help...here, this is a random character sheet from my campaign: The arrow is pointing to the repeating object I'm trying to make a button out of. The name of the button is the name of the attack. I'm assuming that's what you are calling an "attribute", but if I change it to any of the other fields of the attack, I'll just have a number on the name of the button, which contradicts the whole point... If I was to number it I wouldn't need all this code. Not sure if I understood what you meant and if I was clear at all, I'm really having a hard time explaining and keeping up with it all, I'm really a beginner at all this.
1612847975

Edited 1612848099
Oosh
Sheet Author
API Scripter
Ulfberht said: What do you get if you just put " @{repeating_attacks_$0_nomeataque|max} " in chat? Whoops! Sorry, what I mean was @{ selected |repeating_attacks_$0_nomeataque|max}. But that silly mistake made me check the code I posted before, and i made exactly the same stupid error - I left the 'selected' off the second Attribute reference. It should have been this: &{template:spell}{{character=@{selected|character_name}}}{{spellname=Ataques}}{{description= [@{selected|repeating_attacks_$0_nomeataque}](`#Ataque-1" style="display:none; display:inline@{selected|repeating_attacks_$0_nomeataque|max}) [@{selected|repeating_attacks_$1_nomeataque}](`#Ataque-2" style="display:none; display:inline@{selected|repeating_attacks_$1_nomeataque|max}) [@{selected|repeating_attacks_$2_nomeataque}](`#Ataque-3" style="display:none; display:inline@{selected|repeating_attacks_$2_nomeataque|max}) [@{selected|repeating_attacks_$3_nomeataque}](`#Ataque-4" style="display:none; display:inline@{selected|repeating_attacks_$3_nomeataque|max}) [@{selected|repeating_attacks_$4_nomeataque}](`#Ataque-5" style="display:none; display:inline@{selected|repeating_attacks_$4_nomeataque|max}) [@{selected|repeating_attacks_$5_nomeataque}](`#Ataque-6" style="display:none; display:inline@{selected|repeating_attacks_$5_nomeataque|max}) [@{selected|repeating_attacks_$6_nomeataque}](`#Ataque-7" style="display:none; display:inline@{selected|repeating_attacks_$6_nomeataque|max}) [@{selected|repeating_attacks_$7_nomeataque}](`#Ataque-8" style="display:none; display:inline@{selected|repeating_attacks_$7_nomeataque|max}) [@{selected|repeating_attacks_$8_nomeataque}](`#Ataque-9" style="display:none; display:inline@{selected|repeating_attacks_$8_nomeataque|max})}}&{noerror} Sorry about that! At least it explains why it wasn't working, you can ignore all the other stuff I said :)
1612850260

Edited 1612850352
Oosh said: Ulfberht said: What do you get if you just put " @{repeating_attacks_$0_nomeataque|max} " in chat? Whoops! Sorry, what I mean was @{ selected |repeating_attacks_$0_nomeataque|max}. But that silly mistake made me check the code I posted before, and i made exactly the same stupid error - I left the 'selected' off the second Attribute reference. It should have been this: &{template:spell}{{character=@{selected|character_name}}}{{spellname=Ataques}}{{description= [@{selected|repeating_attacks_$0_nomeataque}](`#Ataque-1" style="display:none; display:inline@{selected|repeating_attacks_$0_nomeataque|max}) [@{selected|repeating_attacks_$1_nomeataque}](`#Ataque-2" style="display:none; display:inline@{selected|repeating_attacks_$1_nomeataque|max}) [@{selected|repeating_attacks_$2_nomeataque}](`#Ataque-3" style="display:none; display:inline@{selected|repeating_attacks_$2_nomeataque|max}) [@{selected|repeating_attacks_$3_nomeataque}](`#Ataque-4" style="display:none; display:inline@{selected|repeating_attacks_$3_nomeataque|max}) [@{selected|repeating_attacks_$4_nomeataque}](`#Ataque-5" style="display:none; display:inline@{selected|repeating_attacks_$4_nomeataque|max}) [@{selected|repeating_attacks_$5_nomeataque}](`#Ataque-6" style="display:none; display:inline@{selected|repeating_attacks_$5_nomeataque|max}) [@{selected|repeating_attacks_$6_nomeataque}](`#Ataque-7" style="display:none; display:inline@{selected|repeating_attacks_$6_nomeataque|max}) [@{selected|repeating_attacks_$7_nomeataque}](`#Ataque-8" style="display:none; display:inline@{selected|repeating_attacks_$7_nomeataque|max}) [@{selected|repeating_attacks_$8_nomeataque}](`#Ataque-9" style="display:none; display:inline@{selected|repeating_attacks_$8_nomeataque|max})}}&{noerror} Sorry about that! At least it explains why it wasn't working, you can ignore all the other stuff I said :) Thank you very much!! It worked, and it's even better than expected because it kind of turned the buttons into simple links, which occupy less space and is actually nicer looking in my opinion :D However... the noerror still seems to not work! I literally just copied your code and pasted it, so it should work correctly right? Am I experiencing some kind of bug?
1612860596
Oosh
Sheet Author
API Scripter
Ah yeah, sometimes it'll do that. You can try putting it somewhere else in the macro, if that doesn't work then you can use a second macro to call the first one. So if "Macro1" is the one you've just written with all the attacks in it, "Macro2" would simply be: #Macro1 &{noerror} for a macro in the Collections bar, or %{characterName|Macro1} &{noerror} for a macro on a character sheet. I have no idea why this makes any difference, but it seems to. I've never really understood &{noerror}, it doesn't seem to work at all for @{target} macros. It worked, and it's even better than expected because it kind of turned the buttons into simple links, which occupy less space and is actually nicer looking in my opinion :D You can keep going with the style section if you want to - Roll20 will allow a small list of basic HTML style properties. So at the end of the ability button link, you can add simple things like color, border, font, background color (or background image if you want to get fancy).... [@{selected|repeating_attacks_$0_nomeataque}](`#Ataque-1" style="display:none; display: inline-block @{selected|repeating_attacks_$0_nomeataque|max} ; color:white; border: 2px solid white; border-radius:3px; padding:3px; background-color: #b5b5b3; font-weight: bold ) So the whole bold part, including the leading ; is an example. If you're using a background color or border, it also looks better as display: inline-block instead of display: inline - I've changed that in the above as well, as inline will give you some nasty effects if a border wraps over more than one line.
Oosh said: Ah yeah, sometimes it'll do that. You can try putting it somewhere else in the macro, if that doesn't work then you can use a second macro to call the first one. So if "Macro1" is the one you've just written with all the attacks in it, "Macro2" would simply be: #Macro1 &{noerror} for a macro in the Collections bar, or %{characterName|Macro1} &{noerror} for a macro on a character sheet. I have no idea why this makes any difference, but it seems to. I've never really understood &{noerror}, it doesn't seem to work at all for @{target} macros. It worked, and it's even better than expected because it kind of turned the buttons into simple links, which occupy less space and is actually nicer looking in my opinion :D You can keep going with the style section if you want to - Roll20 will allow a small list of basic HTML style properties. So at the end of the ability button link, you can add simple things like color, border, font, background color (or background image if you want to get fancy).... [@{selected|repeating_attacks_$0_nomeataque}](`#Ataque-1" style="display:none; display: inline-block @{selected|repeating_attacks_$0_nomeataque|max} ; color:white; border: 2px solid white; border-radius:3px; padding:3px; background-color: #b5b5b3; font-weight: bold ) So the whole bold part, including the leading ; is an example. If you're using a background color or border, it also looks better as display: inline-block instead of display: inline - I've changed that in the above as well, as inline will give you some nasty effects if a border wraps over more than one line. I can't thank you enough, it worked and it's all perfect now! I won't risk messing around with that design for now xD but I'll probably try it later on, after I get more used to macros and whatnot, thanks a lot for your tips!