Howdy, Stranger!

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

Help with If and Set macros?

In the game I'm making, there is the option to select an attribute, which will slightly change up the things that happen/add different options, etc. However, whenever I try to use the tutorials listed around, I get the error "missing ) after argument list". I've tried correcting it multiple times, but I get the same error. Here's the text I'm referring to:

(set: $wings to $attribute2 = wings)
(if: $wings is true)[blah blah blah.]

I've also attempted it with simply (if: $attribute2 = wings), as well as (if: $attribute2 eq wings), and I get the same error. After every ] and ) within the text, I've added a new ) and tested it each time. Same error. It's starting to drive me a little crazy.

Comments

  • edited August 2015
    I mostly use sugarcube, but I believe it's the same in harlowe. You need quotation marks around a string, unlike numeric values. Also your set macro is kinda funky. Try:
    (set: $attribute2 to "wings")
    (If: $attribute2 = "wings")[blah blah blah]
    

    I think that is what you're aiming for.
  • That works, but the issue is that $attribute2 can be multiple things, since it's referenced with a cycling link earlier.
    (set: $attribute2 to "item 1")<tw-link class='cyclingLink' data-cycling-texts='["item 1", "wings", "item 3", "item 4"]' onclick='clickCyclingLink(this, "$attribute2");'>$attribute2</tw-link>

    So that I don't have to type out (if: $attribute2 = "wings")[blah blah blah every time it needs to be referenced], I'm attempting to shorten it.
  • So you want to have like a description of the wings that's plugged in to the text later, but you don't want to have to rewrite the wings description passage every time? I feel like that's what your going for. If so, maybe a widget. Let me mess with it a few minutes and see if I can figure out widgets in harlowe.
  • I want to have passages show up depending on if wings were chosen, such as an additional option during a choice or an extra passage of description. It's not the same thing every time (I guess I could've just said that). I want to be able to simply put ($wings)[text] in order to simplify things during the coding since I have enough monstrosities of code as is.
  • Try the following, it should display Wings is true:
    (set: $attribute2 to "wings")
    
    (set: $wings to ($attribute2 is "wings"))
    (if: $wings)[Wings is true](else:)[Winds is false]
    
    ... if you change the value of $attribute2 then it should display Winds is false:
    (set: $attribute2 to "another value")
    
    (set: $wings to ($attribute2 is "wings"))
    (if: $wings)[Wings is true](else:)[Winds is false]
    
Sign In or Register to comment.