~ubuntu-branches/ubuntu/vivid/inform/vivid

« back to all changes in this revision

Viewing changes to include/info.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Christoph Nordholz
  • Date: 2008-05-26 22:09:44 UTC
  • mfrom: (2.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080526220944-ba7phz0d1k4vo7wx
Tags: 6.31.1+dfsg-1
* Remove a considerable number of files from the package
  due to unacceptable licensing terms.
* Repair library symlinks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
! Info.h - A Library Extention For Consultation And Conversation
2
 
! By Jesse Burneko
3
 
!
4
 
! Purpose:
5
 
! The idea for this library extention has been brewing around my mind
6
 
! for quite some time.  The idea is to allow Consult, Ask, Tell, and
7
 
! Answer to access a database of topic objects rathen than having to
8
 
! parse the information themselves.  As a mock up version of this
9
 
! library file I had taken Gareth Rees' Frobozzica.inf example, edited
10
 
! it to handle Tell and Answer as well as Ask, and then transformed it
11
 
! into an include file.  As inform has developed I began to suspect
12
 
! that there was a much simpler way of doing things.  This library file 
13
 
! is the fruit of my labor.
14
 
!
15
 
! Usage:
16
 
! 1) Create a Topics object to be the parent object of all topics.
17
 
! 2) Create a series of topic objects.  The only requirements being that
18
 
!    they are a child of the Topics object, inherit from the
19
 
!    Topic class, provide the name and/or parse_name property for
20
 
!    identification in the usual way.
21
 
! 3) In the usual manner trap the Consult, Ask, Tell, and/or Answer
22
 
!    action in the before or life routine of the target object.  The topic
23
 
!    being refered to will be held in the second variable.
24
 
!
25
 
! Example:
26
 
!
27
 
! Object Topics;
28
 
!
29
 
! Topic -> Virginia_Woolf
30
 
!   with   name "virgina" "woolf",
31
 
!
32
 
! Topic -> Orlando
33
 
!   with   name "orlando" "novel" "book",
34
 
!
35
 
! Object Encyclopedia "Encyclopedia Of English Literature",
36
 
!   with   name "encyclopedia" "of" "english" "literature" "book",
37
 
!   before
38
 
!   [;
39
 
!      Consult:
40
 
!        switch(second)
41
 
!        {
42
 
!         Virginia_Woolf:
43
 
!            "~Woolf, Virginia (1182-1941), English novelist and
44
 
!            essayist.  The daughter of Sir Leslie Stephen, she
45
 
!            married the critic Leonard Sidney Woolf (1880-1969) and
46
 
!            they established the Hogarth Press (1917).  Novels using
47
 
!            stream of consciousness, such as Mrs. Dalloway (1925), To
48
 
!            the Lighthouse (1927) and The Waves (1931), concern her
49
 
!            characters' thoughs and feelings about common
50
 
!            experiences.  Some of her brilliant criticism was
51
 
!            published in The Common Reader (1925).  Subject to fits
52
 
!            of mental instability, she finally drowned herself.~";
53
 
!         Orlando:
54
 
!            "~A novel written in 1928 by Virgina Woolf outlining the
55
 
!            unual life of Orlando, an individual who lives for 400
56
 
!            years and is at one time male and another time female.
57
 
!            She also: Woolf, Virgina.~";
58
 
!         }
59
 
!   ];
60
 
!
61
 
! Note: Topics created need not initially be a child of the Topics
62
 
! object.  This allows for topics to begin out of scope and then as
63
 
! the player gains more information topics can be moved in and out of
64
 
! the Topics object at will.
65
 
 
66
 
[ TopicScope;
67
 
    switch(scope_stage)
68
 
    {
69
 
     1: rfalse;
70
 
     2: ScopeWithin(Topics);
71
 
        rtrue;
72
 
     3: "Error: Parsing should have matched previous grammar line.";
73
 
    }
74
 
];
75
 
 
76
 
Class   Topic
77
 
 with   short_name "that",
78
 
 has    proper;
79
 
 
80
 
Extend 'look' first
81
 
    *                                   -> Look
82
 
    * 'up' scope = TopicScope 'in' noun -> Consult reverse;
83
 
 
84
 
Extend 'consult' first
85
 
    * noun 'about' scope = TopicScope   -> Consult;
86
 
 
87
 
Extend 'ask' first
88
 
    * creature 'about' scope = TopicScope -> Ask;
89
 
 
90
 
Extend 'tell' first
91
 
    * creature 'about' scope = TopicScope -> Tell;
92
 
 
93
 
Extend 'answer' first
94
 
    * scope = TopicScope 'to' creature  -> Answer;
95
 
 
96