Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - shaf

#1
Hello,

My primary machine is a desktop, but I travel frequently, is it possible to load GLBasic on my Corporate Laptop also.  

Thanks

Shaf
#2
GernoT,

Thanks this will be a huge help to people trying to convert old code into GLBasic. Now where is my old Star Trek program  done on the C64.

Thanks

Shaf
#3
I had to do this months ago when I attempted to convert an old Basic Program from the mid 1980's to work in GLbasic. It was a lot of work to get the arrays formatted properly but eventually I got everything straightened out.

Then I decided that the code was too much spagetti and am attempting to write the code to be more modular.

Shaf
#4
PeeJay,
 I'd like to add my thanks, started looking through the tutorials, very well done.

Cheers

Shaf
#5
Silly me, I thought that I had declared all globals.

Yes it's Spagetti code., an attempt to replace an old Basic Program written in 1983 to run in GLbasic.
it's mor of a proof if concept before cleaning up the code and making it more modular.
My idea is to create a simple text adventure game for younger gamers that can be easily modified.

I appreciate all the help.

Shaf
#6
Attached is the Source for the Array errors above:
Code (glbasic) Select
// --------------------------------- //
// Project: Tower of Mystery
// Start: Tuesday, November 06, 2007
// IDE Version: 5.062
// Upgraded to IDE Version: 5.129
//
// declare constants
//
// NR number of rooms
// NT number of things/items
// NP number of Pseudo-Objects (all other Objects)
// NO number of objects of all kinds
// NV number of verbs
//
// declare Flags
//
// CA Computer Active (in-game)
// CD Computer is Dead
// LI Character is logged into computer
// CP COPY of program is running on computer
// MF Computer Manual Found
// MT Tape mounted
// CF Coin Found
// WD Room description request flag
// RatFight  Rats are Trouble (was RT)
// BatFight Bats are trouble (was BT)
// CT Time since computer was started
//
// General Variables
//
// C$  Command input
// C1$ First word of command
// C2$ Second Word of command
// C1  Verb token
// C2 Object token
// RM Room currently occupied
//
// Arrays
//
// AC[NR][6] Access Array
// VB$[NV] Verb array
// OB$[NO] Object Array
// RM$[NR] Room description array
// TD$[NT] Item description array
// VN[NV]  Verb token array
// ItemLoc[NT]  Item Location Array (Initially was TL[nt])
// ItemFlag[NT]  Item Flag array (for can item be carried) )(Initially was TF[nt])
//
// Directions can be numeric or alpha
//
// 1 N  North
// 2 S  South
// 3 E  East
// 4 W  West
// 5 U  Up
// 6 D  Down
//
//
GLOBAL RatFight, BatFight, AC, FT, I, K, L, X, A, A$, NR, NT, NP, NV, NO, MT
GLOBAL RM, CT, CF, RT, CA, MF, CD, WD, LI,  CP, BT, VB$, OB$, RM$, TD$, VN, TLL, ItemFlag, ItemLoc
GLOBAL C1, C2, C3, C4, C$, C1$, C2$, ItemLocF, AccessF, ROOMARRAY
NR=14
NT=11
NP=11
NV=29
NO=NT+NP
// DIM AC[NR-1][5]
// DIM VB$[NV]
// DIM OB$[NO]
// DIM RM$[NR]
// DIM TD$[NT]
// DIM VN[NV]
// DIM ItemLoc[NT]
// DIM ItemFlag[NT]
// Initialization of Variables
RM = 1
CT= 0
CF= 0
INTEGER (RatFight)
RatFight=-1
CA= 0
MF= 0
CD= 0
WD= -1
LI= 0
INTEGER (BatFight)
BatFight=-1
FOR I = 1 TO NR
DIM RM$[i]
DIMDATA RM$[], "You are in the front of an old factory with a Clock tower." ,"You are at the bottom of a stairwell." ,"You are at the top of the basement steps." ,"You are in a damp cellar." ,"You are in a storeroom." ,"You are in the cafeteria." ,"You are at a landing on the stairs." ,"Around you is a manufacturing area." ,"You are at a landing on the third floor." ,"You are in the Computer room." ,"You are inside the Clock Tower." ,"You are at the top of the stairs." ,"You are in a long corridor going east." ,"You are at the east end of the corridor."

