//----------------------------------------------------------------------------------\\
//                               CLOAK OF DARKNESS                                  \\
//             A basic IF demonstration adventure by Roger Firth                    \\
//                                                                                  \\
//                   This PAWed implementation by 8bitAG.com                        \\
//----------------------------------------------------------------------------------\\


// Note: There are many ways you could implement the cloak's "darkness" in a PAWed game.
// This implementation checks if the cloak is worn when entering & exiting the bar.
// If it is, then it adjusts the PAW's dark/light flag (flag 0) accordingly.

// The hook can also be coded in many ways. In this version it has been coded as two objects,
// one to represent the empty hook and one for the hook with the cloak on it.
// The same effect cold have been achieved using flags and the checks ZERO and NOTZERO.

// This code uses some standard PAW system flags...
// Flag 0 - indicates light (zero) or dark (notzero)
// Flag 30 - holds the player's score
// Flag 31 - holds the vocab value of the parsed verb in a verb noun sentence
// In addition, the following flags have been defined...
// Flag 100 - denotes where the random message about the cloak has appeared
// Flag 200 - holds a counter tracking how much the sawdust message has been disturbed


DEFAULTS
{
    CHARSET: 1;
    INK: 9;
    PAPER: 0;
    FLASH: 0;
    BRIGHT: 0;
    INVERSE: 0;
    OVER: 0;
    BORDER: 0;
}

LOCATION 0 
{
    // Traditionally, location 0 is used by PAWs authors as the title page/game introduction
    "^^       {17}{1}CLOAK OF DARKNESS{17}{0}^         by Roger Firth^^    A Basic IF Demonstration^^ Implemented in Gilsoft's PAWs^          by 8bitAG^^";
}

LOCATION 1
{
    // Foyer of the Opera House
    "You are standing in a spacious hall, splendidly decorated in red and gold, with glittering chandeliers overhead. The entrance from the street is to the north, and there are doorways south and west.";
    CONNECTIONS {
      S TO 3
      W TO 2
   };
}

LOCATION 2
{
    // Cloakroom
    "The walls of this small room were clearly once lined with hooks, though now only one remains. The exit is a door to the east.";
    CONNECTIONS {
        E TO 1
    };
}

LOCATION 3
{
    // The Bar
    // When the bar is dark, PAW automatically substitutes the "darkness" message
    "The bar, much rougher than you'd have guessed after the opulence of the foyer to the north, is completely empty. There seems to be some sort of message scrawled in the sawdust on the floor.";
    CONNECTIONS {
        N TO 1
    };
}

VOCABULARY
{
    NOUN 2: "S", "SOUTH";
    PREPOSITION 2: "TO";
    CONJUNCTION 2: "AND", "THEN";
    PRONOUN 2: "IT", "THEM";
    NOUN 3: "E", "EAST";
    PREPOSITION 3: "FROM";
    NOUN 4: "W", "WEST";
    PREPOSITION 4: "IN";
    NOUN 5: "N", "NORTH";
    PREPOSITION 5: "OUT";
    NOUN 6: "NW";
    PREPOSITION 6: "THROU";
    NOUN 7: "SE";
    PREPOSITION 7: "OVER";
    NOUN 8: "SW";
    PREPOSITION 8: "UNDER";
    NOUN 9: "NE";
    PREPOSITION 9: "BY";
    VERB 10: "DESCE";
    NOUN 10: "D", "DOWN";
    PREPOSITION 10: "ON";
    VERB 11: "ASCEN";
    NOUN 11: "U", "UP";
    PREPOSITION 11: "OFF";
    PREPOSITION 12: "AT";
    PREPOSITION 13: "EXCEP";
    NOUN 14: "I", "INVEN";
    PREPOSITION 14: "NORMA";
    VERB 20: "GET", "TAKE";
    NOUN 20: "ALL", "LOT", "EVERY";
    VERB 21: "PUT", "DROP";
    VERB 22: "REMOV";
    VERB 23: "WEAR";
    VERB 24: "R", "REDES", "RE", "LOOK";
    VERB 25: "QUIT", "STOP";
    VERB 26: "SAVE";
    VERB 27: "LOAD";
    VERB 28: "RAMSA";
    VERB 29: "RAMLO";
    VERB 30: "SCORE";
    VERB 31: "EXAMI", "X", "EXAM", "EX";

    VERB 32: "HANG", "PLACE";
    VERB 33: "USE";
    VERB 34: "READ";
    VERB 35: "HELP", "CREDITS", "ABOUT";

    NOUN 30: "CLOAK", "VELVET";
    NOUN 31: "HOOK";
    NOUN 32: "FLOOR", "SAWDU", "DUST";
    NOUN 33: "MESSA", "WORDS";
    NOUN 34: "ME", "SELF";

    ADJECTIVE 130: "SMALL";

    ADVERB 140: "SLOWL";
}

