Weekly Qbasic and Qb64 Lesson Topics
April 16, 2024, 04:40:22 am
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Want to see a specific Tutorial? ASK!
 
  Home Help Search Arcade Links Staff List Login Register  

Opens Notepad,but need to know more

Pages: [1] 2
  Print  
Author Topic: Opens Notepad,but need to know more  (Read 1937 times)
OlDosLover
Guest
« on: April 28, 2011, 07:40:03 am »

Hi all,
    Yes i get it now. Yes its possible to read and print a line and then to wait for a keypress before showing the next line of text. Here's a revised example.
Code:
DEFLNG A-Z

SCREEN _NEWIMAGE(640, 480, 32)
WorkPage& = _LOADIMAGE("NEWGHOST_blu1.png")
CLS

GOSUB MakPhrases 'get the amount of lines so we can make a dim to gather them
IF maxlines& <> 0 THEN
  DIM Phrases$(maxlines&)
  GOSUB FillDim 'read individual phrases into the string dim
ELSE
  PRINT "File not found": _DELAY 3: END
END IF
_DELAY .5

_DEST 0
Textprn$ = "Hello World !!!": RRow% = 2: CColumn% = 6: z% = 0: Pause! = .5: Whatone% = 0
GOSUB Showtext
GOSUB Pickphrase
RRow% = 15: CColumn% = 20: z% = 0: Pause! = .050

DO
  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 Pickphrase
LOOP UNTIL _KEYDOWN(27)
SYSTEM
END
'--------------------------------------------------------------------------

Showtext:
z% = 0
Length% = LEN(Textprn$)
FOR a = 1 TO Length%
  LOCATE RRow%, CColumn% + z%
  PRINT MID$(Textprn$, a, 1)
  z% = z% + 1
  _DELAY Pause!
NEXT a
RETURN

MakPhrases:
maxlines& = 0
ThisFile% = FREEFILE 'get next free file handle must be integer
OPEN "message.txt" FOR INPUT AS #ThisFile%
DO
  INPUT #ThisFile%, temp$
  maxlines& = maxlines& + 1
LOOP WHILE NOT EOF(ThisFile%)
temp$ = "" 'dump contents of string
CLOSE #ThisFile%
RETURN

FillDim:
maxlines& = 0
ThisFile% = FREEFILE 'get next free file handle must be integer
OPEN "message.txt" FOR INPUT AS #ThisFile%
DO
  INPUT #ThisFile%, temp$
  Phrases$(maxlines&) = temp$
  maxlines& = maxlines& + 1
LOOP WHILE NOT EOF(ThisFile%)
temp$ = "" 'dump contents of string
CLOSE #ThisFile%
RETURN

Pickphrase:
Whatone% = Whatone% + 1
IF Whatone% > maxlines& - 1 THEN Whatone% = 1
Textprn$ = Phrases$(Whatone%)
RETURN

Note for some reason where the sleep is i tried to insert While INkey$="":Wend but the editor insisted making the "" into " ".
OlDosLover.
« Last Edit: April 28, 2011, 07:59:10 am by OlDosLover » Report Spam   Logged

Pages: [1] 2
  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum


Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy