Variable issues


maybe someone does have an idea how to solve this:

Can I reuse a variable as a parameter for an html tag, when the variable has not been set by using the Set: command?

Trying to render this:
<font color="{color}" size="5">
from anything else than
Set: color=#ffff00
seems to fail. The output source code only shows
<font color="" size="5">

I'd like to make roll on Table A and set {color==#ffff00} within the result line, then continue to Table B and generate the output like shown above.
Table: A
Roll: 1d3

Table B
1:{class}<font color="{color}" size="5">●</font>

It worked when I made an error and tried to output
<font color="{color" size="5"}>
, but it also threw an error message. It seems, variables were not meant to being used as html parameters? I also played around with [when] conditions, but this didn't work either.


  • You just about got it!

    The part you were missing was that for inline variable assignment you need single quotes, like this:
    Table: A
    Roll: 1d3
    Make that one little change, and your code works just fine.
  • Brilliant! :) Thank you largando.
  • When do you need single quotes and when can you omit them? Inline assignments are giving me a lot of trouble in my present project. Is it something about the kind of data being assigned? E.g. if it contains symbols like #?
  • I'm pretty sure you can omit them for numbers. Having said that, there's no reason to omit them even then. IPP doesn't do any kind of variable typing, so if you have a string like '333' IPP will let you treat it as a number.

    So, good rule of thumb: always use single quotes for inline variable assignment.
  • Sometimes you can omit them for text, sometimes you can put the whole assignment in square brackets instead of curly brackets, but it seems inconsistent. Sometimes it works, sometimes not. I will try to stick with curly brackets and single quotes and see if any other weirdness arises.

Leave a Comment