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 / Data command.

Author
Message
z i l c h vortex
17
Years of Service
User Offline
Joined: 20th Feb 2007
Location: united kingdom
Posted: 18th Mar 2009 01:47
I dont seem to know if this is possible but im trying to store a data command in an array but im totally lost. Heres my pathetic code .


It has totally bafled me could some one give a descrition on how to do it.

life is short but so am i
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 18th Mar 2009 02:02
The problem is that you're calling the array a different way every time. Check out this and see if it answers your questions:

http://forum.thegamecreators.com/?m=forum_view&t=84908&b=7



z i l c h vortex
17
Years of Service
User Offline
Joined: 20th Feb 2007
Location: united kingdom
Posted: 18th Mar 2009 02:09
i read through that the other day it dont say anything about the data command so im lost .

Thank you very much anyways.

life is short but so am i
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 18th Mar 2009 02:16
Well, it isn't what you are doing with the data command that's messing the code up, it's your method of referencing arrays.

If you have the array test$(2,3), think of it as 12 seperate variables that just happen to be easily accessable with numbers. You can't just put something into test$(). Neither can you just put something into test$(2). You have to specify an exact location, such as test$(1,2) or test$(0,1).

Also, the values in your data statement are integers, and the array test$(0,0) that you are trying to read them into is a string.

I'm assuming you want to read the data into the array in order and then print it back in order. In that case, try this:





z i l c h vortex
17
Years of Service
User Offline
Joined: 20th Feb 2007
Location: united kingdom
Posted: 18th Mar 2009 02:52
Ooo thank you very much works perfectly one last question how would i check how many numbers are a certain number or how to check if a number is in a certain array.

life is short but so am i
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 18th Mar 2009 03:24
Scan through each item of the array and increase a variable each time you find that value:





z i l c h vortex
17
Years of Service
User Offline
Joined: 20th Feb 2007
Location: united kingdom
Posted: 18th Mar 2009 18:05
Cheers this has helped me alot.

Thank you BmacZero.

life is short but so am i

Login to post a reply

Server time is: 2024-11-24 11:52:31
Your offset time is: 2024-11-24 11:52:31