Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thinking of a ASCII game, click this out!! (Modified PRINT!)
#1
Big Grin Hay! You thinking of making a ASCII text adventure in QB? Then you should like these SUB routines that modify the PRINT statment. After loading these SUBs into your QBIDE the new PRINT statments are
Code:
TYPTEXT y, x, "text here"
ALNTYPE "left, center, or right", y, "text here"
ALNTEXT "left, center, or right", y, "text here"
REVTEXT y, x, "text here"
NUMTEXT y, x, "text here"
ALN sentax can be any case "LEFT", "LeFt", or "left"

Sentaxt error would be spacing around ALN command, " left ", this is not handled and will cause your text not to PRINT.

This will only work in SCREEN 0, 2, 3, 4, 8, 9, or 10...
I'll be working on one for the others screens when ever I get round to it, but this will do for all you ASCII text adventure scripters!

Statments effects are discused with REMlines in the code, also a .BAS form will be placed on my site for those who don't know how to get this into QB..

POWERCALL.BAS (PWRCALL.BAS)
Code:
'
'     Hello, and welcome to my SCREEN 0, 2, 3, 4, 8, 9, & 10
' SUB routines for modified print staments. Great routines for
' ASCII text adventure to add ease and eye-catching efects.
' Take a look at the examples below, they'll show you how
' to work them....

DECLARE SUB ALNTYPE (aln$, y!, text$)
DECLARE SUB NUMTEXT (y!, x!, text$)
DECLARE SUB REVTEXT (y!, x!, text$)
DECLARE SUB ALNTEXT (aln$, y!, text$)
DECLARE SUB TYPTEXT (y!, x!, text$)

CLS
' ########### EXAMPLES ################
'Read over what each statment does, how it works. Then press <F5>
'to see then in action!!

'TYPTEXT types text as if it were bieng entered from a keyboard!
' You must note Y & X locations as with LOCATE...

TYPTEXT 1, 1, "You can have your text type like a LOCATE/PRINT statment!"

'ALNTYPE types text like above statment, but from either
' CENTER, LEFT, or RIGHT (Any Case), Y location must be noted

ALNTYPE "right", 2, "Or type to the right of the screen!"
ALNTYPE "center", 3, "Type into the center of the screen!"
ALNTYPE "left", 4, "Or just type from the left!!"

'ALNTEXT, if you want to PRINT to the LEFT, CENTER, or RIGHT (Any Case)
' Y Location must be noted (Are you tiered of me saying that yet?)

ALNTEXT "right", 5, "PRINT to the right!"
ALNTEXT "center", 6, "PRINT into the center!"
ALNTEXT "left", 7, "Or PRINT from the left!"

'REVTEXT is just for fun, reverses the intered text
' Y & X locations must be noted

REVTEXT 9, 1, "Looking funny yet?"

'NUMTEXT, returns the ASCII values in numbers
' Y & X locations must be noted

NUMTEXT 11, 1, "NUMBERS!"

'Enjoy these SUB routine statments, easy to map into any program!

SUB ALNTEXT (aln$, y, text$)
a = LEN(text$)
IF UCASE$(aln$) = "LEFT" THEN
   x = 1
   LOCATE y, x: PRINT text$
END IF
IF UCASE$(aln$) = "CENTER" THEN
   c = a \ 2
   x = 40 - c
   LOCATE y, x: PRINT text$
END IF
IF UCASE$(aln$) = "RIGHT" THEN
   x = 80 - a
   LOCATE y, x: PRINT text$
END IF
END SUB

SUB ALNTYPE (aln$, y, text$)
a = LEN(text$)
IF UCASE$(aln$) = "LEFT" THEN
   x = 1
   IF y > 23 THEN y = 23
   cont = 0
   DO
      cont = cont + 1
      phr$ = phr$ + MID$(text$, cont, 1)
      LOCATE y, x: PRINT phr$
      IF cont = LEN(text$) THEN GOTO endsub
      FOR i = 1 TO 40000: NEXT
   LOOP UNTIL INKEY$ = CHR$(27)
END IF
IF UCASE$(aln$) = "CENTER" THEN
   x = 40 - (a \ 2)
   IF y > 23 THEN y = 23
   cont = 0
   DO
      cont = cont + 1
      phr$ = phr$ + MID$(text$, cont, 1)
      LOCATE y, x: PRINT phr$
      IF cont = LEN(text$) THEN GOTO endsub
      FOR i = 1 TO 40000: NEXT
   LOOP UNTIL INKEY$ = CHR$(27)
END IF
IF UCASE$(aln$) = "RIGHT" THEN
   x = 80 - a
   IF y > 23 THEN y = 23
   cont = 0
   DO
      cont = cont + 1
      phr$ = phr$ + MID$(text$, cont, 1)
      LOCATE y, x: PRINT phr$
      IF cont = LEN(text$) THEN GOTO endsub
      FOR i = 1 TO 40000: NEXT
   LOOP UNTIL INKEY$ = CHR$(27)
END IF

endsub:
END SUB

SUB NUMTEXT (y, x, text$)
cont = 0
DO
cont = cont + 1
lttr$ = MID$(text$, cont, 1)
num = ASC(lttr$)
lnum$ = STR$(num)
pnum$ = pnum$ + lnum$
IF cont = LEN(text$) THEN EXIT DO
LOOP
LOCATE y, x: PRINT pnum$
END SUB

SUB REVTEXT (y, x, text$)
cont = LEN(text$)
DO
phr$ = phr$ + MID$(text$, cont, 1)
cont = cont - 1
IF cont = 0 THEN EXIT DO
LOOP
LOCATE y, x: PRINT phr$
END SUB

SUB TYPTEXT (y!, x!, text$)
IF y > 23 THEN y = 23
cont = 0
DO
cont = cont + 1
phr$ = phr$ + MID$(text$, cont, 1)
LOCATE y, x: PRINT phr$
IF cont = LEN(text$) THEN EXIT DO
FOR i = 1 TO 40000: NEXT
LOOP UNTIL INKEY$ = CHR$(27)
END SUB
Kevin (x.t.r.GRAPHICS)

[Image: 11895-r.png]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)