Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

Problem with widget in SC 2.6.2

$
0
0
Good evening!

I am working with Twine 2.0.11 using SugarCube 2.6.2. I am having trouble with a widget I wrote. The widget should compare user inputs with given variables and dynamically link to the next passage:
<<widget "evaluate">>
    <<set $level to $args[0]>>
    <<set $rightAnswer to $args[1]>>
    <<set $userAnswer to $args[2]>>
    <<set $focus to $args[3]>>
    
	<<if $userAnswer eq "">>
		<<<<print "Please answer question!">>
    <<elseif $userAnswer eq $rightAnswer>>
        <<set $level +=1>>    
        <<set $nextPassage = $level + "x" + $round >>
        <<goto $nextPassage>>
    <<else>>
        <<set $level -=1>>    
        <<set $nextpassage = $level + "x" + $round >>
        <<goto $nextPassage>>
    <</if>>
<</widget>>

I use the widget for instance from within the following passage:
<<set $level to 1>>
<<set $rightAnswer to "Option A">>
<<set $focus to "Partizipien">>

Choose the right option!

<<radiobutton "$userAnswer" "Option A">>Option A
<<radiobutton "$userAnswer" "Option B">>Option B
<<radiobutton "$userAnswer" "Option C">>Option C


<<button "next round">>
    <<evaluate $level $rightAnswer $userAnswer $focus>>
<</button>>

I get the following error messages:
Error [tw-user-script-0]: Unexpected token <<.

and

Error: <<evaluate>>: error within widget contents (Error: cannot execute macro <<goto>>: Story.has title parameter cannot be undefined).


What am I doing wrong?

Thanks,
richVIE

Viewing all articles
Browse latest Browse all 1844

Trending Articles