Howdy, Stranger!

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

Re: parameter(number) bug?

http://twinery.org/wiki/function
I am trying out using this function which was added to Twine 1.41 version but when I used the example given in the wiki i get an error saying macro parameter(0) and parameter(1) not found when displaying the passage.

Is this a bug?

Comments

  • I tried a number of things and couldn't figure out how to get it to work either.
  • Which Story Format are you using?
  • Seems to work for me:
    ::printlink
    <<nobr>>
    <<set $ix to parameter(0)>>
    ...

    ::converse
    ...
    <<printlink 0>>
    <<printlink 1>>
    <<printlink 2>>
    Sure you are using parameter(0) not Parameter(0)?  I think the delimiters between the parameters are spaces, so multi-word parameters would need to be strings, and adding commas would just confuse matters.
  • greyelf wrote:

    Which Story Format are you using?

    Sugarcane.

    mykael wrote:

    Seems to work for me:
    ::printlink
    <<nobr>>
    <<set $ix to parameter(0)>>
    ...

    ::converse
    ...
    <<printlink 0>>
    <<printlink 1>>
    <<printlink 2>>
    Sure you are using parameter(0) not Parameter(0)?  I think the delimiters between the parameters are spaces, so multi-word parameters would need to be strings, and adding commas would just confuse matters.


    Yes i checked the syntax its in lower case.

    This is what i got.

    Passage Start:
    <<CaramelCanoe "oars" "satchel">>
    Passage CaramelCanoe:
    You're canoeing down the caramel river, rowing with <<parameter(0)>>, your <<parameter(1)>> by your side.
    It doesn't recognise parameter() as a macro. Perhaps this doesn't work for sugarcane?

    Is this mainly used for passing variables from one function or script into another?, it seems similar to another scripting language i've seen used in Arma where you can use select 0 or select 1 when referring to an a game object etc.

    Just wondering what advanced things you can do with this that normal variables or objects couldn't already do? (forgive my ignorance) just curious.
  • Works for me (after I added a <<endnobr>>), and all I did was copy-and-paste your code in (but it does not work in Sugarcube).
  • Try
    <<set $p0 to parameter(0)>>
    <<set $p1 to parameter(1)>>

    You're canoeing down the caramel river, rowing with <<$p0>>, your <<p1>> by your side.
    Do the sets as the first couple of lines of your macro.  Do you make any other macro calls from inside your macro?
  • mykael wrote:

    Try
    <<set $p0 to parameter(0)>>
    <<set $p1 to parameter(1)>>

    You're canoeing down the caramel river, rowing with <<$p0>>, your <<$p1>> by your side.
    Do the sets as the first couple of lines of your macro.  Do you make any other macro calls from inside your macro?


    Got it working now with your example. I didn't realize I needed to move the parameter values in a variable first then use those variables in the sentence. I was literally just using parameter(0) like in the wiki.

    So the parameter method is only used for when you want to 'display' a passage and carry some values into it? just like you can with links eg;
    [[Canoe down the river|CaramelCanoe][$p0= "oars"; $p1= "satchel"]]

    Thanks for your help that :)
  • Here's the answer to what's going on

    The wiki documentation had a mistake. This line:
    You're canoeing down the caramel river, rowing with <<parameter(0)>>, your <<parameter(1)>> by your side.
    should have actually read:
    You're canoeing down the caramel river, rowing with <<print parameter(0)>>, your <<print parameter(1)>> by your side.
    Sorry everybody.
Sign In or Register to comment.