Weekly Qbasic and Qb64 Lesson Topics
March 29, 2024, 10:03:13 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 1936 times)
OlDosLover
Guest
« on: April 22, 2011, 08:51:20 pm »

Hi all,
    Here's another version that uses your print text across the screen program with a file of text messages to display
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
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

  LOCATE RRow%, CColumn%
  PRINT STRING$(Length%, 32)

  LOCATE 25, 4
  PRINT " press + hold escape to exit"
  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% = INT(RND * maxlines&) 'make a random number to select exact phrase
Textprn$ = Phrases$(Whatone%)
RETURN
And here's the contents of the text file. You can add on or subtract lines in the file .
Quote
I am the ghost comeing to save the world
Hey help me EAT some dots!
Well im waiting for you to do something!
Ghost's  who ya gonna call!
Get me into notepad and i'll eat more!
Well Garry whens Mick gonna give me more!
Nuclear reactors dont scare me!!!
Proton Pills are my favourite foods!
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