0 votes
asked by (2k points)
I finished my first Harlowe story and now I'm trying sugarcube. I'm trying to give my character a gender and this is what I'm trying (without success)

<<link "Male">>[\
<<set $gender to male>>
] So you are a male<</link>>
<<link "Female">>[\
<<set $gender to female>>
] So you are a female<</link>>

 

Yeah, I suck at this and I'm an uncultured swine. I apreciate any help. Also, it would be cool of you to tell me how can I get the unselected option to dissapear. Thank you veeeery much.

1 Answer

0 votes
answered by (870 points)
selected by
 
Best answer

Because you're trying to set your variables to a string, you need quotation marks, so try this:

<<link "Male">>[\
<<set $gender to "male">>
] So you are a male<</link>>
<<link "Female">>[\
<<set $gender to "female">>
] So you are a female<</link>>

 

commented by (2k points)
It worked, thank you very much. Do you happen to know how can i get the unchoosen choise to disappear? If you do not, don't worry, thank you very much.
commented by (870 points)

If you use the <<replace>> macro, you can replace a set div id with your text of choice. Here's the code for it:

@@#gender;
<<nobr>>
  <<link "Male">>
	<<set $gender to "male">>
	<<replace "#gender">>
		So you are a male
	<</replace>>
  <</link>>
  <br>
  <<link "Female">>
	<<set $gender to "female">>
	<<replace "#gender">>
		So you are a female
	<</replace>>
  <</link>>
<</nobr>>
@@

 

...