Here's something that works, although it doesn't limit the amount of lines.
sync on : sync rate 60
test$=" I'm being wrapped, isn't that cool?"
do
box 10,10,110,70,rgb(255,0,0),rgb(0,255,0),rgb(0,0,255),rgb(255,255,0)
wrapper(test$,10,10,100,15)
sync
loop
function wrapper(a$,x,y,width,hdif)
h=y
ended=0
repeat
b=0
for q=1 to len(a$)
if text width(left$(a$,q))>width then b=q : exit
next q
if b=0
text x,h,a$
ended=1
else
c=b : space=0
repeat
if mid$(a$,b)=" " then space=1
b=b-1
until space=1 or b=0
if space=0 then b=c-1
q$=left$(a$,b)
text x,h,q$
a$=right$(a$,len(a$)-b)
h=h+hdif
if mid$(a$,1)=" " then a$=right$(a$,len(a$)-1)
endif
until ended=1
endfunction
Kevil