NEXT
FOR I = 1 TO NV
// READ VB$[i],VN[i];
DIM VB$[i]
DIMDATA VB$[], "N","S","E","W","U","D","GO","EAT","KICK","INSERT","DEPOSIT","TYPE","TAKE","GET","DROP","THROW","INVENTORY","I","INV","MOUNT","READ","FIGHT","KILL","START","POWER","OPEN","QUIT","LOOK","WIND","EXAMI","EXAMINE"
DIM VN[i]
DIMDATA VN[], 1,2,3,4,5,6,7,8,9,10,10,11,12,12,13,13,14,14,14,15,16,17,17,18,18,19,20,21,22,23,23
// DATA N,1,S,2,E,3,W,4,U,5,D,6,"GO",7,"EAT",8,"KICK",9,"INSERT",10,"DEPOSIT",10,"TYPE",11
// DATA "TAKE",12,"GET",12,"DROP",13,"THROW",13,"INVENTORY",14,I,14,"INV",14,"MOUNT",15,"READ",16
// DATA "FIGHT",17,"KILL",17,"START",18,"POWER",18,"OPEN",19,"QUIT",20,"LOOK",21
// DATA "WIND",22,"EXAMI",23,"EXAMINE",23
 NEXT
FOR I = 1 TO NO;
// READ OB$[i];
DIM OB$[i]
DIMDATA OB$[] ,"RATS","TAPE","MACHINE","TERMINAL","COIN","CANDY","COMPUTER","BATS","DESK","MANUAL","CLOCK","ROAD","DIR","ADVEN","COPY","LOGOUT","NORTH","SOUTH","EAST","WEST","UP","DOWN"
// DATA "RATS","TAPE","MACHINE","TERMINAL","COIN","CANDY","COMPUTER","BATS","DESK","MANUAL","CLOCK","ROAD"
// DATA "DIR","ADVEN","COPY","LOGOUT","NORTH","SOUTH","EAST","WEST","UP","DOWN"
 NEXT
FOR I = 1 TO NT
// READ TD$[i],ItemLoc[i],ItemFlag[i]
DIM TD$[i]
DIMDATA TD$[] ,"HUNGRY RATS", "COMPUTER TAPE", "VENDING MACHINE", "BROKEN-DOWN TERMINAL", "COIN", "CANDY BAR", "COMPUTER","BATS","DESK","COMPUTER MANUAL","ELABORATE CLOCKWORK"
DIM ItemLoc[i]
DIMDATA ItemLoc[] ,4 ,5 ,6 ,8 ,-1 ,-1 ,10 ,13 ,14 ,-1 , 11
DIM ItemFlag[i]
DIMDATA ItemFlag[] ,0,1,0,1,1,1,1,0,0,1,0
// DATA "HUNGRY RATS",4,0,"COMPUTER TAPE",5,1,"VENDING MACHINE",6,0
// DATA "BROKEN-DOWN TERMINAL",8,1,"COIN",-1,1,"CANDY BAR",-1,1,"COMPUTER",10,1
// DATA "BATS",13,0,"DESK",14,0,"COMPUTER MANUAL",-1,1,"ELABORATE CLOCKWORK",11,0
 NEXT

DIM AC [14] [6]

 AC [0] [0] = 2
 AC [1] [0] = 3
 AC [11] [0] = 11
 AC [1] [1] = 1
 AC [2] [1] = 2
 AC [12] [1] = 12
 AC [3] [2] = 5
 AC [5] [2] = 7
 AC [6] [2] = 8
 AC [8] [2] = 10
 AC [11] [2] = 13
 AC [12] [2] = 14
 AC [4] [3] = 4
 AC [6] [3] = 6
 AC [7] [3] = 7
 AC [9] [3] = 9
 AC [12] [3] = 12
 AC [13] [3] = 13
 AC [1] [4] = 7
 AC [3] [4] = 3
 AC [6] [4] = 9
 AC [8] [4] = 12
 AC [2] [5] = 4
 AC [6] [5] = 2
 AC [8] [5] = 7
 AC [11] [5] = 9

// DATA 2,0,0,0,0,0
// DATA 3,1,0,0,7,0
// DATA 0,2,0,0,0,4
// DATA 0,0,5,0,3,0
// DATA 0,0,0,4,0,0
// DATA 0,0,7,0,0,0
// DATA 0,0,8,6,9,2
// DATA 0,0,0,7,0,0
// DATA 0,0,10,0,12,7
// DATA 0,0,0,9,0,0
// DATA 0,12,0,0,0,0
// DATA 11,0,13,0,0,9
// DATA 0,0,14,12,0,0
// DATA 0,0,0,13,0,0
// NEXT
// MAIN LOOP - Room Description
// MAIN was line 200
MAIN:
IF WD = 0 THEN GOTO MAINCOM
WD = 0
PRINT RM$[RM] ,100,100
SHOWSCREEN
K = 0
FOR I = 1 TO NT STEP 1
ItemLoc[i] = ItemLocF
IF ItemLocF > 1 THEN
GOTO MAIN2
IF ItemLocF < 1 THEN
GOTO MAIN2
IF K = 0 THEN
PRINT "You See:" ,100,100
SHOWSCREEN
K=1
PRINT TD$[i] ,100,100
SHOWSCREEN

