Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DATA coordinates & Illegal function calls
#1
Well, this is a continuation really from my old post, DATA not coming out right. I got it so that the data are actual rational integers and whatnot, but now for no reason at all, that I can see, it says that there is an illegal function call.

Here is what happens. I make a file, such as "1.plc" which holds coordinates for all the trees on that particular screen.

Code:
'$DYNAMIC
DEFINT A-Z
DIM SHARED PLACEX(50) AS INTEGER
DIM SHARED PLACEY(50) AS INTEGER
OPEN "1.plc" FOR RANDOM AS #1
FOR I = 1 TO 5
PUT #1, , PLACEX(I)
PUT #1, , PLACEY(I)
NEXT I
CLOSE #1

DATA 0,0,1,1,2,2,3,3,4,4,5,5   '<-- made these up

And then, to receive the code back on the other end, just do the same thing, only without the DATA and GET instead of PUT.

Code:
'$DYNAMIC
DEFINT A-Z
DIM SHARED PLACEX(50) AS INTEGER
DIM SHARED PLACEY(50) AS INTEGER

'^ THIS WOULD BE FURTHER UP IN THE PROGRAM^

OPEN "1.plc" FOR RANDOM AS #1
FOR I = 1 TO 5
GET #1, , PLACEX(I)
GET #1, , PLACEY(I)
NEXT I
CLOSE #1

And then, using the coordinates given by the file, the program is supposed to place a .PUT image file (PP256) on the given spot. The result for one place when I was testing this theory was great, it cut back on a lot of programming within the module, but when I tried to mass produce the said files, I ran into trouble.

Illegal Function Call, it says when you try to move to a new screen. It doesn't make any sense, because SCREEN 1 works and SCREEN 2 doesn't work. (NOTE, when I say SCREEN, I mean that in the program there are different screens, like you move to the edge of one and get onto the next one, not the actual syntax 'screen.') I can post code later, if it helps you, but the above is pretty much the same.
ovaProgramming.

One night I had a dream where I was breaking balls. The next morning, BALLSBREAKER was born.

Quote: Excellent. Now you can have things without paying for them.

BALLSBREAKER 2
~-_-Status Report-_-~
Engine: 94%
Graphics: 95%
Sound: 100%
A Severe Error has crippled BB2 for the time being... I have to figure it out, but until then you won't see much of it Sad.
-----------------------------
Reply
#2
You forgot to "READ" the data:

Code:
'$DYNAMIC
DEFINT A-Z
DIM SHARED PLACEX(50) AS INTEGER
DIM SHARED PLACEY(50) AS INTEGER
OPEN "1.plc" FOR RANDOM AS #1
RESTORE
FOR I = 1 TO 5
READ PLACEX(I)
READ PLACEY(I)
PUT #1, , PLACEX(I)
PUT #1, , PLACEY(I)
NEXT I
CLOSE #1

DATA 0,0,1,1,2,2,3,3,4,4,5,5   '<-- made these up
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#3
A good tip while testing such progs would be that always check whether the contents have been written correctly. Dont write to the file in RANDOM format. First try it with a normal text file and then when u are sure that your prog is not writing wrong info to the file only then continue with ur prog.
Reply
#4
LoL Nathan my bad, I DO have that in there in the original code, I was just giving an example... SO, I DO READ THE DATA... sorry heheh.

What other formats are there besides RANDOM? I have tried BINARY and some of the other ones found in QBOHO but RANDOM is the only one that wants to work with me...
ovaProgramming.

One night I had a dream where I was breaking balls. The next morning, BALLSBREAKER was born.

Quote: Excellent. Now you can have things without paying for them.

BALLSBREAKER 2
~-_-Status Report-_-~
Engine: 94%
Graphics: 95%
Sound: 100%
A Severe Error has crippled BB2 for the time being... I have to figure it out, but until then you won't see much of it Sad.
-----------------------------
Reply
#5
BINARY will do exactly in the same way you're using it. I'd suggest you to use DIM blah AS or use suffixes, as it is very important that if you write an INTEGER you read an INTEGER, or things will turn out messy.