OBJECT 0
{
    // Object 0 is considered a source of light by the PAWs interpreter
    // It has not been used in this adventure
    "";
    INITIALLYAT NOTCREATED;
    WORDS _ _;
    WEIGHT 1;
}

OBJECT 1
{
    "A velvet cloak";
    INITIALLYAT WORN;
    PROPERTY CLOTHING;
    WORDS CLOAK _;
    WEIGHT 1;
}

OBJECT 2
{
    "A small hook";
    INITIALLYAT 2;
    WORDS HOOK SMALL;
}

OBJECT 3
{
    "A hook (with a cloak hanging on it)";
    WORDS HOOK _;
}

MESSAGES
{
    0: "^^Hurrying through the rainswept November night, you're glad to see the bright lights of the Opera House. It's surprising that there aren't more people about but, hey, what do you expect in a cheap demo game...?^^";
    1: "You've only just arrived, and besides, the weather outside seems to be getting worse.";
    2: "A handsome cloak, of velvet trimmed with satin, and slightly spattered with raindrops. Its blackness is so deep that it almost seems to suck light from the room.";
    3: "It's just a small brass hook, ";
    4: "screwed to the wall.";
    5: "with a cloak hanging on it.";
    6: "This isn't the best place to leave a smart cloak lying around.";
    7: "Blundering around in the dark isn't a good idea!";
    8: "In the dark? You could easily disturb something!";
    9: "The message, neatly marked in the sawdust, reads...";
    10: "The message has been carelessly trampled, making it difficult to read. You can just distinguish the words...";
    11: "^{16}{6}You have lost!{16}{7}^";
    12: "^{16}{6}You have won!{16}{7}^";
    13: "As good-looking as ever.";
    14: "^The lights around you dim as you move close by.";
    15: "It is ";
    16: "hanging on the hook.";
    17: "You neatly hang the cloak on the hook.";
    18: "How?";
    19: "Now is not the time for that!";
    20: "There is a better place to leave the cloak than the floor.";
    21: "It is a neatly written message.";
    22: "The message has been scuffed slightly.";
    23: "The message has been trampled.";
    24: " It reads...";
    25: "The cloak is already hung up!";
    26: "http://www.firthworks.com/roger/cloak/";
    27: "Someone has written a message in the sawdust on the floor!";
}

SYSMESSAGES
{
    // System messages 0 to 60 are standard. 61+ are free for other use.
    0: "It is pitch dark, and you can't see a thing."; // changed default dark message
    1: "^You can also see: ";
    2: "^What now?^";
    3: "^What next?^";
    4: "^What will you do now?^";
    5: "^What will you do next?^";
    6: "I was not able to understand any of that. Please try again.^";
    7: "You can't go in that direction.^";
    8: "You can't do that.^";
    9: "You have with you: ";
    10: " (worn)";
    11: "nothing at all.^";
    12: "^Are you sure?^";
    13: "^Would you like another go?^";
    14: "Goodbye...^";
    15: "OK.^";
    16: "^   {20}{1}Press any key to continue.{20}{0}";
    17: "You have taken ";
    18: " turn";
    19: "s";
    20: ".^";
    21: "You have scored ";
    22: " out of 2.^";
    23: "You're not wearing one of those.^";
    24: "You can't. You're wearing the _.^";
    25: "You already have the _.^";
    26: "There isn't one of those here.^";
    27: "You can't carry any more things.^";
    28: "You don't have one of those.^";
    29: "You're already wearing the _.^";
    30: "Y";
    31: "N";
    32: "^More...";
    #ifdef PAWSPECTRUM
    33: "{16}{6}{146}";
    34: "{16}{6}{147}";
    #endif
    #ifndef PAWSPECTRUM
    33: ">";
    34: ".";
    #endif
    35: "^Time passes...^";
    36: "You now have the _.^";
    37: "You're now wearing the _.^";
    38: "You've removed the _.^";
    39: "You've dropped the _.^";
    40: "You can't wear the _.^";
    41: "You can't remove the _.^";
    42: "You can't remove the _. Your hands are full.^";
    43: "The _ weighs too much for you.^";
    44: "The _ is in the ";
    45: "The _ isn't in the ";
    46: ", ";
    47: " and ";
    48: ".^";
    49: "You don't have the _.^";
    50: "You're not wearing the _.^";
    51: ".^";
    52: "There isn't one of those in the ";
    53: "nothing.^";
    #ifdef PAWSPECTRUM
    54: "Type in name of file:^";
    55: "";
    56: "";
    57: "";
    58: "";
    59: "";
    60: "";
    #endif
    #ifndef PAWSPECTRUM
    54: "File not found.";
    55: "File corrupt.";
    56: "I/O Error!  File not Saved!";
    57: "Directory full.";
    58: "Disk full.";
    59: "File name error.";
    60: "Type in name of file. ";
    #endif
    61: "You see nothing unusual.^";
}

