麻线2(Sugarcube)断言语句

时间:2018-08-13 14:51:16

标签: javascript if-statement twine-game-engine

我有一个有效的清单脚本,并且在此脚本出现之前,我将一个名为$bagspace的变量设置为2,但是,每当我单击链接时,它都不会刷新页面。我检查了我的库存和bagspace变量,它们没有变化。这是我的代码:

<<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>>

0 个答案:

没有答案