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 >
OS/2 REXX Batch file  |  1994-11-30  |  2KB  |  67 lines

  1. /*
  2. ** This is a sample of the use of some of the DungeonMap Rexx commands.
  3. **
  4. ** This will place a Dungeon room at a set of coordinates, overwriting
  5. ** anything that may have been their previously.
  6. **
  7. ** Format: PlaceRoom X Y DirectionOfExit
  8. */
  9.  
  10. OPTIONS RESULTS
  11. OPTIONS FAILAT 10
  12.  
  13. /* Get and check for correct number and type of parameters */
  14. ARG Parms
  15. X   = WORD(Parms,1)
  16. Y   = WORD(Parms,2)
  17. Dir = UPPER(WORD(Parms,3))
  18. IF ARG() ~= 1 | ~DATATYPE(X,'W') | ~DATATYPE(Y,'W') | ~DATATYPE(Dir,'M') THEN DO
  19.    SAY "Format: PlaceRoom X Y"
  20.    SAY "Arguments X & Y must be a whole numeric"
  21.    EXIT 10
  22.    END
  23. IF INDEX( "NORTH EAST SOUTH WEST", Dir ) = 0 THEN DO
  24.    SAY "The direction of the room exit must be one of:"
  25.    SAY "   North East South West"
  26.    EXIT 10
  27.    END
  28.  
  29. /* Find the first DungeonMap Rexx port name, and address commands to this name */
  30.  
  31. Ports = SHOW('P')
  32. Pos = INDEX(Ports,"DungeonMap")
  33. IF Pos = 0 THEN DO
  34.    SAY "DungeonMap has not been started."
  35.    EXIT 10
  36.    END
  37. DungeonMap = WORD(SUBSTR(Ports,Pos),1)
  38. ADDRESS VALUE DungeonMap
  39.  
  40. /* Check that the Coordinates passed are OK */
  41.  
  42. IF X<1 | Y<1 | X>MaxX | Y>MaxY THEN DO
  43.    SAY "X is not between 1 and "MaxX" or Y is not between 1 and "MaxY
  44.    EXIT 10
  45.    END
  46.  
  47. /* Save the current settings for restoring any changed ones later */
  48.  
  49. INFO
  50. PARSE VAR RESULT SavedInterlace SavedAutoCentre SavedPrintSize SavedMapFormat MaxX MaxY SavedChangeTo SavedItemEvent
  51.  
  52. /* Draw a room at X Y with an exit in direction Dir */
  53.  
  54. CHANGETO 'Wall'
  55. DRAW X Y 'North'
  56. DRAW X Y 'East'
  57. DRAW X Y 'South'
  58. DRAW X Y 'West'
  59. CHANGETO 'Open'
  60. DRAW X Y Dir
  61.  
  62. /* Restore the changed settings */
  63.  
  64. CHANGETO SavedChangeTo
  65.  
  66. RETURN
  67.