{"id":139,"date":"2012-04-24T16:50:25","date_gmt":"2012-04-24T14:50:25","guid":{"rendered":"https:\/\/herr-rau.de\/blogs\/inform\/?p=139"},"modified":"2012-04-28T11:11:47","modified_gmt":"2012-04-28T09:11:47","slug":"kapitel-5-das-standardverhalten-aendern","status":"publish","type":"post","link":"https:\/\/herr-rau.de\/blogs\/inform\/?p=139","title":{"rendered":"Kapitel 5: Das Standardverhalten \u00e4ndern"},"content":{"rendered":"<p>Wenn der Spieler einen Befehl eingibt, f\u00fchrt das (nach der \u00dcbersetzung durch einen Parser) zum Aufrufen einer oder mehrerer &#8220;Regeln&#8221;. Diese Regeln regeln das Standardverhalten in der Welt: Dinge, die sich in Reichweite befinden, kann man nehmen, wenn sie tragbar sind; sonst nicht. Essbare Dinge, die man mit sich f\u00fchrt, kann man essen; danach sind sie weg. Versucht man etwas zu essen, das nicht essbar ist, f\u00fchren die Regeln zu einer entsprechenden Ausgabe an die Konsole &#8211; &#8220;You can&#8217;t eat that&#8221; oder so \u00e4hnlich. Und wenn man von einem Raum aus in eine bestimmte Himmelsrichtung geht, entscheiden die Regeln dar\u00fcber, was geschieht &#8211; in der Regel kommt man an einen neuen Ort, wenn es den in dieser Himmelsrichtung gibt; ansonsten kriegt man die lapidare Meldung, dass das nicht geht.<\/p>\n<p>Wenn man interessante Geschichten haben m\u00f6chte und mit der Spielwelt auf interessante Weise interagieren m\u00f6chte, muss man dieses Standardverhalten \u00e4ndern. Man kann einen Weg zum Beispiel nur dann gehen, wenn bestimmte Bedingungen erf\u00fcllt sind.<\/p>\n<p>Mit selbst geschriebenen Regeln \u00e4ndert man das Verhalten der Welt. Am h\u00e4ufigsten sind das Instead-Regeln. Eine Instead-Regel wird, etwas vereinfacht gesagt, statt der eigentlich vorgesehenen Regeln angewendet. Hier ein paar Anwendungsbeispiele.<\/p>\n<h3>Hier kommst du nicht vorbei<\/h3>\n<p>H\u00e4ufig m\u00f6chte man, dass ein bestimmter Weg erst dann m\u00f6glich wird, wenn bestimmte Bedingungen erf\u00fcllt sind. Unser Wolf soll erst zu den Gei\u00dflein kommen k\u00f6nnen, wenn er die Kreide gefressen hat und das wei\u00dfe Kapuzenshirt tr\u00e4gt.<\/p>\n<p>Allgemein:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">Instead of going west from the Entrance Area:\r\n\tSay &quot;You can't go there.&quot;<\/pre>\n<p>Das verbietet das Gehen unter allen Umst\u00e4nden. Das ist zu streng:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">Instead of going west from the Entrance Area:\r\n\tIf the player is wearing the white hoodie:\r\n\t\tContinue the action;\r\n\t\t&#x5B;regul\u00e4r weitermachen, also den Spieler bewegen]\r\n\tOtherwise:\r\n\t\tSay &quot;You can't go through there. From inside, you hear voices shouting: 'No, you're not our mother. Our mother has got white skin.'&quot;<\/pre>\n<p>Bei der Syntax muss man eigentlich nur beachten, dass jede Zeile mit einem Strichpunkt (nach einer Anweisung) oder Doppelpunkt (nach einer Kontrollstrukur) endet; ein Punkt kommt erst ganz am Schluss. Punkte innerhalb von Anf\u00fchrungszeichen gelten dabei nur als solche, wenn sie ganz am Schluss des Strings stehen.<\/p>\n<p>Neben &#8220;wear&#8221; (im Sinne von: an haben) kennt Inform 7 unter anderem noch &#8220;carry&#8221; (in der Hand tragen), &#8220;have&#8221; (mit sich f\u00fchren, in der Hand oder im Rucksack), &#8220;contain&#8221; (enthalten). Letzteres braucht man zum Beispiel bei &#8220;if the box contains the diamond&#8221;.<\/p>\n<p>Allerdings muss der Wolf ja <em>zwei<\/em> Bedingungen erf\u00fcllen, mit jeweils unterschiedlicher Folge. Das geht zum Beispiel mit verschachtelten bedingten Anweisungen:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">Instead of going west from the Entrance Area:\r\n\tIf the player is wearing the white hoodie:\r\n\t\tIf the voice of the player is low:\r\n\t\t\tSay &quot;You can't go through there. &#x5B;line break]From inside, you hear voices shouting: 'No, you don't sound like our mother.'&quot;; &#x5B;Strichpunkt nicht vergessen]\r\n\t\tOtherwise:\r\n\t\t\tContinue the action;\r\n\t\t\t&#x5B;regul\u00e4r weitermachen, also den Spieler bewegen]\r\n\tOtherwise:\r\n\t\tSay &quot;You can't go through there. &#x5B;line break]From inside, you hear voices shouting: 'No, you're not our mother. Our mothers has got white skin.'&quot;<\/pre>\n<p>Jetzt klappt das auch mit dem Wolf und unser Spiel ist fast fertig. Wir m\u00fcssen dem Wolf nur noch die M\u00f6glichkeit geben, seine Stimme zu erh\u00f6hen. \u00c4nderungen bei den Variablenwerten macht man mit dem Schl\u00fcsselwort <code>now<\/code>:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">Instead of eating the piece of chalk:\r\n\tNow the voice of the player is high;\r\n\tSay &quot;You feel a bit funny.&quot;;\r\n\tRemove the chalk from play.\r\n<\/pre>\n<p>Statt der letzten beiden Zeilen h\u00e4tte man auch <code>Continue the action.<\/code> schreiben k\u00f6nnen. Dann w\u00e4re die Kreide auch weg und die Standardantwort w\u00fcrde ausgedruckt werden.<\/p>\n<h3>Auftauchende Gegenst\u00e4nde<\/h3>\n<p>H\u00e4ufig m\u00f6chte man auch, dass Gegenst\u00e4nde erst unter bestimmten Bedingungen auftauchen, oder dass sie verschwinden. Das geht so:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">Instead of inserting &#x5B;something] into the well:\r\n\tRemove the noun from play;\r\n\tIf the noun is the ball:\r\n\t\tNow the frog is in the location of the player;\r\n\t\tSay &quot;A frog appears next to you.&quot;;\r\n\tOtherwise:\r\n\t\tSay &quot;You listen to the &#x5B;noun] going down. And then the &#x5B;noun] is gone.&quot;<\/pre>\n<p>Dabei steht [something] f\u00fcr: ein sichtbares und erreichbares Objekt der Klasse <code>thing<\/code> (oder Unterklassen davon). Wenn es bei der Regel nur um ein konkretes Objekt geht, nimmt man einfach dessen Bezeichner.<br \/>\nAnsonsten kann man noch [somebody] f\u00fcr Personen oder Tiere nehmen und [somewhere] f\u00fcr eine beliebige Himmelsrichtung.<\/p>\n<h3>Mit Personen reden<\/h3>\n<p>[Kommt sp\u00e4ter mal.]<\/p>\n<p>Bislang lautet der vollst\u00e4ndige Quellcode so:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">\r\n&quot;The Wolf and the Seven Kids&quot; by Moritz.\r\n\r\nThe Wolf Cave is a room. &quot;Here is your home. You got nearly everything in this cave that you need to invade the seven little kids. Light comes in from the west.&quot; West of the Wolf Cave is the Forest.\r\n\r\nThe Forest is a room. &quot;This place is very large and it is dark here. You can go north, east, south and west. You can hear birds singing.&quot; South of the Forest is the Marketplace. West of the Forest is the Entrance Area. North of the Forest is the River.\r\n\r\nThe River is a room. &quot;Here is a place where you can relax. Every time you did hard work, you can lie down next to the river and chill. A road leads south to a forest.&quot;\r\n\r\nThe Marketplace is a room. &quot;You should not stay here for too long, because the mother of the kids is often here to buy some food. If she sees you, she will bump the shit out of you. In the north, you can see the trees of the forest.&quot;\r\n\r\nThe Entrance Area is a room. &quot;Now you are in front of the house where the kids live. You have to go west to enter the house, or you can go east to the forest.&quot; West of the Entrance Area is the Kid House.\r\n\r\nThe Kid House is a room. &quot;A nice house. There is only one room, and the exit is west.&quot;\r\n\r\nThe red hoodie is a thing. It is wearable. It is in the Wolf Cave. The description is &quot;This is a red hoodie. A hoodie is a sweater with a hood.&quot;\r\n\r\nThe black hoodie is a thing. It is wearable. It is in the Wolf Cave. The description is &quot;This is a black hoodie. A hoodie is a sweater with a hood.&quot;\r\n\r\nThe white hoodie is a thing. It is wearable. It is in the Wolf Cave. The description is &quot;This is a white hoodie. A hoodie is a sweater with a hood.&quot;\r\n\r\nThe piece of chalk is a thing. It is in the Marketplace. It is edible. The description is &quot;Here is some chalk. You can use it, to write on a blackboard. If you eat it, your voice will get temporarily high and female.&quot;\r\n\r\nThe dripping cave ceiling is scenery in the Wolf Cave. The description is &quot;There are drops at the ceiling. The whole cave is very wet and you can hear the drops hitting the ground.&quot;\r\n\r\nThe trees are scenery in the Forest. The description is &quot;Lots of trees, some old, some new. Some have hearts cut into them.&quot; Understand &quot;tree&quot; as the trees.\r\n\r\nThe birds are scenery in the Forest. The description is &quot;Small bodies that hop from tree to tree.&quot;\r\n\r\nA goat-kid is a kind of thing. It is always edible. The description usually is &quot;A poor, helpless little kid. Baaa-ahh.&quot; The indefinite article is &quot;the&quot;.\r\n\r\nThe first kid, the second kid, the third kid, the fourth kid, the fifth kid, the sixth kid and the seventh kid are goat-kids in the Kid House.\r\n\r\nPitch is a kind of value. The pitches are high, middle and low.\r\nThe player has a pitch called voice. The voice of the player is low.\r\n\r\nInstead of going west from the Entrance Area:\r\n\tIf the player is wearing the white hoodie:\r\n\t\tIf the voice of the player is low:\r\n\t\t\tSay &quot;You can't go through there. From inside, you hear voices shouting: 'No, you don't sound like our mother.'&quot;; &#x5B;Strichpunkt nicht vergessen]\r\n\t\tOtherwise:\r\n\t\t\tContinue the action;\r\n\t\t\t&#x5B;regul\u00e4r weitermachen, also den Spieler bewegen]\r\n\tOtherwise:\r\n\t\tSay &quot;You can't go through there. From inside, you hear voices shouting: 'No, you're not our mother. Our mother has got white skin.'&quot;\r\n\r\nInstead of eating the piece of chalk:\r\n\tNow the voice of the player is high;\r\n\tSay &quot;You feel a bit funny.&quot;;\r\n\tRemove the chalk from play.\r\n<\/pre>\n<hr \/>\n<h3>Anhang: Weitere Regeln.<\/h3>\n<p>Die meisten Regeln sind schon fest eingebaut. Man muss sie nicht kennen, man muss nicht einmal wissen, welche es gibt, aber f\u00fcr das sp\u00e4tere Eingreifen in die feste Regelwelt ist etwas Hintergrundwissen n\u00fctzlich.<br \/>\nEs gibt unter anderem Check-, Carry-Out- und Report-Regeln. Sie werden hier f\u00fcr die Aktion <em>etwas essen<\/em> vorgestellt.<\/p>\n<p><strong>Check-Regel: Vor dem Ausf\u00fchren der Aktion<\/strong><\/p>\n<p>Die Check-Regel zu einer Aktion bestimmt, ob die Aktion \u00fcberhaupt ausgef\u00fchrt werden kann. Essen kann man nur Essbares, das schreibt man in Inform so:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">Check an actor eating (this is the can\u2019t eat unless edible rule):\r\n\tif the noun is not a thing or the noun is not edible,\r\n\t\tstop the action with library message eating action number 1 for the noun.\r\n<\/pre>\n<p>Wenn die Check-Regel bestanden wird, geht die Aktion weiter an die n\u00e4chsten Regeln:<\/p>\n<p><strong>Carry-Out-Regel: Das Ausf\u00fchren der Aktion.<\/strong><\/p>\n<p>Die Carry-Out-Regel zu einer Aktion bestimmt, was durch das Ausf\u00fchren der Aktion in der Modell-Welt ver\u00e4ndert wird. Gegessene Objekte verschwinden:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">Carry out an actor eating (this is the standard eating rule):\r\n\tremove the noun from play.<\/pre>\n<p>Danach geht die Aktion weiter an die n\u00e4chsten Regeln:<\/p>\n<p><strong>Report-Regel: Textausgabe nach der ausgef\u00fchrten Aktion.<\/strong><\/p>\n<p>Die Report-Regel zu einer Aktion bestimmt, was nach der Ausf\u00fchrung als Text ausgegeben werden soll.<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">Report an actor eating (this is the standard report eating rule):\r\n\tif the actor is the player, issue library message eating action number 2 for the noun;\r\n\t\totherwise issue actor-based library message eating action number 3 for the noun.\r\n<\/pre>\n<p>Check-, Carry-Out- und Report-Regeln schreibt man selber nur dann, wenn man neue Aktionen erfindet, die von den Inform-Standardregeln nicht vorgesehen sind.<\/p>\n<hr \/>\n<p>Au\u00dferdem gibt es unter anderem noch Regeln vom Typ &#8220;When&#8221; und &#8220;Every turn&#8221;:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">\r\nWhen play begins:\r\n\tSay &quot;Welcome to my game.&quot;\r\n\r\nEvery turn when the player is carrying the piano:\r\n\tSay &quot;Uuuuh. That's heavy.&quot;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Wenn der Spieler einen Befehl eingibt, f\u00fchrt das (nach der \u00dcbersetzung durch einen Parser) zum Aufrufen einer oder mehrerer &#8220;Regeln&#8221;. Diese Regeln regeln das Standardverhalten in der Welt: Dinge, die sich in Reichweite befinden, kann man nehmen, wenn sie tragbar &hellip; <a href=\"https:\/\/herr-rau.de\/blogs\/inform\/?p=139\">Weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1305],"tags":[],"class_list":["post-139","post","type-post","status-publish","format-standard","hentry","category-schnellkurs-1"],"_links":{"self":[{"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=\/wp\/v2\/posts\/139","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=139"}],"version-history":[{"count":0,"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=\/wp\/v2\/posts\/139\/revisions"}],"wp:attachment":[{"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}