Widget ChoiceLink going wrong - SugarCube 2

0 votes
asked Sep 12 by Randalthor (270 points)

I've added the ChoiceLink to my java and it was working well before, allowing up to multiple clickable choices that sets up the continuation of the story without having to leave the passage itself. However as I was adding to it, it began to only show choice #2's reaction despite clicking choice #1. I would love some help if someone could recognize what I'm missing here, for little ol' newbie right here :) Thanks!!

<<nobr>> 
    <span id='option'> 
        <<choiceLink '#option' 'Get out of bed' 'you get out of bed.'>> or	
		<<choiceLink '#option' 'Another ten flippin minutes.' 'yeah screw the system!'>>
		</span>
	<</nobr>> 
	




(Necessary for the above to function) 

<<widget 'choiceLink'>>\
    <<nobr>>
        <<set _linkGroup to $args[0]>>
        <<set _linkText to $args[1]>>
        <<set _result to $args[2]>>
        <<link _linkText>>
            <<append _linkGroup>>
                <<- '\n\n' + _result>>
            <</append>>
            <<run $(_linkGroup + ' a').off().addClass('no-link')>>
        <</link>>
        <</nobr>>\
<</widget>>



 

1 Answer

+1 vote
answered Sep 13 by greyelf (27,720 points)

When referencing code from another question it helps if you include a link to it, I am assuming you are using this ChoiceLink macro.

As I stated in that question, the widget contains as error and would of always showed the reaction of the last choice (choice #2 in the examples case).

commented Sep 13 by Chapel (23,990 points)
Whoops. Thanks for cleaning up my mess, greyelf.
...