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

[Sugarcube 1.0.34] Converging multiple choices into one passage

$
0
0
Hi there! I'm still fairly new to Twine but I've had a small amount of experience in programming, and I've been watching through some tutorials on Youtube to help me with Sugarcube's functions. That said I've got a few questions that are stumping me with my story idea, and I'd like some help with them! I'm not gonna bombard everyone with multiple questions so I'll tackle them in separate threads for ease of use.

The basic framing for my story so far is that the player character has an appointment with a laboratory, and they're asked what the nature of their business is. I'm using Sugarcube's "Objects" feature to give each option a name, a description (or rather a response to picking that option), and to set the player's clothes (As this is a part of the intro and so it's a player setup stage).

Here's my code so far:
Visual identity confirmed. Welcome, $pname, and thank you for considering an appointment with GenGel!

What is the nature of your visit?
----
<<nobr>>
<<set $biz={
"name":"Business Appointment",
"response":"Ah, yes, $pname, we have you listed down here because you were interested in buying our products? Please, come on in and we can get started.",
"head":"Glasses",
"top":"Business Shirt",
"bottom":"Business Pants",
"feet":"Fancy Shoes"
}>>
<<set $mat={
"name":"Material Delivery",
"response":"Ah! ...$pname, was it? You've got a consignment of chemicals for us? Excellent, our employees are taking that in now. If you come on in we'll get those forms signed.",
"head":"Trucker Cap",
"top":"Vest",
"bottom":"Jeans",
"feet":"Boots"
}>>
<<set $test={
"name":"Test Participant Application",
"response":"$pname, you were interested in applying as a test participant at GenGel, I remember you! Come on in and we can get you set up with your testing gear.",
"head":"Safety Goggles",
"top":"Speed Suit (top)",
"bottom":"Speed Suit (bottom)",
"feet":"Sneakers",
}>>
<<set $tour={
"name":"Guided Tour",
"response":"Welcome to our facility, $pname! We're always honoured to have guests pay a visit to our facilities. If you come on in we can get you set for the tour!",
"head":"Sunglasses",
"top":"Hawaiian Shirt",
"bottom":"Cargo Shorts",
"feet":"Leather Sandals"
}>>
<<set $idunno={
"name":"No Idea",
"response":"Wait... $pname, you registered for an appointment but you don't know what the appointment was for? (You hear a hushed conversation in the distance) ...Oh! Right, you're THAT $pname! Sorry for the confusion, come on in.",
"head":"HUDAR Glasses",
"top":"Baja Hoodie",
"bottom":"Baggy Jeans",
"feet":"Flip Flops"
}>>
<</nobr>>

$biz.name
$mat.name
$test.name
$tour.name
$idunno.name

What I ideally want to do is make it so that whatever option is picked, they all lead into the same passage, which displays the "response" field for whatever option was picked. It'd be nice to allow this page to accept more options later if needed, so the rough idea I have, in terms of a rough pseudocode example, is:

This Passage: If "Business Appointment" is clicked on, set chosenJob to $biz, if "Material Delivery" is clicked on, set chosenJob to $mat, so on so forth for each job.
Next Passage: Display the "Response" of whatever chosenJob is set to, and set $head, $top, $bottom and $feet to the chosenJob's head, top, bottom and feet values.

Apologies, that was a lot of words. Basically I've seen something like this done in Harlowe in VegetarianZombie's tutorial videos using datamaps, but I don't know how to do the equivalent for SugarCube's objects.

Viewing all articles
Browse latest Browse all 1844

Trending Articles