Well... i had this nice long detailed explanation written out, and then my computer decided to crash...
Anyways, basically, a parametric line is this:
x=(x2-x1)L+x1
y=(y2-y1)L+y1
and given L between 0 and 1, x and y will be between x1 to x2 and y1 to y2.
and a line perpendicular to that is
x=(y1-y2)L+x1
y=(x2-x1)L+y1
if you want a long explanation as to why that is, i'll gladly rewrite my essay

. Here is some code demonstrating my humongous breakthrough:
x1=rnd(screen width())
y1=rnd(screen height())
x2=rnd(screen width())
y2=rnd(screen height())
white as dword
green as dword
red as dword
white=rgb(255,255,255)
green=rgb(0,255,0)
red=rgb(255,0,0)
do
cls
if mouseclick()=1
x1=mousex()
y1=mousey()
endif
if mouseclick()=2
x2=mousex()
y2=mousey()
endif
if spacekey()=1
x1=rnd(screen width())
y1=rnd(screen height())
x2=rnd(screen width())
y2=rnd(screen height())
endif
ink white,0
line x1,y1,x2,y2
line x1,y1,y2-y1+x1,x1-x2+y1
sync
loop