I've had a strange problem recently with user functions that return an empty string directly.
Try this piece of code first and you'll find it crashes because the function directly returns a "" string:
Sync on : sync rate 60
backdrop on
txt$ = "te2st command = 1"
a = 0
b = 2
do
if TEST_STRING(txt$) = "tested"
a = b
endif
sync
loop
function TEST_STRING(fTxt$ as string)
if left$(fTxt$,4) = "test"
exitfunction "tested"
endif
endfunction ""
Now try this, it works fine when returning a "" string variable instead:
Sync on : sync rate 60
backdrop on
txt$ = "te2st command = 1"
a = 0
b = 2
do
if TEST_STRING(txt$) = "tested"
a = b
endif
sync
loop
function TEST_STRING(fTxt$ as string)
rval$ = ""
if left$(fTxt$,4) = "test"
exitfunction "tested"
endif
endfunction rval$
I could just use the second method anyway, but I spent a whole day figuring out where i screwed up, to find out that I actually hadn't.