Howdy, Stranger!

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

deleteAt function used in links (incorrect version of SugarCube?)

Hi,

I have an array of two items:
$interactingRaiders

I'd like to be able to display each item as a link and, if it is selected, remove the other item from the array. My code currently says (paraphrased):
you could do something or other with [[$interactingRaiders[0].name|Aggression Training][$interactingRaiders.deleteAt(1)]] 
or with [[$interactingRaiders[1].name|Aggression Training][$interactingRaiders.deleteAt(0)]]
(line break added to save scrolling in this question)

However, when I click on one of those links I get a pop up error message saying:
Type Error: state.active.variables.interactingRaiders.deleteAt is not a function

I'm using SugarCube and got the details of deleteAt from here but I note that the heading of that page is Sugarcube 2.x and when I click on my story format it says SugarCube 1.0.34 I'm wondering if that's the issue - that I'm using version 1 of Sugarcube and deleteAt only appears in 2? If so, how do I update it? If not, what am I doing wrong?

Thanks in advance

Comments

  • SugarCube 2.x can be downloaded from the download section of the main page of it's website. The instructions on how to install it are found in the Twine 2 guide section of the same website.
  • JamesB01 wrote: »
    I'm using SugarCube and got the details of deleteAt from here but I note that the heading of that page is Sugarcube 2.x and when I click on my story format it says SugarCube 1.0.34 I'm wondering if that's the issue - that I'm using version 1 of Sugarcube and deleteAt only appears in 2?
    Yes, that is the issue. If by "when I click on my story format" you're referring to the story format window, then that should also contain a link to the documentation for SugarCube 1.

    greyelf has already covered where to find information on how to install SugarCube 2, should you desire to do that—I'd certainly recommend it.
Sign In or Register to comment.