Custom Types are in DBP.
Arrays:
Sample program:
This example creates a 2-dimension array.
It then fills random areas of the array with random numbers.
Then it displays the value of random locations of the array.
`Make resaults diffrent every run
randomize timer()
`Make a 2d array
DIM arrayname(10,10)
`For loop
for i=1 to 50 step 1
`A random position in the array = a random number
arrayname(rnd(9)+1,rnd(9)+1) = rnd(1000)
`End of for loop
next
`Do loop
do
`i1 = random number from 1-10
i1=rnd(9)+1
`same with i2
i2=rnd(9)+1
`print the number in a random location in the array
print str$(i1)+" - "+str$(i2)+" = "+str$(arrayname(i1,i2))
`wait a little
wait 500
`end of do loop
loop
Code to store bot names and types:
Type 1 is hostile1
Type 2 is nutrul1
Type 3 is friendlyL1
Type 4 is friendlyM1
Type 5 is friendlyH1
Type 6 is hostile2
Type 7 is nutrul2
Type 8 is friendlyL2
Type 9 is friendlyM2
Type 10 is friendlyH2
Use space to modify a bot and control to lookup a bot.
The code:
dim bottypes(10)
bottypes(1)=1
bottypes(2)=1
bottypes(3)=1
bottypes(4)=1
bottypes(5)=1
bottypes(6)=1
bottypes(7)=1
bottypes(8)=1
bottypes(9)=1
bottypes(10)=1
do
if spacekey()=1
input "Which bot(1-10)? ",botnum
if botnum<1 or botnum>10 then goto addfail
input "Change to what type(1-10)? ",bottype
if bottype<1 or botntype>10 then print "Invalid" : goto addfail
bottypes(botnum)=bottype
if bottype=1 then print "botnum "+str$(botnum)+" is now hostile1"
if bottype=2 then print "botnum "+str$(botnum)+" is now nutrul1"
if bottype=3 then print "botnum "+str$(botnum)+" is now friendlyL1"
if bottype=4 then print "botnum "+str$(botnum)+" is now friendlyM1"
if bottype=5 then print "botnum "+str$(botnum)+" is now friendlyH1"
if bottype=6 then print "botnum "+str$(botnum)+" is now hostile2"
if bottype=7 then print "botnum "+str$(botnum)+" is now nutrul2"
if bottype=8 then print "botnum "+str$(botnum)+" is now friendlyL2"
if bottype=9 then print "botnum "+str$(botnum)+" is now friendlyM2"
if bottype=10 then print "botnum "+str$(botnum)+" is now friendlyH2"
addfail:
endif
if controlkey()=1
input "Which bot(1-10)? ",botnum
if botnum<1 or botnum>10 then print "Invalid" : goto viewfail
bottype=bottypes(botnum)
print bottype
if bottype=1 then print "botnum "+str$(botnum)+" is hostile1"
if bottype=2 then print "botnum "+str$(botnum)+" is nutrul1"
if bottype=3 then print "botnum "+str$(botnum)+" is friendlyL1"
if bottype=4 then print "botnum "+str$(botnum)+" is friendlyM1"
if bottype=5 then print "botnum "+str$(botnum)+" is friendlyH1"
if bottype=6 then print "botnum "+str$(botnum)+" is hostile2"
if bottype=7 then print "botnum "+str$(botnum)+" is nutrul2"
if bottype=8 then print "botnum "+str$(botnum)+" is friendlyL2"
if bottype=9 then print "botnum "+str$(botnum)+" is friendlyM2"
if bottype=10 then print "botnum "+str$(botnum)+" is friendlyH2"
viewfail:
endif
loop
EDIT Fixed Code Above
EDIT Fixed Code Above Again
EDIT Fixed Code Above Again And Now Works!
-Ilya