This code works:
` NPCs
` DECLARE MAXIMUM NUMBER OF NPCs IN GAME
MAX_NPC = 10
` CREATE A TYPE DEFINITION FOR NPCs
TYPE NPC
NAME AS STRING
DESC1 AS STRING
DESC2 AS STRING
LOCATION AS FLOAT
SHOW AS INTEGER
ATTACKING AS INTEGER
KILLABLE AS INTEGER
GOOD AS INTEGER
THIEF AS INTEGER
TALK AS INTEGER
BAD AS INTEGER
ENDTYPE
` create an array of NPCs
DIM NPC_ARRAY(MAX_NPC) AS NPC
` POPULATE THE ARRAY WITH NPC DATA
FOR i = 1 TO MAX_NPC
READ NPC_ARRAY(i).NAME
READ NPC_ARRAY(i).DESC1
READ NPC_ARRAY(i).DESC2
READ NPC_ARRAY(i).LOCATION
READ NPC_ARRAY(i).SHOW
READ NPC_ARRAY(i).ATTACKING
READ NPC_ARRAY(i).KILLABLE
READ NPC_ARRAY(i).GOOD
READ NPC_ARRAY(i).THIEF
READ NPC_ARRAY(i).TALK
READ NPC_ARRAY(i).BAD
NEXT i
` Game NPCs
` 1 name, 2 desc, 3 desc2 , 4 loc, 5 show, 6 attacking, 7 killable, 8 good, 9 thief, 10 talk, 11 bad,
DATA "rat", "gigantic", "",0,1,1,1,0,0,0,1 ` 1
DATA "gnome","warty","",0,1,1,1,0,1,0,1 ` 2
DATA "troll","ugly","",0,1,1,1,0,1,0,1 ` 3
DATA "bigfoot","hairy","",0,1,1,1,0,0,0,1 ` 4
DATA "leprechaun","tiny","",0,1,0,0,1,1,1,0 ` 5
DATA "fairy","golden","",0,1,0,0,1,0,1,0 ` 6
DATA "wumpus","","",0,1,1,1,0,0,0,1 ` 7
DATA "cadaver","","",0,1,0,0,1,0,1,0 ` 8
DATA "elf","fat old","",26,1,0,0,0,0,1,0 ` 9
DATA "lady","tiny old","",25,1,0,0,1,0,1,0 ` 10
This is the calling code (it also works).
` Meeting some interestin folks
ENCOUNTERS:
RANDOMIZE TIMER()
IF plr_loc = 26
PRINT "There is a " + NPC_ARRAY(NPC1).DESC1 + " " + NPC_ARRAY(NPC1).NAME + " here."
RETURN
ENDIF
IF plr_loc = 25
npc1 = 10
PRINT "There is a " + NPC_ARRAY(NPC1).DESC1 + " " + NPC_ARRAY(NPC1).NAME + " here."
RETURN
ENDIF
` rnd(19) 8 out of 20 chances of meeting one of the NPCs
i = RND(19)
IF i < 1 THEN i = 20
IF i > 8 THEN RETURN
` LIST ANY NPCs at PLAYER LOCATION
IF i => 8 THEN NPC_ARRAY(i).location = plr_loc
NPC1 = i
IF NPC_ARRAY(NPC1).SHOW = 1
IF LEN(NPC_ARRAY(NPC1).DESC1) > 0
PRINT "There is a " + NPC_ARRAY(NPC1).DESC1 + " " + NPC_ARRAY(NPC1).NAME + " here."
ELSE
PRINT "There is a " + NPC_ARRAY(NPC1).NAME + " here."
ENDIF
IF NPC_ARRAY(NPC1).attacking = 1
PRINT
GOSUB cmd_attack
RETURN
ENDIF
ENDIF
RETURN
I have compared this code with the current build and can see no differences.
The Fangman