First of all, to put your code in a snippet box type this:
{code}your code{/code} with square brackets instead of curly ones.
There are quite a few really basic errors in your code. For example you write "end if" instead of "endif". "loop move object" most commands cannot be looped like this, only animation and sound commands, for everything else you will have to make a loop and put the command inside the loop to repeat the command. Like this:
Quote: "airstrikes=60/sync *REM 1 strike per minute"
Sync is a command, it doesn't return a value so you can't use it to assign a variable. All commands that return a value in DB end with parentheses "()", for example inkey$() returns the string of the key currently being pressed.
Here is your code that I've cleaned up. It still doesn't work yet, I've just changed the structure and removed dead code. I've removed the collision detection stuff and we will use the bomb's height to decide when to detonate.
rem Airstrike
rem by DarkComplicated
gosub get_objects
rem === MAIN ===
do
rem inkey$() has parentheses at the end "()"
if inkey$() = "5"
if airstrike=0 then
show object 300
position object 300,x,y,z *REM not yet sure on placement values
position object 400 x,y,z *REM not sure about positioning yet, may be random
show object 400
loop object 400,1,23
endif
endif
loop
end
rem === SUBROUTINES ===
get_objects:
load object "models/fighter.x",200
scale object 200,5000,5000,5000
position object 200, 5000,500,5000
load object "models/bombshells.x",300
scale object 300,250,250,250
hide object 300
load object "models/explosion.3ds",400
hide object 400
return
The first thing I've done is added a subroutine called "get_objects". Subroutines are blocks of code that are kept outside of the main program; everything between the label "get_objects:" and the RETURN statement is part of the get_objects subroutine and will be executed when we call the subroutine by typing "gosub get_objects".
Subroutines are mainly used to store processes that we want to use many times in the program, storing the process in a subroutine means we can simply call it to execute the code and we don't have to keep writing the same code over and over again.
In the case of "get_objects" we are just using a subroutine to tidy up our code.
The other thing I did was to add a DO loop. This is the most basic loop; when the program reads the command LOOP it jumps back up to DO and runs through the code again. If you want to leave the DO loop you can type EXIT - EXIT will leave any kind of loop.
I put an END after the main loop because, although I can't see any reason why the program would leave the main loop, it is best to be safe and end the program if it does to avoid it running into code that it's not supposed to.
I think you would really benefit from going through TDK's tutorials (stickied at the top of this board). They will give you a solid grounding on all the basic commands and how to write programs effectively.
Let's try and get your program working. We will fix it and turn it into a fun bombing game!
From what I understand you want the bomber to fly constantly forwards and drop a bomb when a key is pressed - but we are only allowed one bomb per minute. The bomb needs to explode on impact.
So what do we need to do? Here's our program in pseudo code - that means code that isn't real code but is useful for thinking through what we need to do.
DO
move bomber forwards
update airstrike timer
check for key press
IF key pressed and airstrike is allowed
drop bomb
reset airstrike timer
IF bomb exists
move bomb downwards
IF bomb hits the ground: EXPLODE!
LOOP
Where do we start?
First we make all the independent things; if something doesn't rely on anything else to work we can make it straight away.
The independent code is everything outside of IF statements; here we have three things: moving the bomber, updating the airstrike timer and checking the fire key.
We'll leave moving the bomber for later because it requires a 3D model; 3D brings up complications that we don't need to tackle yet, and if we were making our own models for a game we don't want to have to halt coding to make models - especially if you are working with other people!
Reseting the airstrike timer relies on checking the fire key, so we'll write the fire key check first.
We're going to use spacekey() to fire.
do
if spacekey()
print "FIRE!"
endif
loop
You see how I omitted "=1", that's because IF checks for =1 by default.
This code will work fine because although it repeats firing, we will be limited by the airstrike timer.
Now let's make the Airstrike timer.
Only being allowed one bomb a minute is going to make testing slow, so I'll increase it to one bomb every three seconds while we're in the testing phase.
To make the timer we use timer(), which return the time the cpu clock has been running for in milliseconds - so 3000ms = 3s.
sync on
airstrike=0
do
rem fire key check
if spacekey() and timer()>=airstrike
print "FIRE!"
rem we set the airstrike timer to the next available airstrike
airstrike = timer()+3000
endif
sync
loop
Now we can only fire once every three seconds. There are two problems with this code; there is nothing to tell the player when he can fire and the player can simply hold down spacekey to fire every time a bomb is available - we don't want our players to be so lazy!
To make our player press the key every time to release a bomb we need a switch.
sync on
airstrike=0
do
oldfire = newfire
newfire = spacekey()
rem fire key check
if newfire>oldfire and timer()>=airstrike
print "FIRE!"
rem we set the airstrike timer to the next available airstrike
airstrike = timer()+3000
endif
sync
loop
Now we can only fire when spacekey has been pressed and it wasn't being held down the last time we checked.
To show the player when a bomb is ready we'll use a simple text message.
sync on
airstrike=0
bombs = 0
do
oldfire = newfire
newfire = spacekey()
rem bombs away!
if newfire>oldfire and timer()>=airstrike
rem count another bomb dropped
inc bombs
rem we set the airstrike timer to the next available airstrike
airstrike = timer()+3000
endif
rem -- Display --
rem bomb ready?
if timer()>=airstrike then b$="FIRE AT WILL" else b$="ARMING WARHEAD..."
text 0,400,"Bomb Status: "+b$
rem bombs dropped
text 0,0,"Bombs Dropped: "+str$(bombs)
sync:cls
loop
I had to change the way the display works because the bomb status needs to be constantly updated and if we didn't clear the screen it would write over itself and get messy.
If I have time I will come back and finish this.
The plan for the game is to have random targets appear on the ground and you have to time the release of the bomb accurately to get a strike.

Do oranges know what colour they are?