// MAIN2 was line 270
MAIN2:
NEXT
PRINT "Exits are:" , 100,100
SHOWSCREEN
FOR I = 1 TO 6 STEP 1
// IF AC(RM,I)<>0 THEN PRINT VB$(I);"  ";
AC [RM] [i] = AccessF
IF AccessF <> 0 THEN
PRINT VB$[i] ,100,100
SHOWSCREEN
NEXT
// PRINT " " 100,100
// MAIN LOOP - command input and parser
// MAINCOM was line 400
MAINCOM:
INPUT C$ ,100,100
// L= LEN(C$); IF L=0 THEN MAINCOM
L = LEN (C$); IF L = 0  THEN GOTO MAINCOM
C1$=""; C2$="";C2=0;X=0
// FOR I = 1 TO L STEP 1
FOR I = 1 TO L STEP 1
A$ = MID$ (C$ ,I ,1 ); A=ASC(A$);IF A >= 97 AND A <= 122 THEN A$=CHR$(A-32)
IF A$<>" " THEN GOTO MAINCOM2
IF C2$<>"" THEN GOTO MAINCOM4
X=1
GOTO MAINCOM3
//MAINCOM2 was line 460
MAINCOM2:
IF X=0 THEN C1$=C1$+A$; GOTO MAINCOM3
C2$=C2$+A$
// MAINCOM3 was line 490
MAINCOM3:
NEXT
//MAINCOM4 was line 500
MAINCOM4:
IF C1$="" THEN PRINT "Excuse me?" ,100,100; GOTO MAINCOM
// C1$=LEFT$(C1$,5); C2$=LEFT$(C2$,5); Left$ not a function
C1$=MID$(C1$,0, C1); C2$=MID$(C2$,0, C2);
FOR C1 = 1 TO NV STEP 1
IF VB$[C1]=C1$ THEN C1=VN[C1]; GOTO MAINCOM5
NEXT
// Fix this line // PRINT "I don't know the verb " C1$; GOTO MAINCOM
PRINT "I don't know the verb " , 100,100;PRINT C1$ ,100,100; GOTO MAINCOM
//MAINCOM5 was line 600
MAINCOM5:
IF C2$="" THEN GOTO PREFIL
FOR C2=1 TO NO
IF OB$[C2]=C2$ THEN GOTO PREFIL
NEXT
IF C1=11 THEN C2=1; GOTO PREFIL

// NOOBJ was line 640
NOOBJECT:
// Fix this line //PRINT "I don't know the object"; C2$
PRINT "I don't know the object" ,100,100; PRINT C2$ ,100,100
SHOWSCREEN
GOTO MAINCOM5

// Prelimiary filtering of commands
// PREFIL was line 700
PREFIL:
IF C2 > (NT+5) AND C1 <> 7 AND C1 <> 11 THEN GOTO NOOBJECT
IF C2 > NT AND C2 < NT+5 THEN IF C1 <> 11 THEN GOTO COMPMESEG1
IF C2 > NT THEN GOTO PREFIL2
TLL=ItemLoc[C2]
IF C1 <> 11 AND TLL <> RM AND TLL <> 0 THEN PRINT "It isn't here.", 100,100;GOTO MAINCOM

