<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://sciwiki.sierrahelp.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kawa</id>
	<title>SCI Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://sciwiki.sierrahelp.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kawa"/>
	<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php/Special:Contributions/Kawa"/>
	<updated>2026-11-12T09:08:53Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.9</generator>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Regions_and_Locales&amp;diff=10861</id>
		<title>Regions and Locales</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Regions_and_Locales&amp;diff=10861"/>
		<updated>2016-02-27T19:38:25Z</updated>

		<summary type="html">&lt;p&gt;Kawa: Sierra Script conversion&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Chapter 2 - Regions and Locales=&lt;br /&gt;
&lt;br /&gt;
If you want to have a common set of behavior (handling &amp;#039;&amp;#039;&amp;#039;Said&amp;#039;&amp;#039;&amp;#039; statements, &amp;#039;&amp;#039;&amp;#039;doit&amp;#039;&amp;#039;&amp;#039; methods, &amp;#039;&amp;#039;&amp;#039;changeStates&amp;#039;&amp;#039;&amp;#039;) that extend across rooms, &amp;#039;&amp;#039;regions&amp;#039;&amp;#039; and &amp;#039;&amp;#039;locales&amp;#039;&amp;#039; are what you need.&lt;br /&gt;
&lt;br /&gt;
==Locales==&lt;br /&gt;
&lt;br /&gt;
Locales are the simpler of the two. Basically, they allow you to specify a handleEvent method that can be used across multiple rooms. To create a locale, you need to create a new (empty) script, and put a public instance of the class &amp;#039;&amp;#039;&amp;#039;Locale&amp;#039;&amp;#039;&amp;#039; at the top of the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
For example, suppose you have many rooms with snow. You want to only code up the responses to someone looking at snow once, you could write the following locale:&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot; class=&amp;quot;cs&amp;quot;&amp;gt;&lt;br /&gt;
;;;******************* Snow  locale *********************************************/&lt;br /&gt;
(script 777)&lt;br /&gt;
;;;******************************************************************************/&lt;br /&gt;
(include sci.sh)&lt;br /&gt;
(include game.sh)&lt;br /&gt;
;;;******************************************************************************/&lt;br /&gt;
(use controls)&lt;br /&gt;
(use game)&lt;br /&gt;
(use main)&lt;br /&gt;
(use obj)&lt;br /&gt;
&lt;br /&gt;
(instance snowLocale of Locale&lt;br /&gt;
	(properties)&lt;br /&gt;
	(method (handleEvent pEvent)&lt;br /&gt;
		(super handleEvent: pEvent)&lt;br /&gt;
		(if (Said &amp;#039;look/snow&amp;#039;)&lt;br /&gt;
			(Print {Look at all that nice snow.})&lt;br /&gt;
		)&lt;br /&gt;
	)&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then, in the init method of each room where you have snow, you can add a call to &amp;#039;&amp;#039;&amp;#039;setLocales&amp;#039;&amp;#039;&amp;#039;. For example:&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot; class=&amp;quot;cs&amp;quot;&amp;gt;&lt;br /&gt;
(instance rm001 of Rm&lt;br /&gt;
	(properties&lt;br /&gt;
		picture scriptNumber&lt;br /&gt;
		; Set up the rooms to go to/come from here&lt;br /&gt;
		north 0&lt;br /&gt;
		east 0&lt;br /&gt;
		south 0&lt;br /&gt;
		west 0&lt;br /&gt;
	)&lt;br /&gt;
	&lt;br /&gt;
	(method (init &amp;amp;tmp button)&lt;br /&gt;
		(super init:)&lt;br /&gt;
		(self setScript: RoomScript)&lt;br /&gt;
&lt;br /&gt;
		(switch gPreviousRoomNumber&lt;br /&gt;
			; Set up ego&amp;#039;s position if it hasn&amp;#039;t come from any room&lt;br /&gt;
			(else &lt;br /&gt;
				(gEgo posn: 150 130 loop: 1)&lt;br /&gt;
			)&lt;br /&gt;
		)&lt;br /&gt;
&lt;br /&gt;
		; Set up the ego&lt;br /&gt;
		(SetUpEgo)&lt;br /&gt;
		(gEgo init:)&lt;br /&gt;
		&lt;br /&gt;
		; Set up the snow locale&lt;br /&gt;
		(self setLocales: 777)&lt;br /&gt;
	)&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
You can specify multiple script numbers in the call to &amp;#039;&amp;#039;&amp;#039;setLocales&amp;#039;&amp;#039;&amp;#039;. The only requirement is that the first public instance in that script must be an instance of the &amp;#039;&amp;#039;&amp;#039;Locale&amp;#039;&amp;#039;&amp;#039; class.&lt;br /&gt;
&lt;br /&gt;
===Regions===&lt;br /&gt;
&lt;br /&gt;
Regions are very similar to Locales, except that they provide more functionality. Basically anything you can do in a room, you can do with a region too: apply a custom script that has not only &amp;#039;&amp;#039;&amp;#039;handleEvent&amp;#039;&amp;#039;&amp;#039;, but also &amp;#039;&amp;#039;&amp;#039;doit&amp;#039;&amp;#039;&amp;#039;, and &amp;#039;&amp;#039;&amp;#039;changeState&amp;#039;&amp;#039;&amp;#039; methods. Again, make a new script for your region, and ensure the first public instance in that script, is of the class &amp;#039;&amp;#039;&amp;#039;Rgn&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
Region example: &lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot; class=&amp;quot;cs&amp;quot;&amp;gt;&lt;br /&gt;
;;;******************* dog region ************************************/&lt;br /&gt;
(script 778)&lt;br /&gt;
;;;******************************************************************************/&lt;br /&gt;
(include sci.sh)&lt;br /&gt;
(include game.sh)&lt;br /&gt;
;;;******************************************************************************/&lt;br /&gt;
(use controls)&lt;br /&gt;
(use feature)&lt;br /&gt;
(use cycle)&lt;br /&gt;
(use follow)&lt;br /&gt;
(use wander)&lt;br /&gt;
(use game)&lt;br /&gt;
(use main)&lt;br /&gt;
(use obj)&lt;br /&gt;
&lt;br /&gt;
(local&lt;br /&gt;
	goneToBathroom = FALSE&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
(instance dogRegion of Rgn&lt;br /&gt;
	(properties)&lt;br /&gt;
	(method (init)&lt;br /&gt;
		(super init:)&lt;br /&gt;
		(self setScript: DogRegionScript)&lt;br /&gt;
		&lt;br /&gt;
		; Make a dog that follows you&lt;br /&gt;
		(aDog&lt;br /&gt;
			ignoreControl: ctlWHITE&lt;br /&gt;
			ignoreActors:&lt;br /&gt;
			setMotion: Follow gEgo 15&lt;br /&gt;
			init:&lt;br /&gt;
		)&lt;br /&gt;
	)&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
(instance DogRegionScript of Script&lt;br /&gt;
	(properties)&lt;br /&gt;
&lt;br /&gt;
	(method (changeState newState)&lt;br /&gt;
		(= state newState)&lt;br /&gt;
		(switch (newState)&lt;br /&gt;
			(0&lt;br /&gt;
				; Nothing to do here.&lt;br /&gt;
			)&lt;br /&gt;
			(10&lt;br /&gt;
				; Make the dog walk to the edge of the screen...&lt;br /&gt;
				(aDog setMotion: MoveTo 0 150 DogRegionScript)&lt;br /&gt;
			)&lt;br /&gt;
			(11&lt;br /&gt;
				; ...and disappear&lt;br /&gt;
				(aDog hide:)&lt;br /&gt;
			)&lt;br /&gt;
		)&lt;br /&gt;
	)&lt;br /&gt;
&lt;br /&gt;
	(method (doit)&lt;br /&gt;
		(super doit:)&lt;br /&gt;
		(if (not goneToBathroom)&lt;br /&gt;
			; Assuming that you gave all grass a green control colour...&lt;br /&gt;
			(if (and (aDog onControl:) ctlGREEN)&lt;br /&gt;
				(= goneToBathroom TRUE)&lt;br /&gt;
				(Print {The dog finds a nice patch of grass and goes to the bathroom})&lt;br /&gt;
			)&lt;br /&gt;
		)&lt;br /&gt;
	)&lt;br /&gt;
&lt;br /&gt;
	(method (handleEvent pEvent)&lt;br /&gt;
		(super handleEvent: pEvent)&lt;br /&gt;
		(if (Said &amp;#039;give/food/dog&amp;#039;)&lt;br /&gt;
			(Print {You give food to the dog and he runs away})&lt;br /&gt;
			(self changeState: 10)&lt;br /&gt;
		)&lt;br /&gt;
	)&lt;br /&gt;
)&lt;br /&gt;
 &lt;br /&gt;
(instance aDog of Act&lt;br /&gt;
	(properties&lt;br /&gt;
		x 50&lt;br /&gt;
		y 150&lt;br /&gt;
		view 800&lt;br /&gt;
	)&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
To apply this to a room, in its init method, do:&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot; class=&amp;quot;cs&amp;quot;&amp;gt;&lt;br /&gt;
; Set up the dog region&lt;br /&gt;
(self setRegions: 778)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When this region is applied to a room (via the &amp;#039;&amp;#039;&amp;#039;setRegions&amp;#039;&amp;#039;&amp;#039; method, which works just like &amp;#039;&amp;#039;&amp;#039;setLocales&amp;#039;&amp;#039;&amp;#039;), the dog will follow you around. If you give it food, it will run away. If it encounters a patch of grass, it will go to the bathroom. So pretty much any logic you put into a room, you can also put into a region that can be applied to any room.&lt;br /&gt;
&lt;br /&gt;
Note that the room&amp;#039;s methods are called before the regions&amp;#039;, and the regions &amp;#039;before the locales&amp;#039;. So if in a region you have a Said clause that is identical to one in a room, the room&amp;#039;s &amp;#039;&amp;#039;&amp;#039;Said&amp;#039;&amp;#039;&amp;#039; clause will win.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;float: left&amp;quot;&amp;gt;[[Advanced Said() Strings - Part 1|&amp;amp;lt; Previous: Chapter 1 - Advanced Said() Strings - Part 1]]&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;[[Scripting Props and Acts|Next: Chapter 3 - Scripting Props and Acts &amp;amp;gt;]]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
[[Category:Regions and Locales]]&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Kawa</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Advanced_Said()_Strings_-_Part_1&amp;diff=10854</id>
		<title>Advanced Said() Strings - Part 1</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Advanced_Said()_Strings_-_Part_1&amp;diff=10854"/>
		<updated>2016-02-27T19:25:25Z</updated>

		<summary type="html">&lt;p&gt;Kawa: Sierra Script conversion&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Chapter 1 - Advanced Said() Strings - Part 1=&lt;br /&gt;
&lt;br /&gt;
==More About Said Statements==&lt;br /&gt;
&lt;br /&gt;
This chapter explains some common Said usage patterns that aren&amp;#039;t fully explained in the other tutorials.&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Look&amp;quot; vs. &amp;quot;Look thing&amp;quot;===&lt;br /&gt;
&lt;br /&gt;
Often, you might want to enclose all your &amp;#039;look&amp;#039; handlers in one if statement, but still support just &amp;quot;look&amp;quot; all by itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if (Said &amp;#039;look&amp;gt;&amp;#039;)&lt;br /&gt;
	(if (Said &amp;#039;/wall&amp;#039;) (Print {The wall is covered in paint.}))&lt;br /&gt;
	(if (Said &amp;#039;/floor&amp;#039;) (Print {The floor is covered in dust.}))&lt;br /&gt;
	(if (Said &amp;#039;[/!*]&amp;#039;) (Print {You are in a room with a floor and a wall.})) ; this will handle just &amp;quot;look&amp;quot; by itself&lt;br /&gt;
	(if (Said &amp;#039;/*&amp;#039;) (Print {You don&amp;#039;t see anything interesting about it.})) ; this will handle &amp;quot;look anyword&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wanted to handle &amp;#039;look around&amp;#039; just like look, you could do:&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if (Said &amp;#039;look&amp;gt;&amp;#039;)&lt;br /&gt;
	(if (Said &amp;#039;/wall&amp;#039;) (Print {The wall is covered in paint.}))&lt;br /&gt;
	(if (Said &amp;#039;/floor&amp;#039;) (Print {The floor is covered in dust.}))&lt;br /&gt;
	(if (Said &amp;#039;[/around]&amp;#039;) (Print {You are in a room with a floor and a wall.})) ; this will handle just &amp;quot;look&amp;quot; by itself, and also &amp;quot;look around&amp;quot;&lt;br /&gt;
	(if (Said &amp;#039;/*&amp;#039;) (Print {You don&amp;#039;t see anything interesting about it.}))&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that more specific Said clauses should always come before more general ones.&lt;br /&gt;
&lt;br /&gt;
===More complex Said strings===&lt;br /&gt;
&lt;br /&gt;
Consider the following example:&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if (Said &amp;#039;give/food/dog&amp;#039;)&lt;br /&gt;
	(Print {You give the food to the dog.})&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One thing to note is that the order of words in the Said string doesn&amp;#039;t necessarily match the order that the words are typed in by the user. There is more meaning to the Said string than that. The above clause will respond positively to the user typing &amp;quot;Give food to the dog&amp;quot;, or even &amp;quot;Give dog the food&amp;quot;. However, surprisingly (and fortunately), it will not match &amp;quot;Give food the dog&amp;quot;. Rather than the particular word order in a sentence, the three parts of the above clause correspond to sentence parts.&lt;br /&gt;
&lt;br /&gt;
Similarly:&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if (Said &amp;#039;point&amp;lt;up/flashlight&amp;#039;)&lt;br /&gt;
	(Print {You point the flashlight up, and see something curious.})&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will respond to &amp;quot;point flashlight up&amp;quot;, but not &amp;quot;point up flashlight&amp;quot;. (Note: FreeSCI may have some bugs here that make it behave differently than the Sierra parser).&lt;br /&gt;
&lt;br /&gt;
That sums up more about said statements.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;float: left&amp;quot;&amp;gt;[[Advanced_SCI_Tutorials|&amp;amp;lt; Previous: Advanced SCI Tutorials Introductions]]&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;[[Regions and Locales|Next: Chapter 2 - Regions and Locales &amp;amp;gt;]]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
[[Category:The SCI Parser]]&lt;br /&gt;
[[Category:Examples]]&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Kawa</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Adding_a_real-time_game_clock_to_the_status_line&amp;diff=10828</id>
		<title>Adding a real-time game clock to the status line</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Adding_a_real-time_game_clock_to_the_status_line&amp;diff=10828"/>
		<updated>2016-02-27T18:38:19Z</updated>

		<summary type="html">&lt;p&gt;Kawa: Conversion to Sierra Script&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ever wanted a clock displayed in your status bar like in King&amp;#039;s Quest III? Well it&amp;#039;s relatively simple. First we&amp;#039;ll need to add an additional global variable to the Main script here:&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
	gTimeSeconds ; the seconds&lt;br /&gt;
	gTimeMinutes ; the minutes&lt;br /&gt;
	gTimeHours ; the hours&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add a variable named &amp;quot;gTimeTicks&amp;quot; before these variables like so:&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
	gTimeTicks&lt;br /&gt;
	gTimeSeconds ; the seconds&lt;br /&gt;
	gTimeMinutes ; the minutes&lt;br /&gt;
	gTimeHours ; the hours&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reason we need this extra variable is so we can have room to update the seconds counter on the clock, which is normally done within the if statement condition below:&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
	(if (!= gCurrentTime (= gCurrentTime (GetTime gtTIME_OF_DAY)))&lt;br /&gt;
		(if (&amp;gt;= (++ gTimeSeconds) 60)&lt;br /&gt;
			(= gTimeSeconds 0)&lt;br /&gt;
			(++ gTimeMinutes)&lt;br /&gt;
			(if (&amp;gt;= gTimeMinutes 60)&lt;br /&gt;
				(= gTimeMinutes 0)&lt;br /&gt;
				(++ gTimeHours)&lt;br /&gt;
			)&lt;br /&gt;
		)&lt;br /&gt;
	)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change this block of code by adding an additional nested if statement utilizing the new gTimeTicks variable and adding &amp;quot;(SL:doit())&amp;quot; to each of the statements as expressed below. Also make sure to change the line &amp;quot;(if(&amp;gt;= ++gTimeSeconds 60)&amp;quot; to read &amp;quot;(if(&amp;gt;= gTimeSeconds 60)&amp;quot; instead or else it will increment the seconds counter by two instead of one. Now that the gTimeTicks variable is incremented in the if statement condition, the gTimeSeconds variable does not need to be incremented (within the condition).&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
	(if (!= gCurrentTime (= gCurrentTime (GetTime gtTIME_OF_DAY)))&lt;br /&gt;
	    (if (&amp;gt;= (++ gTimeTicks) 1)&lt;br /&gt;
	    	(= gTimeTicks 0)&lt;br /&gt;
	    	(++ gTimeSeconds)&lt;br /&gt;
	    	(SL doit:)&lt;br /&gt;
	    	(if (&amp;gt;= gTimeSeconds 60)&lt;br /&gt;
		    	(= gTimeSeconds 0)&lt;br /&gt;
	    		(++ gTimeMinutes)&lt;br /&gt;
	    		(SL doit:)&lt;br /&gt;
	    		(if (&amp;gt;= gTimeMinutes 60)&lt;br /&gt;
		    		(= gTimeMinutes 0)&lt;br /&gt;
	    			(++ gTimeHours)&lt;br /&gt;
	    			(SL doit:)&lt;br /&gt;
				)&lt;br /&gt;
			)&lt;br /&gt;
		)&lt;br /&gt;
	)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now this new block of code will update the status line each time the seconds, minutes, and hours counter is updated. One more thing that is required is to go to the Initrooms script and scroll down to the doit method to the line that reads:&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
	(= gTimeSeconds 0)&lt;br /&gt;
	(= gTimeMinutes 0)&lt;br /&gt;
	(= gTimeHours 0)&lt;br /&gt;
	(= gEgoView 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add &amp;quot;= gTimeTicks 0&amp;quot; like so:&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot; class=&amp;quot;cs&amp;quot;&amp;gt;&lt;br /&gt;
	(= gTimeTicks 0)&lt;br /&gt;
	(= gTimeSeconds 0)&lt;br /&gt;
	(= gTimeMinutes 0)&lt;br /&gt;
	(= gTimeHours 0)&lt;br /&gt;
	(= gEgoView 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will reset the clock each time the Initrooms script is called (each time the game is restarted from the beginning).&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Almost done. There&amp;#039;s still one more thing left to do. All this is for nothing if we can&amp;#039;t see the actual clock on the status line. So we have to go back to the Main script and alter the statusCode instance to read:&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance statusCode of Code&lt;br /&gt;
	(properties)&lt;br /&gt;
	(method (doit param1)&lt;br /&gt;
		(Format param1 {_Score: %d of %-3d_______Template Game______%02d:%02d:%02d_} gScore gMaxScore gTimeHours gTimeMinutes gTimeSeconds)&lt;br /&gt;
	)&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can move the lines around but I recommend keeping the clock to the right unless you&amp;#039;re using a unicode font, otherwise every time the clock updates anything to the right of the clock will shift slightly to the left or right due to the font character widths being different each time.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;NOTE:&amp;#039;&amp;#039;&amp;#039; There is a slight bug worth noting, which doesn&amp;#039;t impair the operation but is visually kind of jarring. When the seconds counter reaches 59 it does not go directly back to 0. It first updates to 60 and then suddenly within a split-second reverts to zero and the minute counter updates. The same thing happens with the minute counter reaches 60. I&amp;#039;m not sure of the workaround. If anyone else can figure out a way to fix this little glitch please update my code!&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting]]&lt;br /&gt;
[[Category:Syntax]]&lt;br /&gt;
[[Category:Examples]]&lt;/div&gt;</summary>
		<author><name>Kawa</name></author>
	</entry>
</feed>