arrays declared at the begining of the program are global and can be seen by all functions.
variables and arrays declared inside a function can only be seen by the function using them
All variables by default are integers unless you declare them as a string using the $ after them. so you dont have to declare them As integer.
if you need an array to be local and accessable only to a particular function simply declare one inside the function but make sure you use UNdim before exiting the function to release the resources used.
out of bounds error :
BN2 Productions covered this nicely.
additional array notes :
arrays in dbc are zero based making the last element in any given array null. this means you should never assign a value to the last element otherwise the data will for the entire array will become corrupted so if you need:
somearray(3,3,3) or anotherarray(5)
then declare :
somearray(4,4,4) / anotherarray(6)
since arrrays in dbc are zero based, it also means that the first element in any given array is 0 so you
Can do this :
dim anotherarray(5)
for i=0 to 4
anotherarray(i)=499
next i
dynamic arrays is not a strong point of dbc, you can not dim an array and then resize them on the fly without problems but you can write a small snip of code that can get the size that you will need to use before declare them [plan carefully ]
functions remember values :
always assign a default value for any variables at the begining of function
unless you want it use the value that was prevously there as old values
do stay in memory
function anyfunction()
`levaing out getout=0 will make the function exit on the next `execution
getout=0
repeat
if mouseclick()=1 : getout=1 : endif
until getout>0
endfunction
Quote: "oh and you can't dim arrays in functions(well i can't i tried but they never work"
caleb, I have never had this problem except when I used an older version. Are you using an the old cd version ?
bluestar4~
---Missle Might - Hero Battles - Zillipede --- which do you like the best ?