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

Nested inlining

I'm DM a cool game called Hc Svnt Dracones. I have a roll that has four token specific variables, and one query. Why? HSD is awesome, I like playing it, and the game is just that flexable. :P Logically it looks like this: (Variable1 + Variable2)dVariable3 + Variable4 > (8 + Query1) The actual roll command looks like this: /roll [[@{selected|Body:Acuity}+@{selected|RC RoF}]]d@{selected|Mind Dice}s+@{selected|Ranged Combat}>[[8+?{cover|0}]] If I attempt to use that roll in a emote by nesting inline functions like so: /me @{selected|token_name} fires at @{target|Target|token_name} [[[[@{selected|Body:Acuity}+@{selected|RC RoF}]]d@{selected|Mind Dice}s+@{selected|Ranged Combat}>[[8+?{cover|0}]]]] Nothing happens, and the target GUI stays open. Roll20 just silently errors. Is this a built in limitation, or another issue of stretching roll20 beyond it's macro design limits? (No offense, the macro system is awesome; However, there's a limit to how flexible it know how to be.)
I'm not an expert, and someone who knows better may chime in, but it looks like the problem is the right side of the inequality. You can't have an equation on the right side, it has to be a static number.
1423460062
The Aaron
Pro
API Scripter
You can't nest inline rolls. In both cases above though, you should just be able to use parenthisis (sorry, on my phone): [[ ( @{A} + @{B} )d@{C} > ( 8 + @{D} ) ]]
Gozer the Gozerian said: I'm not an expert, and someone who knows better may chime in, but it looks like the problem is the right side of the inequality. You can't have an equation on the right side, it has to be a static number. That's what the in lining in the /roll command does though. Before it does anything it resolves the ">[[8+?{cover|0}]]" to whatever number was entered actually totals. Then it process the ">" (count number of successes) part with whatever got in lined. The Aaron said: You can't nest inline rolls. In both cases above though, you should just be able to use parenthisis (sorry, on my phone): [[ ( @{A} + @{B} )d@{C} > ( 8 + @{D} ) ]] Hm. I must have botched the order of operations before. However, Putting the 8+@{D} in parenthesis has it silently ignored. The two commands below are functionally identical, and gives no errors to explain why. /roll ( @{A} + @{B} )d@{C} > ( 8 + @{D} ) /roll ( @{A} + @{B} )d@{C}
1423487162
Lithl
Pro
Sheet Author
API Scripter
Stephen W. said: Gozer the Gozerian said: I'm not an expert, and someone who knows better may chime in, but it looks like the problem is the right side of the inequality. You can't have an equation on the right side, it has to be a static number. That's what the in lining in the /roll command does though. Before it does anything it resolves the ">[[8+?{cover|0}]]" to whatever number was entered actually totals. Then it process the ">" (count number of successes) part with whatever got in lined. Have you tried simply massaging your equation a bit? A > 8 + B is the same thing as A - 8 > B.
1423520170

Edited 1423627877
Something like "/roll {((1+1)d10)-2}>8" would appear to work. Thank you Gozer, Aron, and Brain. Just don't ask me why the brackets -{ }- are required and the the parenthesis -( )- do not work. I don't know, and can find do no documentation on what the brackets actually do. I only know through trail and error that's the only syntax Roll20 does what I want it to do. I can only guess that's one more thing I may need to file a bug report on.
1423533676
Lithl
Pro
Sheet Author
API Scripter
Brackets form a roll group, parentheses modify order of operations for math expressions.
1423560131
Ziechael
Forum Champion
Sheet Author
API Scripter
Brian said: Brackets form a roll group, parentheses modify order of operations for math expressions. Now that is really useful to know... thanks Brian :)
1423627808

Edited 1423627906
Hm. Indeed good to know. I can not think of a configuration where the semantics would functional different, but good to know. Thank you again sir.
1423635047
Lithl
Pro
Sheet Author
API Scripter
Stephen W. said: Hm. Indeed good to know. I can not think of a configuration where the semantics would functional different, but good to know. Thank you again sir. Well, despite what it looks like "A > B" is not a math expression. So that's one case where the semantics matter. =) > is either a roll modifier or a group modifier (depending on whether it comes after a roll or a roll group).
1423681781

