Tinderbox Forum

Using a Stamp to set $Rule?

I don’t have a great deal of time to troubleshoot this, so…TO THE FORUM!

$Rule=$Subtitle=$ChildCount+" Notes"; $SubtitleColor=“bright green”

My intent should be clear. I want to use a stamp to set a rule because I don’t want to use a prototype in this instance. I just want to be able to make certain containers (which may already have prototypes), show me a little green total number of notes as the $Subtitle.


Two errors:

  1. You’re setting the rule, and thus a string representing what will be run as the rule code once in place. As you already use quotes in the desired rule once, you need to use a different type (single vs double) of quote to enclose all the code
  2. You must use straight quotes for action code - your second expression uses curly quotes.

Thus, your stamp should be:

$Rule="$Subtitle=$ChildCount+' Notes';$SubtitleColor='bright green';"

Note, I reversed the nesting of single-outside-double quotes to double-outside-single. This is because the other way around, the Tinderbox parser is confused and only the first expression of the rule code gets set. Tested in v7.3.1

Ah ha, the “use different styles of quotes” issue. That’s what I was missing! The curly quotes thing I knew about, I think that happened when I cut & paste the rule. Thanks!!!

I thought the curly quotes might be an auto-correct artefact! An interesting angle here was that an outer set of single quotes didn’t work. sometimes, it’s worth ‘reversing’ the nesting in case, as here it fixes the issue.