DO FOR x = 0 TO 261 STEP 67 _PUTIMAGE (100, 100)-(220, 190), WorkPage&, 0, (x, 0)-(x + 67, 67) _DELAY .08 NEXT
DEFLNG A-ZSCREEN _NEWIMAGE(640, 480, 32)WorkPage& = _LOADIMAGE("4men.png")CLSGOSUB MakPhrases 'get the amount of lines so we can make a dim to gather themIF maxlines& <> 0 THEN DIM Phrases$(maxlines&) GOSUB FillDim 'read individual phrases into the string dimELSE PRINT "File not found": _DELAY 3: ENDEND IF_DELAY .5_DEST 0Textprn$ = "THIS IS A STORY ABOUT 4 MEN ": RRow% = 2: CColumn% = 6: z% = 0: Pause! = .5: Whatone% = 0GOSUB ShowtextGOSUB PickphraseRRow% = 15: CColumn% = 20: z% = 0: Pause! = .050'//Need to figure out how to sycronize the images, with textDO FOR x = 0 TO 261 STEP 67 _PUTIMAGE (100, 100)-(220, 190), WorkPage&, 0, (x, 0)-(x + 67, 67) _DELAY .08 NEXT GOSUB Showtext SLEEP LOCATE RRow%, CColumn% PRINT STRING$(Length%, 32) LOCATE 25, 4 PRINT " press + hold escape to exit or any key to contimue" GOSUB PickphraseLOOP UNTIL _KEYDOWN(27)SYSTEMEND'--------------------------------------------------------------------------Showtext:z% = 0Length% = LEN(Textprn$)FOR a = 1 TO Length% LOCATE RRow%, CColumn% + z% '///When it gits to the longer line, that is when it errors, saying line 46 PRINT MID$(Textprn$, a, 1) z% = z% + 1 _DELAY Pause!NEXT aRETURNMakPhrases:maxlines& = 0ThisFile% = FREEFILE 'get next free file handle must be integerOPEN "4men.txt" FOR INPUT AS #ThisFile%DO INPUT #ThisFile%, temp$ maxlines& = maxlines& + 1LOOP WHILE NOT EOF(ThisFile%)temp$ = "" 'dump contents of stringCLOSE #ThisFile%RETURN'///Not exactly sure how to explain, I think when you see the error that occurs,you will know how to handle it.FillDim:maxlines& = 0ThisFile% = FREEFILE 'get next free file handle must be integerOPEN "4men.txt" FOR INPUT AS #ThisFile%DO INPUT #ThisFile%, temp$ Phrases$(maxlines&) = temp$ maxlines& = maxlines& + 1LOOP WHILE NOT EOF(ThisFile%)temp$ = "" 'dump contents of stringCLOSE #ThisFile%RETURNPickphrase:Whatone% = Whatone% + 1IF Whatone% > maxlines& - 1 THEN Whatone% = 1Textprn$ = Phrases$(Whatone%)RETURN
REMSCREEN 12Text$ = "This will be longer than 80 characters long deliberately so that we can compose and test a stand alone routine that can accomodate this more easierly than other methods we have chosen to use to illustrate it."PRINT Text$CColumn% = 30GOSUB BreakStringSLEEPSYSTEMBreakString:Chunks% = 0Braklen% = LEN(Text$)IF Braklen% > 80 - CColumn% THEN '--- calculate if length of string will wrap over the screen edge 'find out how many chunks there arebased off the amount of space between the printing column + edge of screen Legitlen% = 80 - CColumn% '---- this is max len to fit onscreen without wrap Chunks% = Braklen% \ Legitlen% '--- divide to see if its non fractional IF Chunks% * Legitlen% < Braklen% THEN Chunks% = Chunks% + 1 '-- if fractional add 1 to the chunksELSE 'line is already legit length Chunks% = 1END IFIF Chunks% = 1 THEN RETURN '--- handle normallyELSE 'goto plan B GOSUB PlanBEND IFRETURNPlanB:SOUND 1000, 1LOCATE 6, 1: PRINT Braklen%, Legitlen%, Chunks%LOCATE 10, 20DIM PartText$(Chunks%) '-- create a structure to split the string into chunksStart% = 1FOR t = 0 TO Chunks% - 1 PartText$(t) = MID$(Text$, Start%, Legitlen%) LOCATE 10 + t, CColumn% PRINT PartText$(t) Start% = Start% + Legitlen%NEXT tRETURN
DEFLNG A-ZSCREEN _NEWIMAGE(640, 480, 32) '<- what the observer seesWorkPage& = _LOADIMAGE("4men.png") '<- all the graphicsCLS_DEST 0 '<- point to the observer screenGOSUB MakPhrases 'get the amount of lines so we can make a dim to gather themLOCATE 2, 10PRINT "THIS IS A STORY ABOUT 4 MEN "Whatone% = 0 '<- set variable to zeroRRow% = 15: CColumn% = 20: z% = 0: Pause! = .050 'needed for the showtext routineDO GOSUB Showpic 'sync pic with text RRow% = 15: CColumn% = 1 GOSUB Showtext 'show text with the effect Dummy$ = INPUT$(1) 'wait for keypress CLS LOCATE 20, 10: PRINT " press + hold escape to exit or any key to contimue" GOSUB Pickphrase 'get next phraseLOOP UNTIL _KEYDOWN(27)SYSTEMEND'--------------------------------------------------------------------------Showpic:SELECT CASE Whatone% CASE 0 CASE 1 x = 0 _PUTIMAGE (100, 100)-(220, 190), WorkPage&, 0, (x, 0)-(x + 67, 67) CASE 2 x = 67 _PUTIMAGE (100, 100)-(220, 190), WorkPage&, 0, (x, 0)-(x + 67, 67) CASE 3 x = 134 _PUTIMAGE (100, 100)-(220, 190), WorkPage&, 0, (x, 0)-(x + 67, 67) CASE 4 x = 201 _PUTIMAGE (100, 100)-(220, 190), WorkPage&, 0, (x, 0)-(x + 67, 67)END SELECTRETURNShowtext:z% = 0Length% = LEN(Textprn$)FOR a = 1 TO Length% LOCATE RRow%, CColumn% + z% ' PRINT MID$(Textprn$, a, 1) z% = z% + 1 IF CColumn% + z% >= 79 THEN RRow% = RRow% + 1 CColumn% = CColumn% - 60 END IF _DELAY Pause!NEXT aRETURNMakPhrases:maxlines& = 0ThisFile% = FREEFILE 'get next free file handle must be integerOPEN "4men.txt" FOR INPUT AS #ThisFile%DO INPUT #ThisFile%, temp$ maxlines& = maxlines& + 1LOOP WHILE NOT EOF(ThisFile%)temp$ = "" 'dump contents of stringCLOSE #ThisFile%'check maxlines to make sure file is not emptyIF maxlines& <> 0 THEN DIM Phrases$(maxlines& - 1) 'note arrys start at element zero not ONE as expected!!! GOSUB FillDim 'read individual phrases into the string dimELSE PRINT "File not found": _DELAY 3: ENDEND IF_DELAY .5RETURNFillDim:maxlines& = 0ThisFile% = FREEFILE 'get next free file handle must be integerOPEN "4men.txt" FOR INPUT AS #ThisFile%DO LINE INPUT #ThisFile%, temp$ Phrases$(maxlines&) = temp$ maxlines& = maxlines& + 1LOOP WHILE NOT EOF(ThisFile%)temp$ = "" 'dump contents of stringCLOSE #ThisFile%RETURNPickphrase:Whatone% = Whatone% + 1IF Whatone% > maxlines& - 1 THEN Whatone% = 0Textprn$ = Phrases$(Whatone%)RETURN
CASE 4 x = 201 _PUTIMAGE (100, 100)-(220, 190), WorkPage&, 0, (x, 0)-(x + 67, 67)CASE 5 '///For examplex= 268_PUTIMAGE (100, 100)-(220, 190), WorkPage&, 0, (x, 0)-(x + 67, 67)