! CompassWorks Beta ! Copyright 1999 by Jonathan Rosebaugh ! skiprosebaugh@email.com ! ! In one of my games, I had quite a few outdoor scenes. I decided to remove "the walls" for added ! realism. If you don't know what I'm talking about, you don't need this! ! ! You must define Constant WITHOUT_DIRECTIONS; ! BEFORE inclusion of the parser! ! ! Requires Adam Cadre's Flags.h ! In addition, you must edit the flag array in flags.h. The number of elements in the array ! must be at least 2. CompassWorks requires 10 flags. If anyone knows how to automatically do ! this, please let me know! ! ! You should call SetFlag(NORTH_WALL, 1) to indicate that there is a wall there, ! or SetFlag(NORTH_WALL, 0) to indicate that there isn't a wall there. ! In addition, you can call CompassOutside() or CompassInside() to set all the flags one way or ! the other. ! If you want to, you can edit the description of the Ceiling object to say something like ! "There's a pretty blue sky." Just be sure to set u_obj.description = NULL; when you don't ! need that description anymore. Of course, you can do the same with all the directions. ! ! If you have a credits verb, and you'd like to give credit to me for any help this file gave, ! just call CompassCredits(1); at the appropriate point. Change the 1 to a 0 if you don't want ! a newline printed at the end of the string. ! ! Redefine the below constants before inclusion to change the flags used: IFNDEF NORTH_WALL; Constant NORTH_WALL 0; ENDIF; IFNDEF SOUTH_WALL; Constant SOUTH_WALL 1; ENDIF; IFNDEF EAST_WALL; Constant EAST_WALL 3; ENDIF; IFNDEF WEST_WALL; Constant WEST_WALL 4; ENDIF; IFNDEF NE_WALL; Constant NE_WALL 5; ENDIF; IFNDEF NW_WALL; Constant NW_WALL 6; ENDIF; IFNDEF SE_WALL; Constant SE_WALL 7; ENDIF; IFNDEF SW_WALL; Constant SW_WALL 8; ENDIF; IFNDEF CEILING_WALL; Constant CEILING_WALL 9; ENDIF; IFNDEF FLOOR_WALL; Constant FLOOR_WALL 10; ENDIF; CompassDirection n_obj "north wall" Compass with name 'n//' 'north' 'wall', door_dir n_to, parse_name [ i; if (FlagOn(NORTH_WALL)) { while (NextWord()=='n//' or 'north' or 'wall') i++; return i; } while (NextWord()=='n//' or 'north') i++; return i; ], short_name [; if (FlagOn(NORTH_WALL)) rfalse; print "north"; rtrue;]; CompassDirection s_obj "south wall" Compass with name 's//' 'south' 'wall', door_dir s_to, parse_name [ i; if (FlagOn(SOUTH_WALL)) { while (NextWord()=='s//' or 'south' or 'wall') i++; return i; } while (NextWord()=='s//' or 'south') i++; return i; ], short_name [; if (FlagOn(SOUTH_WALL)) rfalse; print "south"; rtrue;]; CompassDirection e_obj "east wall" Compass with name 'e//' 'east' 'wall', door_dir e_to, parse_name [ i; if (FlagOn(EAST_WALL)) { while (NextWord()=='e//' or 'east' or 'wall') i++; return i; } while (NextWord()=='e//' or 'east') i++; return i; ], short_name [; if (FlagOn(EAST_WALL)) rfalse; print "east"; rtrue;]; CompassDirection w_obj "west wall" Compass with name 'w//' 'west' 'wall', door_dir w_to, parse_name [ i; if (FlagOn(WEST_WALL)) { while (NextWord()=='w//' or 'west' or 'wall') i++; return i; } while (NextWord()=='w//' or 'west') i++; return i; ], short_name [; if (FlagOn(WEST_WALL)) rfalse; print "west"; rtrue;]; CompassDirection ne_obj "northeast wall" Compass with name 'ne' 'northeast' 'wall', door_dir ne_to, parse_name [ i; if (FlagOn(NE_WALL)) { while (NextWord()=='ne' or 'northeast' or 'wall') i++; return i; } while (NextWord()=='ne' or 'northeast') i++; return i; ], short_name [; if (FlagOn(NE_WALL)) rfalse; print "northeast"; rtrue;]; CompassDirection nw_obj "northwest wall" Compass with name 'nw' 'northwest' 'wall', door_dir nw_to, parse_name [ i; if (FlagOn(NW_WALL)) { while (NextWord()=='nw' or 'northwest' or 'wall') i++; return i; } while (NextWord()=='nw' or 'northwest') i++; return i; ], short_name [; if (FlagOn(NW_WALL)) rfalse; print "northwest"; rtrue;]; CompassDirection se_obj "southeast wall" Compass with name 'se' 'southeast' 'wall', door_dir se_to, parse_name [ i; if (FlagOn(SE_WALL)) { while (NextWord()=='se' or 'southheast' or 'wall') i++; return i; } while (NextWord()=='se' or 'southeast') i++; return i; ], short_name [; if (FlagOn(SE_WALL)) rfalse; print "southeast"; rtrue;]; CompassDirection sw_obj "southwest wall" Compass with name 'sw' 'southwest' 'wall', door_dir sw_to, parse_name [ i; if (FlagOn(SW_WALL)) { while (NextWord()=='sw' or 'southwest' or 'wall') i++; return i; } while (NextWord()=='sw' or 'southwest') i++; return i; ], short_name [; if (FlagOn(SW_WALL)) rfalse; print "southwest"; rtrue;]; CompassDirection u_obj "ceiling" Compass with name 'u//' 'up' 'ceiling', door_dir u_to, parse_name [ i; if (FlagOn(CEILING_WALL)) { while (NextWord()=='u//' or 'up' or 'ceiling') i++; return i; } while (NextWord()=='u//' or 'up' or 'sky') i++; return i; ], short_name [; if (FlagOn(CEILING_WALL)) rfalse; print "sky"; rtrue;]; CompassDirection d_obj "floor" Compass with name 'd//' 'down' 'floor', door_dir d_to, parse_name [ i; if (FlagOn(FLOOR_WALL)) { while (NextWord()=='d//' or 'down' or 'floor') i++; return i; } while (NextWord()=='d//' or 'down' or 'ground') i++; return i; ], short_name [; if (FlagOn(FLOOR_WALL)) rfalse; print "ground"; rtrue;]; [ CompassOutside; SetFlag(NORTH_WALL,0); SetFlag(SOUTH_WALL,0); SetFlag(EAST_WALL,0); SetFlag(WEST_WALL,0); SetFlag(NE_WALL,0); SetFlag(NW_WALL,0); SetFlag(SW_WALL,0); SetFlag(SE_WALL,0); SetFlag(CEILING_WALL,0); SetFlag(FLOOR_WALL,0); ]; [ CompassInside; SetFlag(NORTH_WALL,1); SetFlag(SOUTH_WALL,1); SetFlag(EAST_WALL,1); SetFlag(WEST_WALL,1); SetFlag(NE_WALL,1); SetFlag(NW_WALL,1); SetFlag(SW_WALL,1); SetFlag(SE_WALL,1); SetFlag(CEILING_WALL,1); SetFlag(FLOOR_WALL,1); ]; [ CompassCredits arg; if (arg) "Compass.h was written by Jonathan Rosebaugh."; print "Compass.h was written by Jonathan Rosebaugh."; rtrue; ];