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

Help Streamlining this code in an Array, or Dataset/map?

$
0
0
Okay - I somewhat want a dating sim but not quite - the code below is to basically show how 'far' in the relationship you are with any of them. I'm using Sugarcube 2 (Latest), and Twine 2. My problem is in the code itself. How do I condense it into an array or datamap or whatever? $relationship(Char name) is basically when you 'start' talking to a certain character in the TWINE novel, and after a certain amount of storyline, you set their 'affection' toward your character, and I am placing it in a Storymenu Passage anyhow. (This code is from my StoryInit Passage).

And I am going to be having at least 60+ characters eventually once I get everything written out. Any ideas how to condense it?
<<set $relationshipJonas to false>>
<<set $relationshipSamuel to false>>
<<set $relationshipGrag to false>>
<<set $relationshipDamian to false>>
<<set $relationshipKelle to false>>
<<set $jonasAffection to 0>>

<<set $samuelAffection to 0>>

<<set $gragAffection to 0>>

<<set $damianAffection to 0>>

<<set $kelleAffection to 0>>

<<widget "relationships">>\
	<<set $relationships to true>>\
	<<nobr>>
		<<if $relationshipJonas>>\
			Jonas Leaf:
			 \<<if $jonasAffection gte 5>>\
				<<print "Acquaintances">>\
			<</if>>
			<<if $jonasAffection gte 10>>\
				\<<print "Friends">>
			<</if>>
			<<if $jonasAffection gte 20>>\
				<<print "Budding Romance">>
			<</if>>
			<<if $jonasAffection gte 30>>\
				"In love."
			<<else>>
				"Stranger"
			<</if>>
		<</if>>
		
		<<if $relationshipSamuel>>
			Samuel Lighthill: 
			\<<if $samuelAffection gte 5>>\
				"Acquaintances"
			<</if>>
			<<if $samuelAffection gte 10>>\
				"Friends"
			<</if>>
			<<if $samuelAffection gte 20>>
				"Budding Romance"
			<</if>>
			<<if $samuelAffection gte 30>>
				"In love."
			<<else>>
				"Stranger"
			<</if>>
		<</if>>
		<<if $relationshipGrag>>
			Grag: 
			\<<if $gragAffection gte 5>>\
				"Acquaintances"
			<</if>>
			<<if $gragAffection gte 10>>\
				"Friends"
			<</if>>
			<<if $gragAffection gte 20>>
				"Budding Romance"
			<</if>>
			<<if $gragAffection gte 30>>
				"In love."
			<<else>>
				"Stranger"
			<</if>>
		<</if>>
		<<if $relationshipDamian>>\
			Damian:
			\<<if $damianAffection gte 5>>\
				<<print "Acquaintances">>\
			<</if>>
			<<if $damianAffection gte 10>>\
				\<<print "Friends">>
			<</if>>
			<<if $damianAffection gte 20>>\
				<<print "Budding Romance">>
			<</if>>
			<<if $damianAffection gte 30>>\
				"In love."
			<<else>>
				"Stranger"
			<</if>>
		<</if>>
		<<if $relationshipKelle>>\
			Kelle:
			\<<if $kelleAffection gte 5>>\
				<<print "Acquaintances">>\
			<</if>>
			<<if $kelleAffection gte 10>>\
				\<<print "Friends">>
			<</if>>
			<<if $kelleAffection gte 20>>\
				<<print "Budding Romance">>
			<</if>>
			<<if $kelleAffection gte 30>>\
				"In love."
			<<else>>
				"Stranger"
			<</if>>
		<</if>>
	<<endnobr>>
<</widget>>

Viewing all articles
Browse latest Browse all 1844

Trending Articles