Howdy, Stranger!

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

Trying to set coins to random but it isn't working.

(if: $blacksmithSkill <= 25)[You have collected your coins from the blacksmith for a job well done.(set: $coins to $coins + (random: 1,5))(set: $blacksmithSkill to blacksmithSkill + 1)

Eutherial's Blacksmith
Eutherial

|options>[stats]
(click-replace: "stats")[(display: "View Your Stats")]]

(if: $blacksmithSkill > 25)[You have collected your coins from the blacksmith for a job well done. (set: $coins to $coins + (random: 6,10)) (set: $blacksmithSkill to $blacksmithSkill + 1)

Eutherial's Blacksmith
Eutherial

|options>[stats]
(click-replace: "stats")[(display: "View Your Stats")]]

This is my current code. Every time I test it, I get the message
missing ) after argument list
. I'm not sure what I'm doing wrong, especially considering I have a code extremely similar to this in another part of the game.

Comments

  • You need to state which Story Format you are using when you ask a question, as answers can be different for each one. Based on your example I am assuming you are using Harlowe.

    The second blacksmithSkill in your first (set: $blacksmithSkill to blacksmithSkill + 1) is missing a $ (dollar sign) at the start of the variable name, which is causing your error.
    (set: $blacksmithSkill to $blacksmithSkill + 1)
    

    As explained in Harlowe's (set:) macro documentation you can use the it keyword when changing the current value of a variable.
    You can also use it in expressions on the right-side of to. Much as in other expressions, it's a shorthand for what's on the left side: (set: $vases to it + 1) is a shorthand for (set: $vases to $vases + 1).
    ... so the first $coins and $blacksmithSkill (set:) macros in your example could be written like so:
    (set: $coins to it + (random: 1,5))(set: $blacksmithSkill to it + 1)
    
Sign In or Register to comment.