RESPONSE
{
    // When transferred to PAW, the entries here are placed into word order, * to _
    // So entries starting * * appear first and entries starting _ _ are last

    // In the bar? Is it dark? A system command?
    * *: AT 3 NOTZERO 0 GT 33 24 LT 33 31 MESSAGE 19 DONE;
    // In the bar? Is it dark? A non-movement command?
    * *: AT 3 NOTZERO 0 GT 33 11 MESSAGE 8 PLUS 200 1 DONE;
    // In the bar? Is it dark? A direction other than north (back out)?
    * *: AT 3 NOTZERO 0 NOTEQ 33 5 MESSAGE 7 PLUS 200 2 DONE;

    // Checks to see if the cloak is present when moving to and from the bar;
    // if so then toggle the light off/on
    S *: AT 1 PRESENT 1 SET 0 GOTO 3 DESC;
    N *: AT 3 PRESENT 1 CLEAR 0 GOTO 1 DESC;

    // Standard inPAWs default response table entries
    I _: INVEN;
    GET I: INVEN;
    GET ALL: DOALL 255;
    GET _: AUTOG DONE;
    PUT ALL: DOALL 254;
    PUT _: AUTOD DONE;
    REMOV ALL: DOALL 253;
    REMOV _: AUTOR DONE;
    WEAR ALL: DOALL 254;
    WEAR _: AUTOW DONE;
    R _: DESC;
    QUIT _: QUIT TURNS END;
    SAVE _: SAVE;
    LOAD _: LOAD;
    RAMSA _: RAMSAVE OK;
    RAMLO _: RAMLOAD 255 ANYKEY DESC;
    EXAM _: SYSMESS 61 DONE;
    SCORE _: SCORE DONE;
    HELP _: MESSAGE 26 DONE;

    N *: AT 1 MESSAGE 1 DONE;

    EXAM ME: MESSAGE 13 NEWLINE INVEN DONE;

    EXAM CLOAK: PRESENT 1 MESSAGE 2 DONE;
    EXAM CLOAK: PRESENT 3 MES 15 MESSAGE 16 DONE;

    EXAM HOOK: PRESENT 2 MES 3 MESSAGE 4 DONE;
    EXAM HOOK: PRESENT 3 MES 3 MESSAGE 5 DONE;

    GET HOOK: AT 2 MES 15 MESSAGE 4 DONE;

    // Interactions between the cloak and the hook
    HANG CLOAK: WORN 1 PRESENT 2 WHATO SYSMESS 24 DONE;
    HANG CLOAK: PRESENT 1 PRESENT 2 SWAP 2 3 DESTROY 1 MESSAGE 17 PLUS 30 1 ANYKEY DESC;
    HANG CLOAK: PRESENT 3 MESSAGE 25 DONE;
    USE HOOK: PRESENT 1 PRESENT 2 SWAP 2 3 DESTROY 1 MESSAGE 17 PLUS 30 1 ANYKEY DESC;
    USE HOOK: AT 2 MESSAGE 18 DONE;

    GET CLOAK: PRESENT 3 SWAP 3 2 CREATE 1 AUTOG MINUS 30 1 ANYKEY DESC;
    DROP CLOAK: PRESENT 1 AT 2 MESSAGE 20 DONE;
    DROP CLOAK: PRESENT 1 MESSAGE 6 DONE;
    WEAR CLOAK: PRESENT 3 MES 15 MESSAGE 16 DONE;
    
    EXAM MESSA: AT 3 GT 200 1 MESSAGE 23 DONE;
    EXAM MESSA: AT 3 GT 200 0 MESSAGE 22 DONE;
    EXAM MESSA: AT 3 MESSAGE 21 DONE;
    EXAM FLOOR: AT 3 MESSAGE 27 DONE;

    READ MESSA: AT 3 GT 200 1 MESSAGE 10 ANYKEY MESSAGE 11 ANYKEY TURNS SCORE END;
    READ MESSA: AT 3 GT 200 0 MES 22 MESSAGE 24 ANYKEY MESSAGE 12 ANYKEY TURNS SCORE END;
    READ MESSA: MESSAGE 9 ANYKEY MESSAGE 12 ANYKEY PLUS 30 1 TURNS SCORE END;
}

// Any additional processes (beyond process 1 & 2 must be forwarded declared)
// No additional processes have been used in this adventure

PROCESS 1 
{
    // Process 1 runs after a location is described
    //
    // Game initialisation routine
    * *: AT 0 ANYKEY CLS MESSAGE 0 ANYKEY GOTO 1 DESC;
    // Print additional location information
    * _: NEWLINE ZERO 0 ABSENT 0 LISTOBJ;
    * _: PRESENT 0 LISTOBJ;
}

PROCESS 2
{
    // Process 2 is the "computer's turn"
    // 
    // Random cloak message, for demonstration of process 2, prints one time only
    * *: AT 1 PRESENT 1 ZERO 100 CHANCE 25 MESSAGE 14 SET 100;
}

// User defined graphics & character set

