Hi
I have what appears to be an intermittent problem...
I have the code
when I run my program this seems to work fine but ocassionally i get a run time error
An error occurred on sub main.testtarget
Line Number:2695 (this is teh line with Select Test on it)
Select Test
Error description
Syntax error.
Continue?
The program will run through this routine fine many times with test="pirates" when the error occurs test="pirates" also
Any ideas what I am doing wrong to cause a syntax error?
I have what appears to be an intermittent problem...
I have the code
B4X:
Sub testtarget(destruction)
f = attacktarget.targetno
Msgbox(attacktarget.targettype&f)
test = attacktarget.targettype
Select test
Case "pirates"
If pirates(f).shield<destruction Then 'destruction overwhelms shield destruction = destruction -pirates(f).shield
pirates(f).shield=0
If pirates(f).hull<destruction Then ' it's a kill 'destruction = destruction -pirates(f).hull
pirates(f).hull=0
pirates(f).target=0
pirates(f).show=0
destroyedship(0) ' ship destroyed, decide what to do.
Else ' just damage hull
pirates(f).hull=pirates(f).hull-destruction
'destruction=0
Exit
End If
Else ' shield greater than destruction
pirates(f).shield=pirates(f).shield-destruction
destruction=0
End If
Case "traders"
'to do
Case "police"
'to do
Case Else
Msgbox("else")
End Select
'End If
End Sub
when I run my program this seems to work fine but ocassionally i get a run time error
An error occurred on sub main.testtarget
Line Number:2695 (this is teh line with Select Test on it)
Select Test
Error description
Syntax error.
Continue?
The program will run through this routine fine many times with test="pirates" when the error occurs test="pirates" also
Any ideas what I am doing wrong to cause a syntax error?