// PREFIL2 was line 750
PREFIL2:
// IF C1=1 THEN GOTO DIRECT
// IF C1=2 THEN GOTO DIRECT
// IF C1=3 THEN GOTO DIRECT
// IF C1=4 THEN GOTO DIRECT
// IF C1=5 THEN GOTO DIRECT
// IF C1=6 THEN GOTO DIRECT
// IF C1=7 THEN GOTO GO
// IF C1=8 THEN GOTO EAT
// IF C1=9 THEN GOTO BOOT
// IF C1=10 THEN GOTO INSERT
// IF C1=11 THEN GOTO KEYIN
// IF C1=12 THEN GOTO TAKE
// IF C1=13 THEN GOTO DROP
// IF C1=14 THEN GOTO INVENTORY
// IF C1=15 THEN GOTO MOUNT
// IF C1=16 THEN GOTO PEER
// IF C1=17 THEN GOTO FIGHT
// IF C1=18 THEN GOTO START
// IF C1=19 THEN GOTO OPEN
// IF C1=20 THEN GOTO FIN
// IF C1 = 21 THEN GOTO LOOK
// IF C1 = 22 THEN GOTO WIND
// IF C1 = 23 THEN GOTO EXAMINE
SELECT C1
 CASE 1 TO 6
   GOTO DIRECT
 CASE 7
   GOTO GO
 CASE 8
   GOTO EAT
 CASE 9
  GOTO BOOT
 CASE 10
  GOTO INSERT
 CASE 11
  GOTO KEYIN
 CASE 12
  GOTO TAKE
 CASE 13
  GOTO DROP
 CASE 14
  GOTO INVENTORY
 CASE 15
  GOTO MOUNT
 CASE 16
  GOTO PEER
 CASE 17
  GOTO FIGHT
 CASE 18
  GOTO START
 CASE 19
  GOTO OPEN
 CASE 20
  GOTO FIN
 CASE 21
  GOTO LOOK
 CASE 22
  GOTO WIND
 CASE 23
  GOTO EXAMINE
ENDSELECT


// ON C1 GOTO DIRECT,DIRECT,DIRECT,DIRECT,DIRECT,DIRECT,GO,EAT,BOOT,INSERT
// ON C1-10 GOTO KEYIN,TAKE,DROP,INVENTORY,MOUNT,PEER,FLIGHT,START,OPEN,FIN
// ON C1-20 GOTO LOOK,WIND,EXAMINE

// Directions renamed Direct
// COMPASS was line 1000
DIRECT:
// IF AC[RM][C1]=0 THEN PRINT "You can't go that way.", 100,100;GOTO MAIN
ROOMARRAY = AC [RM] [C1]
IF ROOMARRAY = 0 THEN PRINT "You can't go that way.", 100,100;GOTO MAIN
IF RM=4 AND RatFight <> 0 AND C1=3 THEN PRINT "The rats look too fierce.",100,100;GOTO COMPROUTINE
RM=ROOMARRAY
WD=-1
GOTO COMPROUTINE

// Go
// GO was Line 1100
GO:
IF C2=0 THEN GOTO COMPMESEG5
IF C2 <= 16 THEN GOTO COMPMESEG4
C1 = (C2-16);GOTO DIRECT

// Eat
// EAT was Line 1200
EAT:
IF C2 <> 6 THEN GOTO COMPMESEG2
TLL=-1
 PRINT "It tastes stale." ,100,100; GOTO COMPROUTINE

// Kick
// BOOT was line 1300
BOOT:
IF C2=0 THEN GOTO COMPMESEG5
IF C2 <> 7 OR CD <> 0 THEN GOTO COMPMESEG2
IF CA <> 0 THEN
CT=9
GOTO COMPROUTINE

// Insert
// INSERT was line 1400
INSERT:
IF C2=0 THEN GOTO COMPMESEG5
IF C2<>5 THEN GOTO COMPMESEG1
IF RM<>6 THEN GOTO COMPMESEG3
ItemLoc[5]=-1
ItemLoc[6]=RM
PRINT "A Candy bar comes out.",100,100;GOTO COMPROUTINE

// Type
// KEYIN was line 1500
KEYIN:
IF C2 = 0 THEN GOTO COMPMESEG5
IF RM <> 10 THEN GOTO COMPMESEG3
IF CA = 0 THEN PRINT "The Computer isn't running.",100,100;GOTO COMPROUTINE
IF LI <> 0 THEN GOTO COMPLOGIN

// LOGIN was line 1600
COMPLOGIN:
IF CP = 0 THEN GOTO TAPEUNIT
IF C2 <= 12 THEN PRINT "'Invalid Command'",100,100;GOTO COMPROUTINE
IF C2 = 13 THEN PRINT "'Copy Logu Adven'",100,100;GOTO COMPROUTINE
IF C2 = 14 THEN PRINT "'Welcome to Adventure w#uld y#$*'" ,100,100;CT=9;GOTO COMPROUTINE
IF C2 = 5 THEN PRINT "'Mount Tape then type file name'" ,100,100;CP=-1;GOTO COMPROUTINE
PRINT "'logged out.'" ,100,100; LI =0 ;GOTO COMPROUTINE



// Take