CHARACTERS
{
    0, 0, 0, 0, 0, 0, 0, 255, 
    0, 0, 0, 0, 0, 0, 0, 0, 
    0, 60, 24, 60, 126, 126, 60, 0, 
    6, 30, 28, 60, 112, 96, 128, 0, 
    0, 0, 0, 0, 0, 0, 0, 250, 
    255, 254, 252, 248, 240, 224, 192, 128, 
    255, 127, 63, 31, 15, 7, 3, 1, 
    1, 3, 7, 15, 31, 63, 127, 255, 
    128, 192, 224, 240, 248, 252, 254, 255, 
    0, 0, 0, 15, 8, 8, 8, 8, 
    0, 0, 0, 248, 8, 8, 8, 8, 
    8, 8, 8, 15, 0, 0, 0, 0, 
    8, 8, 8, 248, 0, 0, 0, 0, 
    8, 8, 8, 8, 8, 8, 8, 8, 
    0, 0, 0, 255, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 170, 85, 
    16, 8, 16, 8, 16, 8, 16, 8, 
    170, 85, 170, 85, 170, 85, 170, 85, 
    255, 255, 255, 255, 255, 255, 255, 255, 
    170, 85, 170, 85, 170, 85, 170, 85, 
    204, 51, 204, 51, 204, 51, 204, 51, 
    170, 170, 85, 85, 170, 170, 85, 85, 
    136, 0, 2, 0, 136, 0, 32, 0, 
    0, 0, 32, 0, 0, 0, 2, 0, 
    16, 16, 16, 16, 16, 16, 16, 16, 
    0, 0, 0, 255, 0, 0, 0, 0, 
    68, 68, 68, 68, 68, 68, 68, 68, 
    0, 255, 0, 0, 0, 255, 0, 0, 
    128, 64, 32, 16, 8, 4, 2, 1, 
    1, 2, 4, 8, 16, 32, 64, 128, 
    34, 17, 136, 68, 34, 17, 136, 68, 
    68, 136, 17, 34, 68, 136, 17, 34, 
    195, 60, 195, 60, 195, 60, 195, 60, 
    4, 4, 255, 64, 64, 64, 255, 4, 
    1, 3, 6, 12, 24, 48, 96, 192, 
    1,
    0, 0, 0, 0, 0, 0, 0, 0, 
    24, 24, 24, 24, 24, 0, 24, 0, 
    0, 54, 54, 36, 0, 0, 0, 0, 
    108, 108, 254, 108, 254, 108, 108, 0, 
    24, 62, 88, 62, 26, 124, 24, 0, 
    0, 198, 204, 24, 48, 102, 198, 0, 
    56, 108, 56, 118, 220, 204, 118, 0, 
    24, 24, 48, 0, 0, 0, 0, 0, 
    12, 24, 48, 48, 48, 24, 12, 0, 
    48, 24, 12, 12, 12, 24, 48, 0, 
    0, 108, 56, 16, 56, 108, 0, 0, 
    0, 24, 24, 126, 24, 24, 0, 0, 
    0, 0, 0, 0, 0, 24, 24, 48, 
    0, 0, 0, 60, 60, 0, 0, 0, 
    0, 0, 0, 0, 0, 24, 24, 0, 
    6, 12, 24, 48, 96, 192, 128, 0, 
    124, 198, 206, 214, 230, 198, 124, 0, 
    24, 56, 24, 24, 24, 24, 126, 0, 
    60, 102, 6, 60, 96, 102, 126, 0, 
    60, 102, 6, 28, 6, 102, 60, 0, 
    24, 56, 88, 152, 254, 24, 60, 0, 
    126, 98, 96, 124, 6, 102, 60, 0, 
    60, 102, 96, 124, 102, 102, 60, 0, 
    126, 126, 6, 12, 24, 24, 24, 0, 
    60, 102, 102, 60, 102, 102, 60, 0, 
    60, 102, 102, 62, 6, 102, 60, 0, 
    0, 0, 24, 24, 0, 24, 24, 0, 
    0, 0, 24, 24, 0, 24, 24, 48, 
    0, 0, 12, 24, 48, 24, 12, 0, 
    0, 0, 0, 126, 0, 126, 0, 0, 
    0, 0, 48, 24, 12, 24, 48, 0, 
    60, 102, 6, 12, 24, 0, 24, 0, 
    124, 198, 222, 214, 222, 192, 124, 0, 
    60, 102, 102, 126, 102, 102, 102, 0, 
    252, 102, 102, 124, 102, 102, 252, 0, 
    62, 98, 96, 96, 96, 98, 62, 0, 
    248, 108, 102, 102, 102, 108, 248, 0, 
    254, 98, 104, 120, 104, 98, 254, 0, 
    254, 98, 104, 120, 104, 96, 240, 0, 
    60, 102, 192, 192, 206, 102, 62, 0, 
    102, 102, 102, 126, 102, 102, 102, 0, 
    126, 24, 24, 24, 24, 24, 126, 0, 
    30, 12, 12, 12, 204, 204, 120, 0, 
    230, 102, 108, 120, 108, 102, 230, 0, 
    240, 96, 96, 96, 98, 102, 254, 0, 
    198, 238, 254, 254, 214, 198, 198, 0, 
    198, 230, 246, 222, 206, 198, 198, 0, 
    124, 198, 198, 198, 198, 198, 124, 0, 
    252, 102, 102, 124, 96, 96, 240, 0, 
    124, 198, 198, 214, 202, 196, 118, 0, 
    252, 102, 102, 124, 108, 102, 230, 0, 
    60, 102, 96, 60, 6, 102, 60, 0, 
    126, 90, 24, 24, 24, 24, 60, 0, 
    102, 102, 102, 102, 102, 102, 60, 0, 
    102, 102, 102, 102, 102, 60, 24, 0, 
    198, 198, 198, 214, 254, 238, 198, 0, 
    102, 126, 60, 24, 60, 126, 102, 0, 
    102, 102, 102, 60, 24, 24, 24, 0, 
    126, 70, 14, 28, 56, 114, 126, 0, 
    60, 48, 48, 48, 48, 48, 60, 0, 
    192, 96, 48, 24, 12, 6, 2, 0, 
    60, 12, 12, 12, 12, 12, 60, 0, 
    24, 60, 126, 24, 24, 24, 24, 0, 
    0, 0, 0, 0, 0, 0, 0, 255, 
    60, 102, 96, 248, 96, 102, 254, 0, 
    0, 0, 60, 6, 62, 102, 58, 0, 
    224, 224, 124, 102, 102, 102, 188, 0, 
    0, 0, 60, 102, 96, 102, 60, 0, 
    28, 12, 124, 204, 204, 204, 118, 0, 
    0, 0, 60, 102, 126, 96, 60, 0, 
    28, 54, 48, 120, 48, 48, 120, 0, 
    0, 0, 62, 102, 102, 62, 6, 124, 
    112, 48, 60, 54, 54, 54, 118, 0, 
    24, 0, 56, 24, 24, 24, 60, 0, 
    6, 0, 30, 6, 6, 6, 102, 60, 
    224, 96, 102, 108, 120, 108, 230, 0, 
    56, 24, 24, 24, 24, 24, 60, 0, 
    0, 0, 108, 254, 214, 214, 198, 0, 
    0, 0, 220, 102, 102, 102, 102, 0, 
    0, 0, 60, 102, 102, 102, 60, 0, 
    0, 0, 220, 102, 102, 124, 96, 240, 
    0, 0, 118, 204, 204, 124, 12, 30, 
    0, 0, 220, 118, 96, 96, 240, 0, 
    0, 0, 60, 96, 60, 6, 124, 0, 
    48, 48, 124, 48, 48, 54, 28, 0, 
    0, 0, 102, 102, 102, 102, 60, 0, 
    0, 0, 102, 102, 102, 60, 24, 0, 
    0, 0, 198, 214, 214, 254, 108, 0, 
    0, 0, 198, 108, 56, 108, 198, 0, 
    0, 0, 102, 102, 102, 62, 6, 124, 
    0, 0, 126, 76, 24, 50, 126, 0, 
    14, 24, 24, 112, 24, 24, 14, 0, 
    24, 24, 24, 24, 24, 24, 24, 0, 
    112, 24, 24, 14, 24, 24, 112, 0, 
    118, 216, 0, 0, 0, 0, 0, 0, 
    56, 68, 186, 162, 186, 68, 56, 60

}