Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / array promblems

Author
Message
TravisP
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location: Behind you, with a knife!
Posted: 22nd Aug 2004 12:44
I am making a level editor for my breakout game and i get an array out of bounds error. If i rem these 2 lines I get no error.
20 area(z,a,3)=20+y
58 if area(z,a,0)=1 then sprite area(z,a,1),area(z,a,2),area(z,a,3),2


Good thing everyone here is a figment of my imagination.
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 22nd Aug 2004 13:03
DBC or DBP? I get no error with DBP 5.6 beta 2

TravisP
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location: Behind you, with a knife!
Posted: 22nd Aug 2004 13:04
DBP ver 5.5

Good thing everyone here is a figment of my imagination.
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 22nd Aug 2004 13:07 Edited at: 22nd Aug 2004 13:20
I do not have your images or their sizes but subbing a random image in it seems to be working correctly. You may want to upgrade

[edit] Just for testing. What happens when you change this
dim area(11,19,3)
to this
dim area(12,20,4)
?

TravisP
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location: Behind you, with a knife!
Posted: 22nd Aug 2004 13:22
the upgrade didnt work but that did thx!

Good thing everyone here is a figment of my imagination.
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 22nd Aug 2004 13:47
It is counting the index 0 as 1 instead of 0. I ran into this a long time ago but I thought it was fixed now. (it is fixed on my machine with DBP 5.6 beat 2). Thats odd. Well it seems it is still lingering about somehow Glad its working.

CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 22nd Aug 2004 13:49 Edited at: 22nd Aug 2004 13:50
dbp 5.6 beta 2??

EDIT: Went and looked... OH!


DBP_NETLIB_v1.4.3 - 65 FREE Functions * Click Logo
TravisP
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location: Behind you, with a knife!
Posted: 22nd Aug 2004 14:14
agh another bug =/
im now working a way to turn all the blocks postions in a string so I
can save into text and put into main game. but now im getting wierd results
save:
yellow$=""
if controlkey()=1

for z=0 to 11
for a=0 to 19

if area(z,a,0)=1
yellow$=yellow$+":yellow(",str$(yel),",0)=",str$(spr)
yellow$=yellow$+":yellow(",str$(yel),",1)=1"
yellow$=yellow$+":yellow(",str$(yel),",2)=",str$(area(z,a,2)+1)
yellow$=yellow$+":yellow(",STR$(yel),",3)=",STR$(area(z,a,3))
yellow$=yellow$+":yellow(",STR$(yel),",4)=",str$(area(z,a,2))
yellow$=yellow$+":yellow(",STR$(yel),",5)=",str$(area(z,a,2)+49)
yellow$=yellow$+":yellow(",STR$(yel),",6)=",str$(spr+1)
yellow$=yellow$+":yellow(",str$(yel),",7)=",str$(spr+2)
spr=spr+3
yel=yel+1
endif
next a
next z
print yellow$
wait key
endif
return
this works but but the my arrays and var. will not go into it all i get is like yellow(:yellow(:.etc and even stranger if i take out the wait key it gives me an error. =/

Good thing everyone here is a figment of my imagination.
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 22nd Aug 2004 15:09 Edited at: 22nd Aug 2004 15:12
Quote: "yellow$=yellow$+":yellow(",str$(yel),",0)=",str$(spr)"

you got some kind of wierd thing going there. What exactly do you want to happen there? I can't follow it.
Or did you want it to do
Quote: "yellow$=yellow$+":yellow("+str$(yel)+",0)="+str$(spr)"
?

Try this


TravisP
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location: Behind you, with a knife!
Posted: 23rd Aug 2004 02:22
thx that worked! that was pretty stupid of me o yea one last question im trying to save the $'s to a file but it seems to not be writing here it is


Good thing everyone here is a figment of my imagination.
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 23rd Aug 2004 06:41
don`t make the file, just open a file to save to and then save data to it, check the file does not exist first or it will fail, make file just makes a file, you can`t seem to do anything with it though (apart from rename it or delete it), I use make file to set a "ran once" flag, so the next time the program runs, if that file exists it doesnt do the intro anim for example.

open to write "file",1
write byte 1,250
close file 1

will work, but

make file "file"
open to write "file",1
write byte 1,250
close file 1

will not, open to write will the file for you, it just fails if the file exists.

Mentor.

PC1: P4 hyperthreading 3ghz, 1gig mem, 2x160gig hd`s, Nvidia FX5900 gfx, 6 way surround sound, PC2: AMD 2ghz, 512mb ram, FX5200 ultra gfx, stereo 16 bit soundblaster.
TravisP
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location: Behind you, with a knife!
Posted: 23rd Aug 2004 06:52
thx Metor
I also figured its easyier to save arrays in file instead of making the code into a txt and manualy putting in game =D
now its working no promblem
if anyone wants see completed code look in source

Good thing everyone here is a figment of my imagination.

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 23rd Aug 2004 09:39
Glad you got it going

Login to post a reply

Server time is: 2024-09-22 22:15:08
Your offset time is: 2024-09-22 22:15:08