// TAKE was line 1800
TAKE:
IF C2 = 0 THEN GOTO COMPMESEG5
IF ItemFlag[C2]=0 THEN
PRINT "That's beyond your ability.",100,100;GOTO COMPROUTINE
IF ItemLocF = 0 THEN
PRINT "you've already got it!",100,100;GOTO MAIN
IF C2=4 AND CF=0 THEN
PRINT "'There was a coin under it.'",100,100;
ItemLoc[5]=RM
CF=-1
IF C2=2 THEN MT=0
ItemLoc[C2]=0
GOTO COMPMESEG

// Drop
// DROP was Line 1900
DROP:
IF C2=0 THEN GOTO COMPMESEG5
IF ItemLocF <>0 THEN PRINT "You Don't have it.",100,100;GOTO MAIN
ItemLoc[C2]=RM
 IF RM <> 4 OR C2 <> 6 THEN GOTO COMPMESEG
PRINT "The rats devour the candy and get sleepy.",100,100
TD$[1]="SLEEPY RATS"
ItemLoc[6]=-1
RatFight=0
GOTO COMPMESEG

// Inventory
// INVENTORY was Line 2000
INVENTORY:
K=0;PRINT "You are carrying:",100,100
FOR I = 1 TO NT
IF ItemLoc[i]=0 THEN PRINT TD$[i], 200,200 ;K=1
NEXT
IF K=0 THEN PRINT "Nothing.",100,100
GOTO COMPROUTINE

// Mount
// MOUNT was Line 2100
MOUNT:
IF C2=0 THEN GOTO COMPMESEG5
IF C2<>2 THEN GOTO COMPMESEG1
IF RM<>10 OR MT<>0 THEN GOTO COMPMESEG2
ItemLoc[2]=RM
MT=-1
GOTO COMPMESEG

// Read
// PEER was Line 2200
PEER:
IF C2=0 THEN GOTO COMPMESEG5
IF C2=3 THEN PRINT "'Insert Coin'",100,100;GOTO COMPROUTINE
IF C2 <> 10 THEN PRINT "Nothing is written on it.",100,100;GOTO COMPROUTINE
PRINT "'...User ID is Road...'",100,100
PRINT "'Type DIR for list of commands...'",100,100
PRINT "The rest is illegible.",100,100;GOTO COMPROUTINE

// Fight
// FIGHT was line 2300
FIGHT:
PRINT "That won't work",100,100;GOTO COMPROUTINE

// Start
// START was Line 2400
START:
IF C2=0 THEN GOTO COMPMESEG5
IF C2=7 THEN GOTO COMPMESEG2
GOTO COMPMESEG1

// Open
// OPEN was LINE 2500
OPEN:
IF C2=0 THEN GOTO COMPMESEG5
IF C2<>9 THEN GOTO COMPMESEG1
IF MF <> 0 THEN PRINT "it Already is.",100,100;GOTO COMPROUTINE
PRINT "inside it is a manual.",100,100;ItemLoc[10]=RM;MF=-1;GOTO COMPROUTINE

// Look
// LOOK was Line 2600
LOOK:
IF C2 <> 0 THEN GOTO COMPMESEG4
WD=-1; GOTO COMPROUTINE

// Wind
// WIND was Line 2700
WIND:
IF C2 <> 11 THEN GOTO COMPMESEG1
IF BT=0 THEN PRINT "It's fully wound.",100,100;GOTO COMPROUTINE
PRINT "the clock chimes loudly and something flies past.",100,100
BT=0
ItemLoc[8]=-1
GOTO COMPROUTINE

// Examine
// EXAMINE was Line 2800
EXAMINE:
IF C2=3 OR C2=10 THEN PRINT "something is written there.",100,100;GOTO COMPROUTINE
IF C2=9 AND MF=0 THEN PRINT "it is closed.",100,100;GOTO COMPROUTINE
IF C2=4 THEN PRINT "it looks beyond repair.",100,100;GOTO COMPROUTINE
IF C2=7 THEN PRINT "this is an ancient Mainframe with a console.",100,100;GOTO COMPROUTINE
IF C2=11 THEN PRINT "there is a large handle for winding the clock.",100,100;GOTO COMPROUTINE
IF C2=2 AND MT<>0 THEN PRINT "it is mounted on the computer.",100,100;GOTO COMPROUTINE
PRINT "You see nothing special.",100,100;GOTO COMPROUTINE

