Code: Select all
DECLARE SUB loadrooms ()
DECLARE SUB display ()
DECLARE SUB move ()
DECLARE SUB createroom ()
DECLARE SUB checkwalls ()
DECLARE SUB parse (line$)
TYPE actor
x AS INTEGER
y AS INTEGER
hp AS INTEGER
maxhp AS INTEGER
mp AS INTEGER
maxmp AS INTEGER
att AS INTEGER
dfn AS INTEGER
expr AS INTEGER
lvl AS INTEGER
money AS INTEGER
weapon AS STRING * 15
END TYPE
TYPE object
title AS STRING * 15
description AS STRING * 50
equipable AS SINGLE
equiped AS SINGLE
mapnum AS INTEGER
location AS STRING * 4
owned AS SINGLE
attrib AS INTEGER
use AS STRING * 6
founddisc AS STRING * 25
hidden AS SINGLE
END TYPE
TYPE room
title AS STRING * 30
description AS STRING * 100
description2 AS STRING * 100
NSEW AS STRING * 4
nextmap AS INTEGER
END TYPE
DIM SHARED player AS actor
DIM SHARED inventory(10) AS object
DIM SHARED currentroom(4, 4) AS room, maxx, maxy
DIM SHARED word$(9)
DIM SHARED line$
CONST true = 0, false = NOT true
SCREEN 13
maxx = 4
maxy = 4
player.x = 0
player.y = 2
CLS
loadrooms
DO
display
LOCATE 4, 1: PRINT " "
LOCATE 4, 1: INPUT "do what?"; phrase$
LINE (0, 0)-(319, 199), 0, BF
parse phrase$
move
LOOP UNTIL word$(0) = "q"
SUB checkwalls
cant = false
IF player.x > maxx THEN
player.x = player.x - 1
PRINT "Can't Wall"
EXIT SUB
END IF
IF player.x < 0 THEN
player.x = player.x + 1
PRINT "Can't Wall"
EXIT SUB
END IF
IF player.y > maxy THEN
player.x = player.x - 1
PRINT "Can't Wall"
EXIT SUB
END IF
IF player.y < 0 THEN
player.y = player.x + 1
PRINT "Can't Wall"
EXIT SUB
END IF
IF word$(0) = "north" THEN x = 1
IF word$(0) = "south" THEN x = 2
IF word$(0) = "east" THEN x = 3
IF word$(0) = "west" THEN x = 4
PRINT currentroom(player.x, player.y).NSEW
DO: LOOP UNTIL INKEY$ <> ""
IF MID$(currentroom(player.x, player.y).NSEW, x, 1) = "n" THEN
PRINT "Wall"
cant = true
END IF
IF word$(0) = "north" AND cant = true THEN
player.x = player.x + 1
END IF
IF word$(0) = "south" AND cant = true THEN
player.x = player.x - 1
END IF
IF word$(0) = "east" AND cant = true THEN
player.y = player.y - 1
END IF
IF word$(0) = "west" AND cant = true THEN
player.y = player.y + 1
END IF
END SUB
SUB createroom
FOR x = 0 TO 4
FOR y = 0 TO 4
currentroom(x, y).title = "big room"
currentroom(x, y).description = "X:" + STR$(x) + " Y:" + STR$(y)
NEXT y
NEXT x
END SUB
SUB display
LOCATE 1, 1: PRINT currentroom(player.x, player.y).title
LOCATE 1, 2: PRINT currentroom(player.x, player.y).description
END SUB
SUB loadrooms
OPEN "rooms.dat" FOR INPUT AS #1
FOR x = 0 TO maxx
FOR y = 0 TO maxy
LINE INPUT #1, roomnumber$
LINE INPUT #1, roomname$
LINE INPUT #1, roomdes$
LINE INPUT #1, roompass$
currentroom(x, y).title = roomname$ + " " + roomnumber$ + " " + roompass$
currentroom(x, y).description = roomdes$
currentroom(x, y).NSEW = roompass$
NEXT y
NEXT x
END SUB
SUB move
IF word$(0) = "east" THEN
player.y = player.y + 1
checkwalls
END IF
IF word$(0) = "west" THEN
player.y = player.y - 1
checkwalls
END IF
IF word$(0) = "south" THEN
player.x = player.x + 1
checkwalls
END IF
IF word$(0) = "north" THEN
player.x = player.x - 1
checkwalls
END IF
END SUB
SUB parse (line$)
wordnum = -1
DO
wordnum = wordnum + 1
spce = INSTR(line$, " ")
char = 0
IF wordnum > 0 THEN
line$ = RIGHT$(line$, LEN(line$) - spce)
END IF
DO
char = char + 1
IF MID$(line$, char, 1) = "" THEN
sentenceover = 1
char = char - 1
EXIT DO
END IF
IF MID$(line$, char, 1) = " " THEN
char = char - 1
EXIT DO
END IF
LOOP
word$(wordnum) = LCASE$(LEFT$(line$, char))
LOOP UNTIL sentenceover = 1
END SUB
Code: Select all
0101---the x,y location
Big Room----name
Really big---description
ynny---passability(NSEW)
thanx for the help...i just don't get it
Captain Squirrely
Code: Select all