Maybe this will help, you can add to save to a file..
SetPrintSize(30)
type _debug
on as integer
max as float
msg as string[0]
limit as integer
endtype
global debug as _debug
debug.on=true
debug.limit = 10
//insert in main loop
function DebugLog()
if debug.on = true
for i=0 to debug.msg.length
print(debug.msg[i])
next i
endif
endfunction
//add message
function PrintL(_msg as string)
//debug.msg.insert(GetCurrentTime()+":"+_msg, 0)
debug.msg.insert(_msg, 0)
if debug.msg.length = debug.limit
debug.msg.remove(debug.limit)
endif
endfunction
https://www.instagram.com/qugurun/