When I try to run my program it says "Variable 'CurrentTurn' does not exist in program". I didn't know that you had to declare variables in Darkbasic at all, except arrays. But I did declare it the beggining. The only thing that I thing that might do it is that it says variable 'currentturn', but it's an integer. but any help?
Just in case you don't get it, here's my code-
REM Project: RacingGame
REM Created: 2/16/2006 5:54:43 PM
REM
REM ***** Main Source File *****
` Game Settings
Sync On
Sync Rate 40
Autocam Off
Set Ambient Light 100
`Declare All Variables
`Players Positions
x#=0 : y#=0 : z#=0
x1#=0 : y1#=0 : z1#=0
x2#=0 : y2#=0 : z2#=0
x3#=0 : y3#=0 : z3#=0
x4#=0 : y4#=0 : z4#=0
x5#=0 : y5#=0 : z5#=0
`AI stuff
c_turn=1
turnnum=0 : turnnum2=0 : turnnum3=0
dim track(20,20) as integer
dim turnx(25,5) as integer
dim turnz(25,5) as integer
forward=0 : backward=0 : left#=0 : right#=0
friction#=0 : speed#=0 : accel#=0 : turn#=0
`Object's Positions
`The turns for start up
`Make the main car
Load Object "Media/Van.x",1
Scale Object 1,400,400,400
rotate Object 1,0,180,0
`Load Test AI cars
for a=2 to 6
Clone Object a,1
Scale Object a,400,400,400
rotate Object a,0,180,0
next a
`Load the test-map
Load Image "Media/Road.bmp",1,1
Make Object Cube 100,200
Scale Object 100,100,2,100
Position Object 100,100,-2.5,100
Texture Object 100,1
`Read the Map.txt
xpos=0 : zpos=0
xpos1=1 : zpos1=1
turnnum=-96
for a=0 to 440
map#=Read Byte From File ("Media/TestMap.txt",a)
If map#=48
track(xpos1,zpos1)=0
endif
If map#=49
track(xpos1,zpos1)=1
endif
If map#=56
track(xpos1,zpos1)=1
endif
If map#=57
track(xpos1,zpos1)=1
x#=xpos+2
z#=zpos+2
x1#=xpos+5
z1#=zpos+2
endif
If map#>96 and map#<123
turnnum2=turnnum+map#
for b=1 to 5
if b<3 then magicx=3
if b>3 then magicx=7
if b=1 or b=4 then magicz=3
if b=2 or b=5 then magicz=7
if b=3
magicx=5
magicz=5
endif
if turnnum2>turnnum3 then turnnum3=turnnum2
track(xpos1,zpos1)=2
turnx(turnnum2,b)=xpos+magicx
turnz(turnnum2,b)=zpos+magicz
next b
c_turn=1
b=rnd(4)+1
endif
if map#=10 or map#=13
xpos1=xpos1-1
xpos=xpos-10
endif
xpos=xpos+10
xpos1=xpos1+1
if xpos=200
xpos=0
zpos=zpos+10
endif
if xpos1=21
xpos1=1
zpos1=zpos1+1
endif
next a
Position Camera x#,y#,z#
`Main Game Loop
Do
`ArrowKeys Movement
If upkey()=1 then forward#=0.008 else forward#=0
If downkey()=1 then backward#=0.008 else backward#=0
If leftkey()=1 then left#=1.2 else left#=0
If rightkey()=1 then right#=1.2 else right#=0
`Charecter Movement
a#=object angle y(1)
`if you're moving forward backward or not moving
accel#=(forward#-backward#)
`friction
if accel#=0
if speed#>0 then speed#=speed#-(friction#*2)
if speed#<0 then speed#=speed#+(friction#*2)
endif
speed#=(speed#+accel#)
`Max Speed and so you actually stop at some point
if speed#>0.3-(friction#*30) then speed#=0.3-(friction#*30)
if speed#<-0.03+friction# then speed#=-0.03+friction#
if speed#>-0.00009
if speed#<0.00004 then speed#=0
endif
`Turning
turn#=right#-left#
if turn#<>0
if speed#<0.00009 or speed#>-0.00004
turn#=turn#+(speed#/3)
yrotate object 1,wrapvalue(object angle y(1)+turn#)
if speed#>0.001 then speed#=speed#-0.0003
if turn#>0 then turn#=turn#-0.05
if turn#<0 then turn#=turn#+0.05
endif
endif
`Move You
x#=newxvalue(x#,a#,speed#) : z#=newzvalue(z#,a#,speed#)
Position Object 1,x#,y#,z#
acel1#=0.0004
speed1#=speed1#+acel1#
if speed1#>0.065-(friction1#*30) then speed1#=0.065-(friction1#*30)
if x1#<turnx(c_turn,b)+10 and x1#>turnx(c_turn,b)-10
if z1#<turnz(c_turn,b)+10 and z1#>turnz(c_turn,b)-10
if c_turn=turnnum3
c_turn=1
else
c_turn=c_turn(1)+1
endif
b=rnd(4)+1
endif
endif
`position to the left of the object
move object left 2,5
leftx1#=object position x(2)
lefty1#=object position y(2)
leftz1#=object position z(2)
`position to the right of the object
move object right 2,5
rightx1#=object position x(2)
righty1#=object position y(2)
rightz1#=object position z(2)
`Distance Formula
dist1#=Sqrt((leftx1#-turnx(c_turn,b))^2+(leftz1#-turnz(c_turn,b))^2)
dist2#=Sqrt((rightx1#-turnx(c_turn,b))^2+(rightz1#-turnz(c_turn,b))^2)
If Sqrt((leftx1#-turnx(c_turn,b))^2+(leftz1#-turnz(c_turn,b))^2) < Sqrt((rightx1#-turnx(currentturn,b))^2+(rightz1#-turnz(currentturn,b))^2)
yrotate object 2,wrapvalue(object angle y(2)-0.3)
else
yrotate object 2,wrapvalue(object angle y(2)+0.3)
endif
a1#=object angle y(2)
x1#=newxvalue(x1#,a1#,speed1#) : z1#=newzvalue(z1#,a1#,speed1#)
Position Object 2,x1#,y1#,z1#
`Friction
posx=(Object position x(1)/10)+1
posz=(Object position z(1)/10)+1
posx1=(Object position x(2)/10)+1
posz1=(Object position z(2)/10)+1
if track(posx,posz)=0
friction#=0.001
else
friction#=0.00004
Print "ON TRACK"
endif
if track(posx1,posz1)=0
friction#=0.001
else
friction#=0.00004
endif
`Beta Tests
Set Cursor 10,10
Print "1 ",dist1#," 2 ",dist2#
Print "x: ",x#," z: ",z#
`Set Cursor 10,40
`Print "fo: ",forward#," ba: ",backward#," ac: ",accel#," sp: ",speed#
`Chase Cam
Set camera to follow x#,y#,z#,a#,6,2,5,0
Sync
Loop
(You need media to run it, but hopefully you can just see the problem if you read it... hopefully)
LIGHT FRENZY (almost done!)
Best Noobish game ever.