Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Storing different value than what appears in a cyclinglink macro. (Sugarcube 2.12.1)

I have a small question that I can't seem to find an answer to by searching the forum or checking the documentation.

I'm using Twine 2.011 with Sugarcube 2.12.1 and I want to have a cyclinglink that shows different values from what it stores. For exmaple, when asking the player whether they are male or female I have the following code
You are <<cyclinglink '$gender' "a Man" " a Woman" "Different">>

With those words as the links, I'd like the ability to store the values "male", "female", or "other" inside $gender instead of what is displayed. I would prefer to keep a cyclinglink as that is what I use throughout the rest of the project and CSS is styled after it. What would be the best way to go about this?

Comments

  • The <<cyclinglink>> macro does not offer that ability. If you want to use it regardless, then you'll have to patch the value.

    You may use a <<link>> macro, which would check and reset the value, to gate all exists from the passage containing that <<link>>.

    For example, let's assume that you have a single exit link like some place else. The patch up <<link>> could look like the following:
    <<link [[leave|some place else]]>>
    	<<switch $gender>>
    	<<case "a Man">>
    		<<set $gender to "male">>
    	<<case "a Woman">>
    		<<set $gender to "female">>
    	<<default>>
    		<<set $gender to "other">>
    	<</switch>>
    <</link>>
    
    If you have multiple exit links, then you could either replicate that for every one or make a widget out of the contents and then call that within each <<link>>.
  • That works well in the passage it's being used. I just didn't know if there was some way of executing something like that inside the cyclinglink itself. Thanks a bunch!
Sign In or Register to comment.