Edited 1423681815
Sorry, I'm being a little catty I guess. (I wasn't aware Roll20 let you use logic operators like greater or less then in macros) It's more of a idle wonder then actual question. So ... only read on in case you care. ;) I meant I can't think of there there should be a logical difference between: (4d6+2d8, 3d2+3, 5f10+1)>40 (4d6,3d8)kh1 (2d6!)>4 ?(Number of Dice|1)d20 -OR- {4d6+2d8, 3d2+3, 5f10+1}>40 {4d6,3d8}kh1 {2d6!}>4 ?{Number of Dice|1}d20 I mean I can't work out why the text parsing code cares if '{}' or '()' was used other then the fact it just decided that it does. Even if they do slightly different things, their applications and semantics -the ideas behind them- are identical as far as I know. I mean to say I'm not sure why Roll20 cares or doesn't treat them as interchangeable. Being a obsessive about efficiency and C/C++ programmer I know it would take more time bit more run time to check care about the difference, if for no other reason caring which two code blocks to execute makes that many more bytes to load or have to store in a CPU memory cache. It also makes debugging and updating a few steps more complicated. Java -which at a guess is what Roll20 uses- is a flexible language able to run across many platforms very easily, but is not know for it's efficiency. I'm being OCD and trying to figure out why they compounded the (in this case probally trival) efficiency problem. :P
1423691225
Lithl
Pro
Sheet Author
API Scripter
Since you say you have experience with C++, you can compare it to the syntax for using printf. Why use "%-5s" as the placeholder for a left-aligned 5-character wide string instead of "$-5s"? Why use "?{Query}" instead of "?(Query)"? That's just how the syntax was defined. I'll also note that regardless of language (Roll20 use JavaScript, not Java), it is orders of magnitude easier to write the lexer for a system if the syntax is strictly defined, instead of "write whatver, I'll figure it out for you."
1423705204

Edited 1423708021
Well, the question wasn't "Why use it?", it was "Why care which was used, or add brackets the vocabulary?". It's a extra layer I still can't find a use for, and demands extra run-time and maintance. Also, That's a trick question. 'printf' is a C function imported to C++ for compatability. I wouldn't use it except when required by a specification. I'd use the standard string object's standard search or find functions. I also wouldn't use a search and replace. C++ is was designed more heavily object orient language, or plain C's more procedure oriented language. As each string was subdivide I'd use a interface class inheritance, hierarchy, and function objects. (Which I'll will freely admit isn't something I could completely solve in the two hours I sat here working out.) std::string::find_first_of std::function
1423721323
Lithl
Pro
Sheet Author
API Scripter
Stephen W. said: Also, That's a trick question. 'printf' is a C function imported to C++ for compatability. I wouldn't use it except when required by a specification. I'd use the standard string object's standard search or find functions. I also wouldn't use a search and replace. C++ is was designed more heavily object orient language, or plain C's more procedure oriented language. As each string was subdivide I'd use a interface class inheritance, hierarchy, and function objects. (Which I'll will freely admit isn't something I could completely solve in the two hours I sat here working out.) std::string::find_first_of std::function Eh? printf writes a formatted string to stdout. It's not used for searching strings.
1423723411

Edited 1423724199
Hm. Oh, sorry. I'm balling several ideas and throwing them all at once. (It's a bad habit of mine.) My bread and butter is somewhere above the driver level and below kernel or GUI level. The nuts and bolts of byte orders and data structures. Code library level stuff. (If your a little crazier then me, printf source code . Well vfprintf, it's core source. There's probably a wrapper for the actual 'printf' call. I avoid pure plain C code.) What prompted that wasn't what 'printf' does, but how it does it. I thought you were using the guts of printf as a example. My mind was throwing all kinds of errors. ;)