Then the post that TheBigBasicQ wrote applies Wink
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#6
Another thing to note is that you can't have remarks after a DATA statement. Unless you use a colon.
url=http://www.spreadfirefox.com/?q=affiliates&id=60131&t=79][Image: safer.gif][/url]
END OF LINE.
Reply
#7
Quote:LoL Nathan my bad, I DO have that in there in the original code, I was just giving an example... SO, I DO READ THE DATA... sorry heheh.

What other formats are there besides RANDOM? I have tried BINARY and some of the other ones found in QBOHO but RANDOM is the only one that wants to work with me...

Could you post the particular code which is giving you trouble? I think that would help debug it faster.
Reply
#8
Well, the above is basically a SAMPLE of what I am doing, but here is a SAMPLE of the real thing. I do this over and over about like 40 times or something messed up like that.

Code:
'2
FOR i = 1 TO 28
READ placex(i)
READ placey(i)
NEXT i
OPEN "2.plc" FOR RANDOM AS #1
FOR i = 1 TO 28
PUT #1, , placex(i)
PUT #1, , placey(i)
NEXT i
CLOSE #1
DATA 1,195,100,195,200,195,1,1,100,1,200,1,300,195,300,1,37,137,74,106,140
DATA 152,121,106
DATA 102,36,33,59,93,74,181,25,161,60,199,123,160,104,225,80,265,30,273,151
DATA 249,159
DATA 250,122,195,60,95,160,30,11,137,17

'201
FOR i = 1 TO 21
READ placex(i)
READ placey(i)
NEXT i
OPEN "201.plc" FOR RANDOM AS #1
FOR i = 1 TO 21
PUT #1, , placex(i)
PUT #1, , placey(i)
NEXT i
CLOSE #1
DATA 1,195,100,195,200,195,300,195,1,1,1,100,315,1,315,100,48,45,39
DATA 140,95,91,120,43
DATA 261,152,179,124,228,59,181,26,96,149,160,90,86,13,266,12,13,19

And that goes on and on, writing the files.

Code:
IF place = 2 THEN
OPEN "2.plc" FOR BINARY AS #1
FOR i = 1 TO 28
GET #1, , placex(i)
GET #1, , placey(i)
NEXT i
CLOSE #1
harloadput "hwall.put", myarray()
FOR i = 1 TO 6
PUT (placex(i), placey(i)), myarray, PSET
NEXT i
harloadput "hwallsh.put", myarray()
PUT (placex(7), placey(7)), myarray, PSET
PUT (placex(8), placey(8)), myarray, PSET
harloadput "evgrntre.put", myarray()
FOR i = 9 TO 28
PUT (placex(i), placey(i)), myarray, PSET
NEXT i
END IF
IF place = 201 THEN
OPEN "201.plc" FOR BINARY AS #1
FOR i = 1 TO 21
GET #1, , placex(i)
GET #1, , placey(i)
NEXT i
CLOSE #1
harloadput "hwall.put", myarray()
FOR i = 1 TO 3
PUT (placex(i), placey(i)), myarray, PSET
NEXT i
harloadput "hwallsh.put", myarray()
PUT (placex(4), placey(4)), myarray, PSET
harloadput "vwall.put", myarray()
FOR i = 5 TO 8
PUT (placex(i), placey(i)), myarray, PSET
NEXT i
harloadput "evgrntre.put", myarray()
FOR i = 9 TO 21
PUT (placex(i), placey(i)), myarray, PSET
NEXT i
END IF

And that code goes on, corresponding to the above code amounts...

I guess this might be an extremely BAD way of doing things, or maybe not... I dunno, just give me examples on how I could make it better (preferably shorter?) and I'll oblige.
ovaProgramming.

One night I had a dream where I was breaking balls. The next morning, BALLSBREAKER was born.

Quote: Excellent. Now you can have things without paying for them.

BALLSBREAKER 2
~-_-Status Report-_-~
Engine: 94%
Graphics: 95%
Sound: 100%
A Severe Error has crippled BB2 for the time being... I have to figure it out, but until then you won't see much of it Sad.
-----------------------------
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)