Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

$ - What's up??

In the course of writing I naively tried to enter a dollar amount - something like this $60,450.

When I tested the selection there was no dollar sign and no 6.

I'm new at this so I may be doing something that is obviously incorrect but I thought that any text could be entered.

Comments

  • I'm not super familiar with Twine 2 so someone correct me if I'm wrong, but...

    The problem is that Twine 2 / Harlowe thinks you're trying to write a variable (as $ is also used to denote variables, like $moneyInInventory. If you just want to print the text $60,450 you can do this by putting tildes (the same as the squiggly key, not to be confused with a single quote/apostrophe) around the text like so:

    You have `$60,450` dollars.

    You can also create a variable that contains the amount of money so that you can later raise/lower that amount and display different amounts of money the player has at various points.

    Hope that helps!

    EDIT: If you haven't seen it already, more on the story format Harlowe can be found here: http://twine2.neocities.org/
  • Hrmmm.... I don't like this, but I don't know what to do about it between these two options:
    * Prevent uninitialised variables from being printed as the default of 0 when expressed in passage prose?
    * Prevent all-number variable names from being used - a somewhat dodgy restriction that doesn't exclude e.g. $100M

    More sensible options, like "change the sigil to something used less often in English" are sadly not on the table.
  • L wrote:

    * Prevent all-number variable names from being used - a somewhat dodgy restriction that doesn't exclude e.g. $100M

    Only allow the first character of a variable name be a-z|A-Z ?
  • That's what many proglangs use, and I don't like it because it feels really arbitrary and dirty to me, placing special restrictions on the first character. The $ sigil was meant to alleviate this concern about where a variable name begins.
  • This doesn't solve the larger problem of the dollar sign being a reserved character but if you want a bug fix in the meantime you can use the dollar sign's HTML entity number.

    If you put the code "$" in your game it should render as a dollar sign.
  • That works - the $ without the quotation marks of course which I included first time around. Thanks so much. I appreciate the help.
Sign In or Register to comment.