hmm... interpreting complex text command?

Blitz3D Forums/Blitz3D Programming/hmm... interpreting complex text command?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I've got a little space fight game i was screwing with and basically what you do is type a command such as:
M S4 behind S3
Where M stands for move and the S3 and 4 is the ship number. That command is the only one i have documented right now and should make ship S4 move behind S3.

My current code doesn't seem to work as it gives me a EntitydoesExist, which i think Is ent2, or it doesnt do anything at all.
Here's the code thanks for help:
Function Interpret(st$)
	
	Select Left$(st$,1)
		Case "M"
			
			If Instr(Lower$(st$),"flank") Or Instr(Lower$(st$),"behind") Or Instr(Lower$(st$),"trail") Then 
				For s.ship=Each ship
					If Instr(Lower$(com$),Lower$(s\sqd$)) And Instr(Lower$(st$),"flank "+s\sqd$)=0 Or Instr(Lower$(st$),"behind "+s\sqd$)=0 Or Instr(Lower$(st$),"trail "+s\sqd$)=0 Then 
						ent1=s\ent
						DebugLog "1: "+ent1
						Exit 
					EndIf
				Next
				For s.ship=Each ship 
					If Instr(Lower$(st$),"flank "+s\sqd$) Or Instr(Lower$(st$),"behind "+s\sqd$) Or Instr(Lower$(st$),"trail "+s\sqd$) Then 
						ent2=s\ent
						DebugLog "2: "+ent2
						Exit 
					EndIf 
				Next
				PositionEntity ent1,EntityX(ent2),EntityY(ent2)-5,EntityZ(ent2)
			EndIf 
	End Select 
End Function 


And if you need it heres the entire thing media and all (its not much)
[url http://www.fileden.com/files/2007/5/29/1124852/shipgame.zip]