lundi 13 août 2018

Twine 2 (Sugarcube) Broken If Statements

I have an inventory script that works, and I am setting a variable called $bagspace to 2 before this script appears, yet anytime I click on the link, it does nothing but refresh the page. I check my inventory and bagspace variables, and they do not change.

<<if $tooknotebook is 1>>
    <<link 'Drop notebook.'>>
        <<drop '$playerInv' 'notebook'>>
        <<set $tooknotebook to 0>>
        <<set $bagspace to $bagspace + 1>>
        <<goto "I didn't know what to do..."
    <</link>>
<<else>>
    <<link 'Take notebook.'>>
        <<if $bagspace gt 0>>
            <<pickup '$playerInv' 'notebook'>>
            <<set $tooknotebook to 1>>
            <<goto "I didn't know what to do...">>
            <<set $bagspace to $bagspace - 1>>
        <<else>>
            Your inventory is full.
        <<endif>>
    <</link>>
<<endif>>

<<if $tookpencil is 1>>
    <<link 'Drop pencil.'>>
        <<drop '$playerInv' 'pencil'>>
        <<set $tookpencil to 0>>
        <<set $bagspace to $bagspace + 1>>
        <<goto "I didn't know what to do..."
    <</link>>
<<else>>
    <<link 'Take pencil.'>>
        <<if $bagspace gt 0>>
            <<pickup '$playerInv' 'pencil'>>
            <<set $tookpencil to 1>>
            <<goto "I didn't know what to do...">>
            <<set $bagspace to $bagspace - 1>>
        <<else>>
            Your inventory is full.
        <<endif>>
    <</link>>
<<endif>>

Aucun commentaire:

Enregistrer un commentaire