here ya go..
I used 'notify' here.. 'print' caused some crashes here.. I guess you know what to do if you don't have B+ .. it's all fairly obvious.
I used 'notify' here.. 'print' caused some crashes here.. I guess you know what to do if you don't have B+ .. it's all fairly obvious.
bnk=CreateTextBank(10,40) ; 10:elements, 40:stringwidth For t=0 To 9 SetTextbankText(bnk,t,"BlitzMax - we're waiting "+t+" months") Next ; lousy test function test(bnk) FreeBank bnk ; <-- rather don't forget this! always clean-up your mess :) End Function test(blah) For t=0 To TextbankElements(blah)-1 Notify TextbankText(blah,t) Next Notify TextbankElements(blah) Notify TextbankWidth(blah) End Function ; --------------------------------------------------------------------- ; ; Textbank - by CS^TBL ; ; bank=CreateTextBank(elements,width) ; SetTextbankText(bank,element,txt$) ; a$=TextbankText(bank,element(,cut)) ; width=TextbankWidth(bank) ; elements=TextbankElements(bank) ; ; bank: (b=byte, s=short) ; ; [b:B][b:T][b:X][b:T][s:ELEMENTS][s:WIDTH][text .....][text .....][ ... ][ ... ] ; ; --------------------------------------------------------------------- Function TextbankElements(bank) If Not bank End If BankSize(bank)<8 End For t=0 To 3 a$=a$+Chr$(PeekByte(bank,t)) Next If a$<>"BTXT" End Return PeekShort(bank,4) End Function Function TextbankWidth(bank) If Not bank End If BankSize(bank)<8 End For t=0 To 3 a$=a$+Chr$(PeekByte(bank,t)) Next If a$<>"BTXT" End Return PeekShort(bank,6) End Function Function TextbankText$(bank,element,cut=True) If Not bank End If BankSize(bank)<8 End For t=0 To 3 a$=a$+Chr$(PeekByte(bank,t)) Next If a$<>"BTXT" End elements=PeekShort(bank,4) width=PeekShort(bank,6) If element>elements End a$="" For t=0 To width-1 a$=a$+Chr$(PeekByte(bank,8+element*width+t)) Next If cut a$=Trim$(a$) EndIf Return a$ End Function Function SetTextbankText(bank,element,s$) If Not bank End If BankSize(bank)<8 End For t=0 To 3 a$=a$+Chr$(PeekByte(bank,t)) Next If a$<>"BTXT" End elements=PeekShort(bank,4) width=PeekShort(bank,6) If element>=elements End If element<0 End l=Len(s$) If Len(s$)>width End For t=0 To Len(s$)-1 PokeByte bank,8+(element*width)+t,Asc(Mid$(s$,t+1,1)) Next End Function Function CreateTextbank(elements,width) ; checks If elements<=0 error=True EndIf If width<=0 error=True EndIf If error End bank=CreateBank(8+elements*width) ; header PokeByte bank,0,66 ; B PokeByte bank,1,84 ; T PokeByte bank,2,88 ; X PokeByte bank,3,84 ; T PokeShort bank,4,elements ; 4 PokeShort bank,6,width ; 6 ; texts ; 8 ... Return bank End Function