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 .
×

Custom Roll Parsing Limitations?

Is there a limitation on CRP related to what or how many characters can be returned in the expression? I seem to be having an issue pertaining to this. I saw no limitation in the documentation on the wiki, but figured I'd ask. These are all of the characters included in the expression which is 1438 characters long. It is an attribute made up of a single string of json with html entity substitutions. &\#;:[]-."[A-Za-z] Here is the code I am using. All other attributes work with it and the roll works fine outside of startRoll. The only issue I am finding is calling these json attributes using startRoll. The json attributes work fine for the rest of my character sheets. let jsonGet = await startRoll(`!{{query=[[0[@{sheetA|c_name}]]]}}`); finishRoll(jsonGet.rollId); console.log(jsonGet.results); console.log(jsonGet.results.query.expression); Original Post
1678590948

Edited 1678591023
GiGs
Pro
Sheet Author
API Scripter
You only need this syntax [[0[ if the attribute is expected to be a number. If you are calling a JSON attribute, I'd get rid of that. Also you only have one [ ] there, should you have any? Should it not be: {{query=[[@{sheetA|c_name}]]}} Also the rest of that code inside the startRoll brackets looks weird and suspect to me. startRoll should contain a valid rollstring, and I'm not sure that is one. Starting it with ! also looks weird. I'm not a CRP expert by any means, but those are questions that spring to mind. I am curious what youre doing there and why you have 1438 character JSONs. There might be a size limit - I've never tried using startRoll with any constructs that big.
! is used to cancel the roll from activating as I only need this to send the text to chat and retrieve the evaluated attribute. ` (backtick) is for creating a template literal which is needed since I'm not actually going to have c_name and will instead have a literal ex. ${attribute} to grab corresponding attributes to that input [[0[] is needed to act as a roll and return the attribute from that sheet as CRP will fail if a roll is not included you can try this out in one of your campaign's chat like so...  sheet=Creatures    name=Dragon    current=Shenron chat input: [[0[@{Creatures|Dragon}]]] chat output: [0]      title/hover = Shenron This is returned by CRP as an expression with the attribute data being grabbed from the other sheet which you can use a replace(pattern) on to extrapolate it from the {{query=[ This is a method that a handful of sheet editors use to pull one sheet's attributes into another using sheetworkers without CSA which was brought to my attention by Scott C. Like I said, it is working for me in all other situations (ex sheetA|attr1->sheetA|attr2 & sheetA|attr1->sheetB|attr1) except in the case of my json which the rest of my sheetworkers have no issues with the characters in. So my only assumption is that the expression or even the whole startRoll object has some sort of character limit, character conflict or something else. I'm really hoping it's the latter and something I can work around, otherwise I'm back to CSA and using hacky buttons (ex. press roll button then press action button) and preinitializing attributes which may even still fail if the sandbox xor CSA decides to crash in the middle of session.
Also for the other question I missed... I have 2 sheets with hundreds of json attributes acting as our custom compendium. I was having issues with CSA failing when trying to set new/ previously unused attributes and this was the solution presented to me. 
1678598087
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Crp can only return a value from an inline roll. So, you need to put them in the inline roll. However, that means that you need to probably escape things that would either be 1) evaluated by an inline roll or 2) would corrupt a roll. This probably isn't going to work with Json unfortunately.
1678599187

Edited 1678599444
GiGs
Pro
Sheet Author
API Scripter
I agree with Scott that I don't think this will work.I do know what the various bits you've described do, I just don't think they'll work the way you want them to in this context . But pardon my ignorance, what does CSA stand for in this context? Also, if you describe what your goal is, me and Scott might be able to tell you an alternative way to achive it - if you give enough information to work with. Or we might not - it's possible what you want just can't be done.
1678630337
Andreas J.
Forum Champion
Sheet Author
Translator
GiGs said: But pardon my ignorance, what does CSA stand for in this context? Might mean the ChatSetAttr script, based on this old thread , and that I made <a href="https://wiki.roll20.net/CSA" rel="nofollow">https://wiki.roll20.net/CSA</a> redirect to the script's page one year ago(but don't remember it :D )
Yes, CSA is chatSetAttr in this context. Scott C. said: Crp can only return a value from an inline roll. So, you need to put them in the inline roll. However, that means that you need to probably escape things that would either be 1) evaluated by an inline roll or 2) would corrupt a roll. This probably isn't going to work with Json unfortunately. This makes absolute sense, but if&nbsp; {{query=[[0[@{sheetA|c_name}]]]}} displays my json fine when put into chat directly, could that really be the case? I figured I had already ruled out my json interfering with anything but the startRoll itself. I am going to try a couple more tests. One with a large string of just [A-Za-z] and another with just a small string of the characters I have used. I don't believe this will solve my problem, but may be good to know information in the future. I will share my results here. Aside from that, I will probably just go back to CSA with sheetworkers presetting default values until I find a better solution. It is working well enough, and if we have the odd issue, I will be in campaign to fix it manually.
So, the culprit character was ]. Swapped all brackets for html entities and everything works fine. Evidently this only affects the roll if it is sent by startRoll.