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

« back to all changes in this revision

Viewing changes to include/whowhat.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
 
!
2
 
! WhoWhat.H - Modified from WhatIs.H by A.C. Murie, by David A. Cornelson
3
 
!
4
 
! Note: I felt I abused it enough so that I would call it another name and add different
5
 
!       instructions. WhatIs.H ambiguously answered who and what questions and I wanted
6
 
!       them to be answered appropriately. So, I 'fixed' it.
7
 
!
8
 
! USAGE
9
 
!
10
 
! Include this file after "parser.h".
11
 
!
12
 
! Add the attribute 'queryable' to your object to allow for WHO am/is/are or WHAT is/am/are
13
 
! queries.
14
 
!
15
 
! Add the whatisit property with a string or function to describe what the object is.
16
 
!
17
 
! Add whoisit property to describe who the object is.
18
 
!
19
 
! Additionally, objects that do not appear in the game may be stored in the object
20
 
! 'QueryObjs'. They will be in scope all the time, and may be used for general game
21
 
! concepts
22
 
!
23
 
! As a final option, the actions WhoIs and WhatIs may be used in an objects 'before' code
24
 
! to print the whoisit or whatisit text.
25
 
!
26
 
! COMMENTS...
27
 
!
28
 
! If you intend to allow the player to change to different player objects using ChangePlayer,
29
 
! then make sure you write functions to determine which response is appropriate for whatisit
30
 
! and whoisit.
31
 
!
32
 
! The WhoIs routine check's if the object is animate before answering.
33
 
!
34
 
! I put smartass comments in for defaults.
35
 
!
36
 
 
37
 
Attribute queryable;
38
 
property  whoisit;
39
 
property  whatisit;
40
 
 
41
 
[ IsAmAre w; w=NextWord(); if (w=='is' or 'am' or 'are') return 0; return -1; ];
42
 
[ WhatIsWhatSub; "What is what?"; ];
43
 
[ QueryTopic; while( NextWordStopped() ~= -1 ) ; return 1; ];
44
 
[ WhatisQSub; "Good question."; ];
45
 
 
46
 
[ WhoAmISub;
47
 
    if( ZRegion(player.whoisit) == 2 or 3 )
48
 
    {
49
 
        PrintOrRun(player,whoisit);
50
 
        rtrue;
51
 
    }
52
 
    "A serious question, to which you have no answer.";
53
 
];
54
 
 
55
 
[ WhatAmISub;
56
 
    if( ZRegion(player.whatisit) == 2 or 3 )
57
 
    {
58
 
        PrintOrRun(player,whatisit);
59
 
        rtrue;
60
 
    }
61
 
    "You're probably human, but one can never tell these days.";
62
 
];
63
 
 
64
 
[ WhatIsSub;
65
 
    if( noun hasnt queryable ) "Good question.";
66
 
    if( ZRegion(noun.whatisit) == 2 or 3 )
67
 
    {
68
 
        PrintOrRun(noun,whatisit);
69
 
        rtrue;
70
 
    }
71
 
    "You're not sure.";
72
 
];
73
 
 
74
 
[ WhoIsSub;
75
 
        if( noun hasnt animate) "That's not a 'who', it's a 'what'!";
76
 
    if( noun hasnt queryable ) "Good question.";
77
 
    if( ZRegion(noun.whoisit) == 2 or 3 )
78
 
    {
79
 
        PrintOrRun(noun,whoisit);
80
 
        rtrue;
81
 
    }
82
 
    "You're not sure.";
83
 
];
84
 
 
85
 
[ QueryScope;
86
 
    if( scope_stage == 1 ) rfalse;
87
 
    if( scope_stage == 2 )
88
 
    {
89
 
        ScopeWithin( QueryObjs );
90
 
        rfalse;
91
 
    }
92
 
];
93
 
 
94
 
Object QueryObjs "Queryable objects";
95
 
 
96
 
verb meta "who"
97
 
           * IsAmAre                      -> WhatIsWhat
98
 
           * IsAmAre "I"                  -> WhoAmI
99
 
           * IsAmAre "I?"                 -> WhoAmI
100
 
           * IsAmAre "I" "?"              -> WhoAmI
101
 
           * IsAmAre scope=QueryScope     -> WhoIs
102
 
           * IsAmAre scope=QueryScope "?" -> WhoIs
103
 
           * QueryTopic                   -> WhatisQ;
104
 
 
105
 
verb meta "what" 
106
 
           * IsAmAre                      -> WhatIsWhat
107
 
           * IsAmAre "I"                  -> WhatAmI
108
 
           * IsAmAre "I?"                 -> WhatAmI
109
 
           * IsAmAre "I" "?"              -> WhatAmI
110
 
           * IsAmAre scope=QueryScope     -> WhatIs
111
 
           * IsAmAre scope=QueryScope "?" -> WhatIs
112
 
           * QueryTopic                   -> WhatisQ;