A Very Simple Message Writer
This will chop one long line to smaller ones of a specified size and write it on screen at a specified x, y coords. It is very simple and works only on chopping lines up to a space character or limit given.
I am sure there must be more clever functions, probably a whole Write library out there but sometimes you just want something simple that does this sort of thing.
If anyone has any resources that provide functionality like this I could use for sure so please let me know...
remstart
-------------------------------------------------------------------
program name: Writer Functions
-------------------------------------------------------------------
written by: Anthrakas
date: 22 June 2003
-------------------------------------------------------------------
comments: These functions handle the writing and appearence of
text on the screen
-------------------------------------------------------------------
remend
ls_message$ = "this is a long message testing the write message function it should be more than a line long"
do
if ls_message$ ""
` ls_lastmsg$=""
ink RGB(0,255,0), 0
WriteMLText(ls_message$, 1, 30, 25)
ls_message$ = ""
endif
Rem Refresh Screen
Sync
loop
end
`This writes a text message in many lines
function writeMLText(as_message$, x, y, limit)
ls_message$ = as_message$
chars = len(ls_message$)
newx = x
newy = y
while chars > 0
`examine the current line to write
line$ = left$(ls_message$, limit)
newLimit = limit
while right$(line$, 1) " ":`dont chop a word in half
dec newlimit, 1
line$ = left$(line$, newlimit)
endwhile
`write new complete word and increase line
text newx,newy,line$
inc newy, 15
`move to the rest of the message and chop
chars = len(ls_message$)
rest = chars - newlimit
restMsg$ = right$(ls_message$, rest)
ls_message$ = restMsg$
endwhile
endfunction
This example does not handle repetition, you might want to write some more code, maybe return something from the function to signal that the message is writen (i suggest the chars)
so in the main code you can see if the chars > 0 then there is still more to write...
-------------------------------
Pointy birds, Oh pointy pointy
Anoint my head, Anointy 'nointy