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.

DarkBASIC Discussion / array help!

Author
Message
CaiF_R
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location:
Posted: 27th Jan 2003 03:31
Iam still trying to understand the use of arrays. I think i´ve got it but lets say u array the inventory for a rpg char... how can i then print it all to the screen without the use of:
PRINT INV$(1)
PRINT INV$(2)
PRI...ect..

I cant use PRINT
what i´ve been practicing...
CaiF_R
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location:
Posted: 27th Jan 2003 03:40
That didnt went well Hard to figured out what i meant, right??

dim test(2)
test(1)=3
test(2)=6

... how can i then print the entire array??

I cant use ex.
print test(2)
.. cuz that would refer to the variable in the array

indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 27th Jan 2003 04:09
You could deploy a loop and the text command

the STR$() command converts integers to strings as the text
command only wants to know about the output as a string.


for i = 1 to 10
text 10,15*i,"text line "+STR$(i)
next i

indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 27th Jan 2003 04:10
so in your case

for i = 1 to 5
text 10,15*i,"inventory space:"+STR$(i) + " = " + INV$(5)
next i

indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 27th Jan 2003 04:10
CaiF_R
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location:
Posted: 27th Jan 2003 04:22
Oh.. So if iam getting this right then the "for" cmd i actualy "counting" its way trough the array?? Well how does that work i x-dimensioned arrays (dim test$(3,3) ex.)??

Thanx! Already helped me alot

CaiF_R
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location:
Posted: 27th Jan 2003 04:27
Prob a stupid question but can arrays store bitmaps???
Or store the bitmap nr.??

indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 27th Jan 2003 06:40
hehe question 1 u could use two loops!

q2 u could store the actual bitmap data in an array.

CaiF_R
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location:
Posted: 27th Jan 2003 07:40
Thanx again
Another db newbie saved there

Login to post a reply

Server time is: 2024-05-05 01:14:11
Your offset time is: 2024-05-05 01:14:11