Well, firstly:
if x#=1 then x = 360
if x#=360 then x = 1
if y#=1 then y = 360
if y#=360 then y = 1
if z#=1 then z = 360
if z#=360 then z = 1
Should really be:
if x#=1 then x# = 360
if x#=360 then x# = 1
if y#=1 then y# = 360
if y#=360 then y# = 1
if z#=1 then z# = 360
if z#=360 then z# = 1
But that's not logical, use wrapvalue instead, like x#=wrapvalue(x#) - it returns an angle from any number, very usefull command indeed.
To use limb angles properly, you really need to break your model up logically. For instance, if I wanted a turret that could rotate left and right, and pitch up and down, I'd have 3 limbs. The first limb would be the turret itself, the second limb would be the barrel of the turret. Now you may not need this, but I like to do it this way:
Add a third limb, just a box, you can hide it if you like - but it has to be positioned at the end of your turret where the bullet exits. This would be linked to the barrel which in turn is linked to the turret base. Now, the limb pivot points are fairly logical, one at the base, one at the turret swivel point, and the third one in the middle of the cube.
Now, once you load this model into DB, you could rotate the turret left and right using limb 1, then pitch it up and down using limb 2. When firing you can position the bullet object at limb position 2 and point it at limb position 3, then simply moving the object is enough to fire it out in the direction of the turret. You can use trig to calculate angles, like for AI, you'd calculate the angles in 2D to get the Y angle, then do the same for the pitch.
I tend to rely on limb positions more than limb angles and directions, you know where you stand with your own 3D maths, less chance of the model messing with your results.
Van-B

Next time he runs past, GRAB HIM!