Inform

Z Wikipedii, wolnej encyklopedii

Inform jest językiem programowania i systemem projektowania fikcji interaktywnej (ang. Interactive Fiction) stworzonym w 1993 roku przez Grahama Nelsona.

Inform 6 (i jego poprzednie wersje) jest proceduralny i obiektowy.

W najnowszej wersji o numerze 7 (wydanej w 2006 roku, nazywanej również Natural Inform) Inform przybrał formę języka angielskiego, dzięki czemu zyskał dla niektórych na czytelności, naturalności i łatwości, ale stał się w pełni wyspecjalizowany. Wersja ta wciąż bazuje jednak na kompilatorze i bibliotekach wersji poprzedniej. Kod źródłowy napisany w Informie 7 jest tłumaczony na kod źródłowy Informa 6 i kompilowany w jego formacie. Dzięki temu nowa wersja zachowuje obustronną kompatybilność z Informem 6 i jego interpreterami.

Pisanie kodu[edytuj | edytuj kod]

Przykładowy kod napisany pod Informem 7:

"Hello World" by "I.F. Author"

The story headline is "An Interactive Example".

The Living Room is a room. "A comfortably furnished living room." The Kitchen is north of the Living Room. The Front Door is south of the Living Room. The Front Door is a closed locked door.

The insurance salesman is a man in the Living Room. The description is "An insurance salesman in a tacky polyester suit. He seems eager to speak to you." Understand "man" as the insurance salesman.

A briefcase is carried by the insurance salesman. The description is "A slightly worn, black briefcase." Understand "case" as the briefcase.

The insurance paperwork is in the briefcase. The description is "Page after page of small legalese." Understand "papers" or "documents" or "forms" as the paperwork.

Instead of listening to the insurance salesman:

    say "The salesman bores you with a discussion of life insurance policies. From his briefcase he pulls some paperwork which he hands to you.";
    now the player carries the insurance paperwork.

W wersjach do Inform 6 język wyglądał bardziej programistycznie:

 Constant Story "Hello World";
 Constant Headline "^An Interactive Example^";
 
 Include "Parser";
 Include "VerbLib";
 
 [ Initialise;
     location = Living_Room;
     "Hello World";
 ];
 
 Object Kitchen "Kitchen";
 Object Front_Door "Front Door";
 
 Object Living_Room "Living Room"
     with
         description "A comfortably furnished living room.",
         n_to Kitchen,
         s_to Front_Door,
     has light;
 
 Object -> Salesman "insurance salesman"
     with
         name 'insurance' 'salesman' 'man',
         description "An insurance salesman in a tacky polyester 
               suit.  He seems eager to speak to you.",
         before [;
             Listen:
                 move Insurance_Paperwork to player;
                 "The salesman bores you with a discussion
                  of life insurance policies.  From his
                  briefcase he pulls some paperwork which he
                  hands to you.";
         ],
     has animate;
 
 Object -> -> Briefcase "briefcase"
     with
         name 'briefcase' 'case',
         description "A slightly worn, black briefcase.",
     has container;
 
 Object -> -> -> Insurance_Paperwork "insurance paperwork"
     with
         name 'paperwork' 'papers' 'insurance' 'documents' 'forms',
         description "Page after page of small legalese.";
 
 Include "Grammar";

Linki zewnętrzne[edytuj | edytuj kod]

  • Inform 7 – Oficjalna strona internetowa
  • Inform 6 – Oficjalna strona internetowa