:: ReferenceNavigation[include]
	<<if $location_var[$here][0] != 'start'>>
		<<act 'Getting Started'>><<gt 'Reference'>><</act>>
	<</if>>
	<<if $location_var[$here][0] != 'vars'>>
		<<act 'Variables'>><<gt 'ReferenceVariables'>><</act>>
	<</if>>
	<<ret>>
:: Reference[menu]
	<<gs 'ReferenceNavigation' 'start'>>
	<h2>First Steps</h2>
	Prerequisites:
	<ul>
		<li>Have Python 3.10+ installed. Make sure it is added to PATH (there is a checkbox you have to check in the installer).</li>
		<li>Have GIT installed. It also needs to be included in PATH.</li>
		<li>Have an IDE installed (VSCode is recommended).</li>
	</ul>
	Then:
	<ol>
		<li>Create an account at https://git.tfgames.site </li>
		<li>Create a fork of https://git.tfgames.site/StephanFuchs/glife </li>
		<li>Clone the fork to your device (one way is the clone-command of git ... there are tutorials out there that explain that better than I could).</li>
		<li>Run the file <i>sugarcube_compile.bat</i>. This will create the file <i>glife.html</i> for you. You can open it in any browser. Repeat this step after you made changes to the source code.</li>
		<li>Make changes to the source code.</li>
		<li>Commit the changes of your source code once you are happy with them.</li>
		<li>Make a pull-request if you think your changes qualify to be pulled.</li>
	</ol>

	<h2>Branches</h2>
	In the main repository (https://git.tfgames.site/StephanFuchs/glife), there are the following branches:
	<ul>
		<li>SC-Master: This is master branch. The goal is to only have finished code here.</li>
		<li>master: The working branch with functional but incomplete or unfinished code.</li>
		<li>Edited-QSP*: Changes to the QSP-source before the automatic translate-script runs over it.</li>
		<li>Edited-TW: Changes to the Twine-files right after the translate-script runs over the code.</li>
		<li>SC-Releases: Release Versions.</li>
		<li>Everything else: Deprecated branches that could still have some valuable pieces hidden somewhere.</li>
	</ul>

:: ReferenceVariables[menu]
	<<gs 'ReferenceNavigation' 'vars'>>
	<h2>Variables</h2>
	<table class="reference">
		<tr>
			<th>Variable</th>
			<th>Variable name</th>
			<th>Values</th>
			
		</tr>

		<!-- Wardrobe -->
			<tr>
				<td colspan=3><h3>Wardrobe</h3></td>
			</tr>
			<tr>
				<td colspan=3>Unless otherwise specified, values represent the state of the currently worn outfit.</td>
			</tr>

			<td>Bra worn</td>
				<td>
					<span class="varName readOnly">isWearingBra</span>
				</td>
				<td>
					<ul>
						<li>false: no bra is being worn</li>
						<li>true: bra is being worn</li>
					</ul>
				</td>
			</tr>

			<tr>
				<td>Skirt Length</td>
				<td>
					<span class="varName readOnly">skirtLength</span>
					<span class="varName readOnly deprecated">PCloSkirt</span>
				</td>
				<td>
					Also indicates the length of a worn dress.
					<ul>
						<li>0: no skirt (either pants or nothing is worn at this slot)</li>
						<li>1: floor-length hemline</li>
						<li>2: knee-length hemline</li>
						<li>3: fairly standard hemline</li>
						<li>4: rather short hemline</li>
						<li>5: hemline that barely reaches past the groin</li>
						<li>6: hemline not even long enough to hide the privates</li>
					</ul>
					Derived from (item).skirtShortness. Check itemDescriptionWidget for consistency.
				</td>
			</tr>

			<td>Panties worn</td>
				<td>
					<span class="varName readOnly">isWearingPanties</span>
				</td>
				<td>
					<ul>
						<li>false: no panties are being worn (doesn't mean being naked, since one could still wear a skirt or pants or a dress)</li>
						<li>true: panties are being worn</li>
					</ul>
				</td>
			</tr>

			
		<!-- Weather -->
			<tr>
				<td colspan=3><h3>Weather</h3></td>
			</tr>
			<tr>
				<td colspan=3>Unless otherwise specified, values represent the state of the current weather.</td>
			</tr>
			<tr>
				<td>Rain</td>
				<td>
					<span class="varName readOnly">isRaining</span>
				</td>
				<td>
					<ul>
						<li>false: it's not raining</li>
						<li>true: it's raining</li>
					</ul>
				</td>
			</tr>
			<tr>
				<td>Temperature</td>
				<td>
					<span class="varName readOnly">temperature</span>
				</td>
				<td>
					Temperature in °C.
				</td>
			</tr>
	</table>

:: Reference_deprecated[deprecated]
	<h2>Reference</h2>
		<h3>Compiling</h3>
			<p>The game is compiled by running <i>sugarcube_compile.bat</i>.</p>
			<p>The resulting file is <i>glife.html</i>.</p>

		<h3>Javascript - Common Commands</h3>
			<h4>rand(min,max)</h4>
				<p>Returns a random integer between min and max (inclusive).</p>

		<h3>Twee - Common Commands</h3>
			<h4>Sugarcube-Native Macros</h4>
				<h5>if, elseif, else</h5>
				<h5>Switch</h5>
			<h4>Extended Commands</h4>
				<h5>either, or</h5>
					<p>Executes the code of one either- and or-contents. Which one is selected at random.</p>
					<<code>>
						He says<br/>
						<<either>><br/>
							hello.<br/>
						<<or>><br/>
							hi.<br/>
						<<or>><br/>
							salut!<br/>
						<</either>>
					<</code>>
					<p>The code above renders "He says hello." with a 1 in 3-chance.</p>
					<p>You can easily add more options and the propabilities will change accordingly.</p>
					<<code>>
						He says<br/>
						<<either>><br/>
							hello.<br/>
						<<or>><br/>
							hi.<br/>
						<<or>><br/>
							salut!<br/>
						<<or>><br/>
							nothing.<br/>
						<</either>>
					<</code>>
					<p>Here, every option has a 1 in 4-chance of getting displayed.</p>
					<p>You can change the weight of each option by adding a number behind it.</p>
					<<code>>
						He says<br/>
						<<either 3>><br/>
							hello.<br/>
						<<or 2>><br/>
							hi.<br/>
						<<or>><br/>
							salut!<br/>
						<<or>><br/>
							nothing.<br/>
						<</either>>
					<</code>>
					<p>The first option has a 3 in 7-chance of getting displayed. It's 2 in 7 for the second and 1 in 7 for the other two.</p>
					<p>Of course you can also use variables for this.</p>
					<<code>>
						<<set _chanceOfFirstOption = 80>><br/>
						He says<br/>
						<<either _chanceOfFirstOption>><br/>
							hello.<br/>
						<<or 100 - _chanceOfFirstOption>><br/>
							hi.<br/>
						<</either>>
					<</code>>
					<p>Here, the first option has a 80%-chance of getting displayed.</p>
					<p>You can also use expressions.</p>
					<<code>>
						He says<br/>
						<<either ($time.hour <= 10) ? 1 : 0>><br/>
							good morning.<br/>
						<<or ($time.hour <= 10) ? 0 : 1>><br/>
							good day.<br/>
						<</either>>
					<</code>>
					<p>
						Here, the first option will be rendered in case it's 10:59 or earlier.
						Otherwise the second is used.
						This is only an example. You would usually use an if-statement for this purpose.
					</p>

		<h3>Passage Tags</h3>
			<h4>Engine</h4>
				<p>The following passage-types belong to the system. Don't add or remove them unless you know what you're doing.</p>
				<ul>
					<li>widget: The passage provides widgets/macros for all other passages.</li>
				</ul>
			<h4>Events</h4>
				<ul>
					<li>events: The passage is an event-passage. If it doesn't render anything, the passage that has called it, will get displayed.</li>
					<li>hasEvents: The passage has an event-passage. The name of this passage must be "(name of original passage)_events"</li>
				</ul>
			<h4>Major Type</h4>
				<ul>
					<li>indoors: Weather has no effect here. Might effect the color settings if lightmode is active.</li>
					<li>outdoors: Weather effects the player here. Might effect the color settings if lightmode is active.</li>
					<li>menu: A menu (such as settings or wardrobe).</li>
				</ul>
			<h4>Privacy</h4>
				<ul>
					<li>private: Effects events and subtags.</li>
					<li>public: Effects events and subtags.</li>
				</ul>
			<h4>Type</h4>
				<ul>
					<li>bathroom: always includes a toilet
						<ul>
							<li>bathtub: features a bathtub.</li>
							<li>shower: features a shower</li>
							<li>shampooProvided: you can use the tub and/or the shower without having to use your own shampoo.</li>
						</ul>
					</li>
					<li>bedroom: A place where the player finds a bed to sleep.</li>
					<li>bedroomNpc: A bedroom where the player can't sleep.</li>
					<li>kitchen: One can at least find some water here.</li>
					<li>livingroom:</li>
				</ul>
:: ReferenceWidgets[widget]
<<widget 'code' container>>
	<<set _output = []>>
	<<set _lines = _contents.split("\u0020")>>
	<<set _lines = _contents.split(/\r?\n/)>>
	<<set _lines = _contents.split("<br/>")>>
	<<set _leadingWhitespace = _lines[1].match(/(\s*)[^\s].*/)[1]>>
	<<for _line range _lines>>
		<<if _line.trim().length > 0>>
			<<set _output.push('<nowiki>'+_line.removeLeading(_leadingWhitespace)+'</nowiki>')>>
		<</if>>
	<</for>>
	<<run console.warn(_output,_leadingWhitespace)>>
	<pre class="code"><<=_output.join("\n")>></pre>
<</widget>>
