Hope this works
Function LineCross(x1,y1,x2,y2,x3,y3,x4,y4)
rem --- x1,y1 = start position of line 1 x2,y2 = end position of line 1
rem --- x3,y3 = start position of line 2 x4,y4 = end position of line 2
rem --- will return 1 if lines cross over
d# = (y4-y3)*(x2-x1) - (x4-x3)*(y2-y1)
ua# =((x4-x3)*(y1-y3) - (y4-y3)*(x1-x3)) / d#
ub# =((x2-x1)*(y1-y3) - (y2-y1)*(x1-x3)) / d#
if (ua# > 0.0) and (ua# <= 1.0) and (ub# > 0.0) and (ub# <= 1.0) then exitfunction 1
endfunction 0
"Earth is the cradle of humanity,
but one cannot live in a cradle forever"
Konstantin E. Tsiolkovsky (1911)