Inform Examples tailored for Dialog

This is the first example in alphabetical order of inform 7’s examples, tailored for Dialog. I’m planning to do more of those, mainly to get rid of bugs in my german translation. They will be published in my blog, but if someone cares I can put them in here, too.

%% Beispiel Nr. 101 der Inform Dokumentation
%% Erschaffe eine Region (von Räumen), die den Zugang des Spielers blockieren, es sei denn er trägt den Pass bei sich. 

(current player #player)
(#player is #in #winding_street)

(room *(film-set $))

#winding_street
(room *)
(name *)    sich windend(e) Straße
(room header *) Sich windende Straße
(from * go #east to #duck_pond)
(from * go #north to #sloping_street)
(* is feminin)

#sloping_street
(room *)
(name *)    Straße
(room header *) Ansteigende Straße
(from * go #south to #winding_street)
(from * go #southeast to #duck_pond)
(from * go #east to #stately_lawn)
(from * go #northeast to #stately_home)
(* is feminin)

#duck_pond
(film-set *)
(name *)    Ententeich(-s)
(room header *) Am Ententeich
(from * go #west to #winding_street)
(from * go #northwest to #sloping_street)
(* is maskulin)

#stately_lawn
(film-set *)
(name *)    Rasenfläche
(room header *) Imposante Rasenfläche
(from * go #west to #sloping_street)
(from * go #north to #stately_home)
(* is feminin)

#stately_home
(film-set *)
(name *)    Haus(-es)
(room header *) Imposantes Haus
(from * go #southwest to #sloping_street)
(from * go #south to #stately_lawn)
(* is neutrum)

#garbage_can
(name *)    Mülltonne
(dict *)    tonne mülltonne
(container *)
(item *)
(* is feminin)
(* is #in #sloping_street)
(* is handled)
(fine where it is *)

#pass
(item *)
(name *)    Pass(-es)
(dict *)    pass
(* is #in #garbage_can)
(* is maskulin)
(* is handled)

(prevent [leave $Room $Dir])
    (from $Room go $Dir to $Dest)
    (film-set $Dest)
    (current player $Player)
    ~(#pass is #heldby $Player)
    Ein bulliger Studioangestellter blockiert deinen Weg und überzeugt dich, dass du dich besser woanders herumtreibst.

(after [leave $Room $Dir])
    (from $Room go $Dir to $Dest)
    (film-set $Dest)
    (par)
    (space 5)
    (bold)\*\*\* Erfolg! Du bist nun am Set von "Prouder and More Prejudiced" \*\*\*(unstyle)
    (game over)

%% Testen: "o / n / nimm pass / s / o". 
7 Likes

Great! I‘m planing to give your German conversion a shot as soon as I worked my way through the Dialog-tutorials. Keep up the great work for the German IF-writer-community.

Jens

The second example, Aarp-Gnosis. This was a hard one …

%% Beispiel Nr. 335 der Inform Dokumentation
%% Nehmen wir an, wir hätten eine Ezyklopädie in unserem Spiel. 
%% Der Spieler kann das vollständige Werk mitnehmen, aber auch
%% nur Teile davon; legt er einen Teil davon auf denselben Platz
%% wie der Rest der Enzyklopädie, wird diese automatisch komplettiert;
%% Ist die Anzahl der Teile der Enzyklopädie kleiner als 2, wird diese
%% entfernt und falls sich wieder mindestens 2 Exemplare am gleichen
%% Platz befinden, dort wieder verortet.

(current player #player)
(#player is #in #library)

#library
(room *)
(name *)    Boise Memorial Bibliothek
(dict *)    bibliothek
(* is feminin)
(look *)
        Eine Betonschachtel, ungefähr zweieinhalb mal viereinhalb Meter, 
        die das letzte bißchen Unterhaltung in dieser post-nuklearen 
        Notunterkunft beherbergt. Jemand mit makabrem Humor hat einen
        "LESE!"-Sticker an die Tür geheftet, als ob es noch andere Dinge
        zu tun gäbe, während man auf das Sinken der Geiger-Zähler wartet.

#shelf
(supporter *)
(item *)
(name *)    Regal(-s)
(dict *)    regal
(is fine where it is *)
(* is neutrum)
(* is handled)
(descr *)
    	Ein abgenutztes Regal lehnt an der Südwand.
(* is #in #library)

(item $Obj)     *(collective $Obj)

(item $Obj)     *(volume $Obj)
       
($Obj is handled)       *(volume $Obj)
($Obj is maskulin)      *(volume $Obj)
(proper $Obj)           *(volume $Obj)

($ fits $)      (fail)

#encyclopedia
(name *)        
        (collect $Obj)
                *(volume $Obj)
                ($Obj fits *)
                ($Obj is #partof *)
        (into $List)
        (collect $Missing)
                *(volume $Missing)
                ($Missing fits *)
                ~($Missing is #partof *)
        (into $MissingList)
        (length of $List into $Here)
        (length of $MissingList into $Miss)
        (if) ($Miss = 0) (then)
                komplett(es)
        (endif)
        Werk der New Idahoan Enzyklopädie mit (dem $List)
        (if) ($Miss > 0) (then)
                \(ohne (der $MissingList)\)
        (endif)              

(dict *)        werk new idahoan lexikon 
(fsyn *)        enzyklopädie 
(collective *)
(* is neutrum)
(* is #on #shelf)
(* is handled)

(descr (collective $Obj))

(on every tick)
        *(collective $Obj)
        (collect $PartVol)
                *(volume $PartVol)
                ($PartVol has parent $Obj)
        (into $PartList)
        (length of $PartList into $Part)
        (if) ($Part = 1) (then)
                (nth $PartList 1 $Element)
                ($Obj has parent $Parent)
                (move $Element to $Parent)
                (now) ($Obj is nowhere)
                (locate new position of $Obj)
        (elseif) ($Part = 0) (then)
                (now) ($Obj is nowhere)
                (locate new position of $Obj)
        (endif)

(locate new position of $Collect)
        *(volume $Vol)
        ($Vol fits $Collect)
        ($Vol has parent $NewPar)
        (collect $Single)
                *(volume $Single)
                ($Single has parent $NewPar)
        (into $SameList)
        (length of $SameList into $Same)
        ($Same > 1)
        (move $Collect to $NewPar)
        (exhaust) {
                *(volume $NewVol)
                ($NewVol fits $Collect)
                ($NewVol has parent $NewPar)
                (now) ($NewVol is #partof $Collect)
        }
           
(move $Item to $Dest)
        {
                (supporter $Dest)
                (now) ($Item is #on $Dest)
        (or)
                (current player $Dest)
                (now) ($Item is #heldby $Dest)
        (or)
                (now) ($Item is #in $Dest)
        }

#a-aalto
(volume *)
(name *)        Teil(-s) A-Aalto
(dict *)        teil a-aalto
(* is #partof #encyclopedia)
(* fits #encyclopedia)

#aam-aardvark
(volume *)
(name *)        Teil(-s) AAM-Aardvark
(dict *)        teil aam-aardvark
(* is #partof #encyclopedia)
(* fits #encyclopedia)

#aarhus-aaron
(volume *)
(name *)        Teil(-s) Aarhus-Aaron
(dict *)        teil aarhus-aaron
(* is #partof #encyclopedia)
(* fits #encyclopedia)

#aarp-gnosis
(volume *)
(name *)        Teil(-s) AARP-Gnosis
(dict *)        teil aarp-gnosis
(* is #partof #encyclopedia)
(* fits #encyclopedia)

#gnu-zygote
(volume *)
(name *)        Teil(-s) Gnu-Zygote
(dict *)        teil gnu-zygote
(* is #partof #encyclopedia)
(* fits #encyclopedia)

(before [take/drop/remove $Obj])
        (volume $Obj)
        ($Obj has parent $Parent)
        {
                ($Obj is #partof $Parent)
                ($Parent has parent $Grandparent)
                (now) ($Obj is #in $Grandparent)
        (or)
                (now) ($Obj is #in $Parent)
        }

%% Testen: "nimm aarhus-aaron / schau auf regal / i / nimm aam-aardvark / schau auf regal / nimm gnu-zygote / schau auf regal / nimm aarp-gnosis / schau auf regal / i / leg werk ab / schau / nimm werk / nimm a-aalto / i"

2 Likes

The third example, “Access”


%% Beispiel Nr. 338 der Inform Dokumentation
%% Es gibt eine extrem kniffelige Tür zu der der Schlüssel fehlt
%% Der Spieler kann sie passieren, wenn er den Hut trägt

(singleton *(room $))

(current player #player)
(#player is #in #standing_room)

#standing_room
(room *)
(name *)    stehend(er) Raum
(* is maskulin)
(from * go #north through #door to #room_of_walking_upside_down)

#room_of_walking_upside_down
(room *)
(name *)    verkehrt(er) Raum
(* is maskulin)
(from * go #south through #door to #standing_room)

#door
(door *)
(lockable *)
(name *)    extrem kniffelig(e) Tür
(dict *)    extrem kniffelig tür
(* is feminin)

#hat
(item *)
(wearable *)
(name *)    gepunktet(er) Hut(-es) der kaum wahrnehmbaren Grenzüberschreitung
(dict *)    gepunktet hut kaum wahrnehmbar grenzüberschreitung
(* is #heldby #player)
(* is maskulin)
(singleton *)

(before [go $Dir])
    (#hat is #wornby #player)
    (just)

(#door blocks passage)
    (#hat is #wornby #player)
    (just) (fail)

%% Testen: "n / zieh hut an / n"

1 Like

The fourth Example, “Actaeon” it is:

%% Beispiel Nr. 302 der Inform Dokumentation
%% Nehmen wir an, wir möchten in der Lage sein, einem NPC 
%% zu folgen, wenn er sich auf der Karte bewegt. Der Trick
%% ist, dass wir ihn referieren müssen, obwohl er nicht in
%% Sichtweite ist.

(global variable (last location of artemis was $))

(proper *(room $))

(current player #player)
(#player is #in #corinth)

#artemis
(female actor *)
(name *)    Artemis
(dict *)    frau dame artemis
(proper *)
(appearance * $ $)
    Artemis ist hier und überlegt, wohin sie als nächstes 
    gehen soll.
(* is #in #corinth)

#corinth
(room *)    
(name *)    Corinth
(from * go #south to #mycenae)
(from * go #east to #athens)
(from * go #southeast to #epidaurus)

#athens
(room *)   
(name *)    Athen
(from * go #northwest to #thebes)
(from * go #west to #corinth)

#epidaurus
(room *)
(name *)    Epidaurus
(from * go #northwest to #corinth)
(from * go #west to #mycenae)

#mycenae
(room *)
(name *)    Mycenae
(from * go #north to #corinth)
(from * go #south to #argos)
(from * go #east to #epidaurus)
(from * go #west to #olympia)

#olympia
(room *)
(name *)    Olympia
(from * go #east to #mycenae)
(from * go #south to #pylos)

#argos
(room *)
(name *)    Argos
(from * go #north to #mycenae)
(from * go #south to #sparta)

#thebes
(room *)
(name *)    Thebes
(from * go #southeast to #athens)
(from * go #northwest to #delphi)

#pylos
(room *)
(name *)    Pylos
(from * go #north to #olympia)
(from * go #east to #sparta)

#sparta
(room *)
(name *)    Sparta
(from * go #north to #argos)
(from * go #west to #pylos)

#delphi
(room *)
(name *)    Delphi
(from * go #southeast to #thebes)

(add #artemis to scope)

(on every tick)
    (#artemis is #in $Loc)
    (now) (last location of artemis was $Loc)
    (collect $Exit)
        *(from $Loc go $Exit to $)
    (into $ExitList)
    (randomly select $Chosen from $ExitList)
    (let #artemis go $Chosen)

(describe action [follow $Obj])
	(dem $Obj) folgen

(understand infinitive [folgen/verfolgen] as Verb [folg])

(understand [folg/verfolg | $Words] as [follow $Obj])
    *(understand $Words as single object $Obj)
    (animate $Obj)

(refuse [follow $NPC])
    (current room $Room)
    (just)
    {
        ($NPC is #in $Room)
        (Der $NPC) steht direkt vor dir.
    (or)
        ~(last location of artemis was $Room)
        Du bist ahnungslos, wo sich (der $NPC) 
        gerade befindet.
    }
    
(perform [follow $NPC])
    (current room $Room)
    (#artemis is #in $NextRoom)
    (from $Room go $Dir to $NextRoom)
    (try [go $Dir])

%% Testen: "z / folge artemis / g / g"
1 Like

And the fifth: “Actor’s studio”, a video camera which lets the player record actions …

%% Beispiel Nr. 221 der Inform Dokumentation
%% Eine Videokamera, die Ereignisse aufzeichnet und sie dann
%% mit einem Zeitstempel wieder abspielt.

(global variable (videostream []))
(global variable (time $))
~(memory is empty)

(global variable (camera mode $))

(setting $) (fail)

#idle 
(name *) Ruhemodus 
(dict *) ruhemodus ruhe
(setting *)
(* is #partof #camera)

#recording 
(name *) Aufnahme 
(dict *) aufnahme
(setting *)
(* is #partof #camera)

#replaying 
(name *) Wiedergabe 
(dict *) wiedergabe
(setting *)
(* is #partof #camera)

(style class @score)
	width: 20ch;
	float: right;

(intro)
    (now) (time 542)
    (now) (camera mode #idle)
    (try [look])
    
(redraw status bar)
	(status bar @status) {
        (time headline)
        (location headline)
	}

(time headline)
    (div @score) {
        (time $Time)
        Zeit: 
        (say time $Time)
    }

(say time $A)
    ($A divided by 60 into $C)
    ($A modulo 60 into $D)
    $C:(no space)
    (if) ($D < 10) (then)
        0(no space)
    (endif)
    $D

(after $Action)
    (camera mode #recording)
    ~($Action = [wait])
    ~($Action = [$ #camera $ $])
    (videostream $Video)
    (length of $Video into $Len)
    (if) ($Len < 48) (then)
        (time $T)
        (append [$T | [$Action]] $Video $New)
        (now) (videostream $New)
    (else)
        (now) (camera mode #idle)
        Der Speicher der Videokamera ist voll 
        und sie schaltet in den Ruhemodus.
    (endif)

(on every tick)
    (time $A)
    ($A plus 1 into $B)
    (now) (time $B)

(on every tick)
    (camera mode #replaying)
    (if) ~(memory is empty) (then)
        (videostream $Video)
        (reverse $Video $List)
        (now) (memory is empty)
        (report actions from list $List)
    (else)
        Du siehst nur Rauschen auf der Videokamera.
    (endif)

(report actions from list [$Action $Time | $Tail])
    (line)Um (say time $Time) Uhr hat die Kamera aufgezeichnet, als du dabei warst,
    (describe infinitive action $Action).
	(report actions from list $Tail)

(current player #player)
(#player is #in #actor_studio)

#actor_studio
(room *)
(name *)    Filmstudio(-s)
(* is maskulin)

#lucas
(male actor *)
(name *)    Lucas
(proper *)
(dict *)    lucas mann typ
(* is #in #actor_studio)
(appearance #lucas $ $)
    Lucas ist hier.

(prevent [tell #lucas to take $Obj])
    {
        ($Obj is #heldby $NPC)
        (Der $NPC) (hat $NPC) (den $Obj) schon.
    (or)
        ~(item $Obj)
        (Der $NPC) (kann $NPC) (den $Obj) nicht nehmen.
    }

(perform [tell #lucas to take $Obj])
    (let #lucas take $Obj)

(perform [tell #lucas to eat $Obj])
    (let #lucas eat $Obj)

(let $NPC eat $Obj)
    (if) ~(edible $Obj) (then)
        (fail)
    (endif)
    (if) (player can see $Obj) (then)
        (if) ~($Obj is #heldby $NPC) (then)
            \(Erst nimmt Lucas (den $Obj)\)(line)
            (now) ($Obj is #heldby $NPC)
        (endif)
		(narrate $NPC eating $Obj)
	(endif)
	(now) ($Obj is nowhere)

(narrate $NPC eating $Obj)
	(Der $NPC) (isst $NPC) (den $Obj).

#croissant
(item *)
(name *)    Croissant(-s)
(dict *)    croissant
(edible *)
(* is handled)
(* is neutrum)
(* is #in #actor_studio)

#camera
(item *)
(name *)    Videokamera
(dict *)    video kamera videokamera
(descr *)
        Die Videokamera ist momentan auf 
        (camera mode $Mode)
        (name $Mode) eingestellt.
(* is feminin)
(* is #in #actor_studio)
(* is handled)

(describe action [set $Obj to $Setting])
	(den $Obj) auf (name $Setting) einstellen

(understand infinitive [einstellen/stellen] as Verb [stell])

(unlikely [put $Obj #on $Dest])
	($Obj = #camera)

(understand [stell | $Words] as [set $Obj to $Setting])
    *(split $Words by [auf] into $Left and $Right)
    *(understand $Left as single object $Obj)
    *(understand $Right as single object $Setting)

(understand [stell ein | $Words] as [set $Obj to $Setting])
    *(split $Words by [auf] into $Left and $Right)
    *(understand $Left as single object $Obj)
    *(understand $Right as single object $Setting)

(refuse [set $Obj to $Setting])
    (just)
    ~($Setting is one of [#idle #recording #replaying])
    Das ist keine gültige Einstellung für (den $Obj).

(perform [set $Obj to $Setting])
    (now) (camera mode $Setting)
    Die Videokamera ist nun auf (name $Setting) eingestellt.
    (if) ($Setting is one of [#recording #idle]) (then)
        (now) ~(memory is empty)
    (endif)

%% Testen: "stell kamera auf aufnahme / x lucas / winke / lucas, iss croissant / stell kamera auf wiedergabe / z"

1 Like

And the sixth: Age of Steam:

(intro)
	(now) (scenetime 0)
	(now) (time 539) %%08:59 Uhr
	(banner)
	(try [look])

(current player #player)
(#player is #in #station)

(global variable (time $))
(global variable (scenetime $))
(global variable (arrival $))

#station
(room *)
(name *)	Bahnstation
(look *)
		Der Halt "Eynforme" ist eine erhöhte Plattform, gesäumt von Dotterblumen, eine Bedarfshaltestelle mit einem Signal und einem Wassertank.
(* is feminin)

(on every tick in *)
    (scenetime $A)
    ($A plus 1 into $B)
    (now) (scenetime $B)
	(if) ($B = 3) (then)
		(now) (#flying_scotsman is #in *)
		(time $time) 
		(now) (arrival $time)
		Der Flying Scotsman zieht sich stampfend die Platform hinauf, umgeben von dichten Rauchschwaden.
	(elseif) ($B = 6) (then)
		(now) (#flying_scotsman is nowhere)
		 Der Flying Scotsman setzt sich wieder in Bewegung und nimmt nach dem Kreischen der gelösten Bremsen unglaublich schnell Fahrt auf, bis er schließlich hinter dem Hügel verschwindet. Alles ist plötzlich wieder still.
	(endif)

#flying_scotsman
(item *)
(name *)	Flying Scotsman
(dict *)	flying scotsman zug
(* is handled)
(* is maskulin)
(fine where it is *)

(appearance * in $)
		Der Flying Scotsman, der schnellste Zug der Welt, ist zum
		völligen Stillstand gekommen.

(instead of [enter *])
		Leider tankt der
		(arrival $time)
		(say time $time)
		Zug nur Wasser und nimmt niemand mit.

(on every tick)
    (time $A)
    ($A plus 1 into $B)
    (now) (time $B)

(say time $A)
    ($A divided by 60 into $C)
    ($A modulo 60 into $D)
    $C:(no space)
    (if) ($D < 10) (then)
        0(no space)
    (endif)
    $D

%% Testen: "z / z / z / steig in zug / z / z"
1 Like

7th: All Roads Lead to Mars
funny to implement …

%% Angenommen wir möchten es dem Spieler ermöglichen, sich frei in
%% jeglicher Richtung zu bewegen, aber gleichzeitig zu kontrollieren, 
%% in welcher Reihenfolge er die Räume besucht. Das Erzählen der 
%% Geschichte steht eher im Mittelpunkt, als die genaue Abbildung
%% einer Karte.

%% Hier wird die Problematik über eine Liste gelöst, in der die 
%% Verbindungen der Räume abgelegt werden, wenn diese noch nicht 
%% besucht wurden. Getestet wird außerdem, ob die Verbindung bereits
%% zwischen zwei anderen Räumen besteht.

(global variable (connector []))

($ is connected) 
	(fail)

(nextroom from $ is $)
	(fail)

(current player #player)
(#player is #in #open_plain)

#open_plain
(room *)
(name *)	weite(e) Ebene
(room header *)	Weite Ebene
(look *)
		Eine weite Ebene, offen in jeder Richtung.
(* is feminin)
(nextroom from * is #hilly_place)

#hilly_place
(room *)
(name *)	hügelig(er) Ort(-es)
(room header *)	Hügeliger Ort
(look *)
		Das flache Grasland wird hier zu einer hügeligen Gegend, die
		dir aber gleichfalls alle Wege offen lässt.
(* is maskulin)
(nextroom from * is #stream)

%% (from * go $ to #stream)

#stream
(room *)
(name *)	Strom(-es)
(room header *)	Am Strom
(look *)
		Das ist der dritte Ort, den du heute besuchst und der Strom ist dir sehr willkommen. Wie erfrischend!
(* is maskulin)

(before [leave $Room $Dir])
	(nextroom from $Room is $NextRoom)
	~($NextRoom is visited)
	~(from $Room go $Dir to $)
	(connector $List)
	(append $List [[$Room $Dir $NextRoom]] $New)
	(now) (connector $New)
	(opposite of $Dir is $Opp)
	(append $New [[$NextRoom $Opp $Room]] $Reverse)
	(now) (connector $Reverse)

(from $Room go $Dir to $NextRoom)
	(connector $List)
	([$Room $Dir $NextRoom] is one of $List)

%% Testen mit "n / s / o / o". 
1 Like