home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 3
/
goldfish_volume_3.bin
/
files
/
fish
/
disks
/
d1088.lha
/
Programs
/
DungeonMap
/
Rexx
/
PlaceRoom.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1994-11-30
|
2KB
|
67 lines
/*
** This is a sample of the use of some of the DungeonMap Rexx commands.
**
** This will place a Dungeon room at a set of coordinates, overwriting
** anything that may have been their previously.
**
** Format: PlaceRoom X Y DirectionOfExit
*/
OPTIONS RESULTS
OPTIONS FAILAT 10
/* Get and check for correct number and type of parameters */
ARG Parms
X = WORD(Parms,1)
Y = WORD(Parms,2)
Dir = UPPER(WORD(Parms,3))
IF ARG() ~= 1 | ~DATATYPE(X,'W') | ~DATATYPE(Y,'W') | ~DATATYPE(Dir,'M') THEN DO
SAY "Format: PlaceRoom X Y"
SAY "Arguments X & Y must be a whole numeric"
EXIT 10
END
IF INDEX( "NORTH EAST SOUTH WEST", Dir ) = 0 THEN DO
SAY "The direction of the room exit must be one of:"
SAY " North East South West"
EXIT 10
END
/* Find the first DungeonMap Rexx port name, and address commands to this name */
Ports = SHOW('P')
Pos = INDEX(Ports,"DungeonMap")
IF Pos = 0 THEN DO
SAY "DungeonMap has not been started."
EXIT 10
END
DungeonMap = WORD(SUBSTR(Ports,Pos),1)
ADDRESS VALUE DungeonMap
/* Check that the Coordinates passed are OK */
IF X<1 | Y<1 | X>MaxX | Y>MaxY THEN DO
SAY "X is not between 1 and "MaxX" or Y is not between 1 and "MaxY
EXIT 10
END
/* Save the current settings for restoring any changed ones later */
INFO
PARSE VAR RESULT SavedInterlace SavedAutoCentre SavedPrintSize SavedMapFormat MaxX MaxY SavedChangeTo SavedItemEvent
/* Draw a room at X Y with an exit in direction Dir */
CHANGETO 'Wall'
DRAW X Y 'North'
DRAW X Y 'East'
DRAW X Y 'South'
DRAW X Y 'West'
CHANGETO 'Open'
DRAW X Y Dir
/* Restore the changed settings */
CHANGETO SavedChangeTo
RETURN