// TAPEUNIT was Line 1700
TAPEUNIT:
CP=0;IF C2 <= 12 THEN PRINT "'No Such File.'", 100,100; GOTO COMPROUTINE
IF MT=0 THEN PRINT "'Error Tape not Mounted'" ,100,100; GOTO COMPROUTINE
PRINT "'The TAPE Spins...'",100,100;
FOR I = 1 TO 500 ;
NEXT
PRINT "'File Copied.'",100,100
IF C2=14 THEN PRINT "'Congratulations, You've done it!'",100,100; END
GOTO COMPROUTINE

// Completion Messages
// COMPMESEG was Line 8000
COMPMESEG:
PRINT "OK.",100,100;GOTO COMPROUTINE
// COMPMESEG1 was Line 8010
COMPMESEG1:
PRINT "That's Silly!",100,100;GOTO MAIN
// COMPMESEG2 was Line 8020
COMPMESEG2:
PRINT "Nothing Happens.",100,100;GOTO COMPROUTINE
// COMPMESEG3 was Line 8030
COMPMESEG3:
PRINT "You can't do that now.",100,100;GOTO COMPROUTINE
// COMPMESEG4 was Line 8040
COMPMESEG4:
PRINT "Who's your English Teacher?",100,100;GOTO MAIN
// COMPMESEG5 was Line 8050
COMPMESEG5:
PRINT "Please give an object.",100,100;GOTO MAIN
// Completion Routines
// COMROUTINE was Line 8200
COMPROUTINE:
IF CA=0 THEN GOTO COMPROUTINE2
CT=CT+1;IF CT < 10 THEN GOTO COMPROUTINE2
IF RM = 10 THEN PRINT "The Computer dies with a loud pop and puff of blue smoke.",100,100
CD=-1
CA=0
TD$[7]="Dead Computer"
// COMRUT2 was Line 8300
COMPROUTINE2:
IF RM=ItemLoc[8] THEN PRINT "A Hoard of Rats carries you out.",100,100;
RM=1
WD=-1
GOTO MAIN
// Moved Data from end of program into arrays
// FIN was Line 9999
FIN:
END
EDIT by Schranz0r:

Please use the codetag:


(code) some code (/code), just replace  ( ) with [ ] !!

Thx
#7
I've had the same problem with array assignments
usually the complier give an error something like this:

C:/Users/shaf/AppData/Local/Temp/glbasic/gpc_temp0.cpp:195: error: invalid initialization of reference of type '__GLBASIC__::DGIntArray&' from expression of type 'DGInt'
C:/Program Files (x86)/GLBasic/Compiler/platform/Include/glb.h:407: error: in passing argument 1 of `void __GLBASIC__::DIM(__GLBASIC__::DGIntArray&, DGInt, DGInt, DGInt, DGInt)'
C:/Users/shaf/AppData/Local/Temp/glbasic/gpc_temp0.cpp:197: error: `__GLBASIC__::AC' cannot be used as a function
C:/Users/shaf/AppData/Local/Temp/glbasic/gpc_temp0.cpp:199: error: `__GLBASIC__::AC' cannot be used as a function
C:/Users/shaf/AppData/Local/Temp/glbasic/gpc_temp0.cpp:201: error: `__GLBASIC__::AC' cannot be used as a function
C:/Users/shaf/AppData/Local/Temp/glbasic/gpc_temp0.cpp:203: error: `__GLBASIC__::AC' cannot be used as a function

The AC array is my Primarry array for the text adventure I'm working on.

Shaf
#8
How do I capture the Compiler Output log to troubleshoot Compiler errors?

I've Tried Copying from the Compiler Output console but nothing gets pasted into notepad. Is there a switch to enable the output.

Also is there a way to enable a Line Number Display to help in debugging.

Thanks

Shaf
#9
Bigsofty,
I tried using the Select Method and got a syntax error immediately in the debugger.
CASE 0 GOTO Line100

OK I found the error GOTO doesn't work it preceeded by THEN
So CASE 0 THEN GOTO Line100 works
#10
Gernot

I've already got a Nintendo DS for Homebrew but might Get a GP2X F200. I've checked the Apps and Emulators on the GP2X and there's some stuff I'd really like especially a good Amiga Emulator.

Shaf
#11
BumbleBee

Although I have Children If Hungery & MCDonalds can't be used in the same statement.
;}

Shaf
#12
Bigsofty is correct,
Ordinarily I wouldn't use goto but since I'm rewriting some very old Basic Programs (1983) unless I totally Restructure and rewrite the Program it's the only way to do it. Unfortunately I didn't save my Programming Flowcharts. If you think that's bad you should see some of my Assembler Coding I used to program ML for 8008, 1802, 6502 and 68000.

Shaf
#13
I think I'm going to write a Help file as soon as I get more familiar with GLBasic -comparing GLBasic to Basic.

Obviously arrays are handled slightly differently, as well as data calls.
I think I can Replace the Basic LEFT$ & RIGHT$ commands with MID$
Command separators are different Basic uses : and GLBasic uses ;

Is there an way to do this in GLBasic

ON C1 GOTO 1000,1000,1000,1000,1000,1100,1200,1300,1400

I'm thinking
IF C1 GOTO 1000, 1000 ... but GOTO only allows one call. Should I turn C1 into an array and do the following
For N = 1 to 9
IF C1[1} goto 1000
IF C1[2} goto 1000
IF C1[3} goto 1000
IF C1[4} goto 1000
IF C1[5} goto 1000
IF C1[6} goto 1100
IF C1[7} goto 1200
IF C1[8} goto 1300
IF C1[9} goto 1400
next
#14
I think I understand how DIMDATA works but how would I use it for a 2 Dimensional array

What I've done currently is Split the array into multiple lines like so:

// --------------------------------- //
// Project: Tower of Mystery
// Start: Tuesday, November 06, 2007
// IDE Version: 5.062
//
// declare constants
//
// NR number of rooms
// NT number of things/items
// NP number of Pseudo-Objects (all other Objects)
// NO number of objects of all kinds
// NV number of verbs
//
// declare Flags
//
// CA Computer Active (in-game)
// CD Computer is Dead
// LI Character is logged into computer
// CP COPY of program is running on computer
// MF Computer Manual Found
// CF Coin Found
// WD Room description request flag
// RT Rats are Troublesome
// BT Bats are troublesome
// CT Time since computer was started
//
// General Variables
//
// C$  Command input
// C1$ First word of command
// C2$ Second Word of command
// C1  Verb token
// C2 Object token
// RM Room currently occupied
//
// Arrays
//
// AC[NR][6] Access Array
// VB$[NV] Verb array
// OB$[NO] Object Array
// RM$[NR] Room description array
// TD$[NT] Item description array
// VN[NV]  Verb token array
// TL[NT]  Item Location Array
// TF[NT]  Item Flag array (for can item be carried)
//
// Directions can be numeric or alpha
//
// 1 N  North
// 2 S  South
// 3 E  East
// 4 W  West
// 5 U  Up
// 6 D  Down
//
//
GLOBAL NR, NT, NP, NV, NO, RM, CT, CF, RT, CA, MF, CD, WD, LI, BT, VB$, OB$, RM$, TD$, VN, TL, TF
NR=14
NT=11
NP=11
NV=29
NO=NT+NP
DIM AC[NR][6]
DIM VB$[NV]
DIM OB$[NO]
DIM RM$[NR]
DIM TD$[NT]
DIM VN[NV]
DIM TL[NT]
DIM TF[NT]
// Initialization of Variables
RM= 1
CT= 0
CF= 0
RT= -1
CA= 0
MF= 0
CD= 0
WD= -1
LI= 0
BT= -1
FOR I = 1 TO NR
DIMDATA RM$[], "You are in the front of an old factory with a Clock tower." ,"You are at the bottom of a stairwell." ,"You are at the top of the basement steps." ,"You are in a damp cellar." ,"You are in a storeroom." ,"You are in the cafeteria." ,"You are at a landing on the stairs." ,"Around you is a manufacturing area." ,"You are at a landing on the third floor." ,"You are in the Computer room." ,"You are inside the Clock Tower." ,"You are at the top of the stairs." ,"You are in a long corridor going east." ,"You are at the east end of the corridor."
// DATA "You are in the front of an old factory with a Clock tower."
// DATA "You are at the bottom of a stairwell."
// DATA "You are at the top of the basement steps."
// DATA "You are in a damp cellar."
// DATA "You are in a storeroom."
// DATA "You are in the cafeteria."
// DATA "You are at a landing on the stairs."
// DATA "Around you is a manufacturing area."
// DATA "You are at a landing on the third floor."
// DATA "You are in the Computer room."
// DATA "You are inside the Clock Tower."
// DATA "You are at the top of the stairs."
// DATA "You are in a long corridor going east."
// DATA "You are at the east end of the corridor."
NEXT
FOR I = 1 TO NV
// READ VB$,VN;
DIMDATA VB$[], "N","S","E","W","U","D","GO","EAT","KICK","INSERT","DEPOSIT","TYPE","TAKE","GET","DROP","THROW","INVENTORY","I","INV","MOUNT","READ","FIGHT","KILL","START","POWER","OPEN","QUIT","LOOK","WIND","EXAMI","EXAMINE"
DIMDATA VN[], 1,2,3,4,5,6,7,8,9,10,10,11,12,12,13,13,14,14,14,15,16,17,17,18,18,19,20,21,22,23,23
// DATA N,1,S,2,E,3,W,4,U,5,D,6,"GO",7,"EAT",8,"KICK",9,"INSERT",10,"DEPOSIT",10,"TYPE",11
// DATA "TAKE",12,"GET",12,"DROP",13,"THROW",13,"INVENTORY",14,I,14,"INV",14,"MOUNT",15,"READ",16
// DATA "FIGHT",17,"KILL",17,"START",18,"POWER",18,"OPEN",19,"QUIT",20,"LOOK",21
// DATA "WIND",22,"EXAMI",23,"EXAMINE",23
 NEXT
FOR I = 1 TO NO;
// READ OB$;
DIMDATA OB$[], "RATS","TAPE","MACHINE","TERMINAL","COIN","CANDY","COMPUTER","BATS","DESK","MANUAL","CLOCK","ROAD","DIR","ADVEN","COPY","LOGOUT","NORTH","SOUTH","EAST","WEST","UP","DOWN"
// DATA "RATS","TAPE","MACHINE","TERMINAL","COIN","CANDY","COMPUTER","BATS","DESK","MANUAL","CLOCK","ROAD"
// DATA "DIR","ADVEN","COPY","LOGOUT","NORTH","SOUTH","EAST","WEST","UP","DOWN"
 NEXT
FOR I = 1 TO NT
// READ TD$,TL,TF
DIMDATA TD$[], "HUNGRY RATS", "COMPUTER TAPE", "VENDING MACHINE", "BROKEN-DOWN TERMINAL", "COIN", "CANDY BAR", "COMPUTER","BATS","DESK","COMPUTER MANUAL","ELABORATE CLOCKWORK"
DIMDATA TL[], 4,5,6,8,-1,-1,10,13,14,-1,11
DIMDATA FT[], 0,1,0,1,1,1,1,0,0,1,0
// DATA "HUNGRY RATS",4,0,"COMPUTER TAPE",5,1,"VENDING MACHINE",6,0
// DATA "BROKEN-DOWN TERMINAL",8,1,"COIN",-1,1,"CANDY BAR",-1,1,"COMPUTER",10,1
// DATA "BATS",13,0,"DESK",14,0,"COMPUTER MANUAL",-1,1,"ELABORATE CLOCKWORK",11,0
 NEXT
FOR I = 1 TO NR
// READ AC[1],AC[2],AC[3],AC[4],AC[5],AC[6]
// DIMDATA AC[NR][6], 2,0,0,0,0,0,3,1,0,0,7,0,0,2,0,0,0,4,0,0,5,0,3,0,0,0,0,4,0,0,0,0,7,0,0,0,0,0,10,0,12,7,0,0,0,9,0,0,0,12,0,0,0,0,11,0,13,0,0,9,0,0,14,12,0,0,0,0,0,13,0,0
DIMDATA AC[], 2,3,0,0,0,0,0,0,0,0,0,11,0,0
DIMDATA AC[], 0,1,2,0,0,0,0,0,0,0,12,0,0,0
DIMDATA AC[], 0,0,0,5,0,7,8,0,10,0,0,13,14,0
DIMDATA AC[], 0,0,0,0,4,0,6,7,0,9,0,0,12,13
DIMDATA AC[], 0,7,0,3,0,0,9,0,12.0,0,0,0,0
DIMDATA AC[], 0,0,4,0,0,0,2,0,7,0,0,9,0,0
// DATA 2,0,0,0,0,0
// DATA 3,1,0,0,7,0
// DATA 0,2,0,0,0,4
// DATA 0,0,5,0,3,0
// DATA 0,0,0,4,0,0
// DATA 0,0,7,0,0,0
// DATA 0,0,8,6,9,2
// DATA 0,0,0,7,0,0
// DATA 0,0,10,0,12,7
// DATA 0,0,0,9,0,0
// DATA 0,12,0,0,0,0
// DATA 11,0,13,0,0,9
// DATA 0,0,14,12,0,0
// DATA 0,0,0,13,0,0
 NEXT
#15
I perferred the structuring of Pascal to Basic, COMAL had some interesting features and preferred Fortran for mathematics.