Author Topic: L.O.R.D. Oldie but goodie color text format  (Read 3979 times)

0 Members and 1 Guest are viewing this topic.

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
L.O.R.D. Oldie but goodie color text format
« on: July 22, 2018, 12:00:16 pm »
Wasn't sure where to share this at, so trying here first (mods of course will move it)

If you are not familiar with L.O.R.D. this will NOT make any sense LOL, However for the rest of the BBS population, some of you might find this useful. It is a scaled down version of Seth's color code system for text 80x25 (can be used in other text windows), that I use heavily, and recently added a "center" function based on it. Feel free to modify, and/or change at will.

TODO:
  • simplify the code to allow a linefeed with '\ tag. I have it in my BBS source, just haven't implemented it here.
  • use `c for centering the text
Keep in mind I have a pascal version of this for writing doors, that is much more detailed, however, the following source is really all that I use.

Live game (not a plug) I used it in here


Easiest way to reuse this, is with a '$INCLUDE "lord.bi" (or whatever name you want to use)

Code: QB64: [Select]
  1. SUB LWRITE (TXT AS STRING)
  2.     '======================================================
  3.     '--- THIS IS A POPULAR COLOR ROUTINE BASED ON THE
  4.     '--- SETH ABLE L.O.R.D. BBS GAME COLOR FORMATTING
  5.     '=====================================================
  6.     COLOR 7 ' DEFAULT COLOR
  7.     FOR I = 1 TO LEN(TXT$)
  8.  
  9.  
  10.         ' CHECK FOR A COLOR CHANGE
  11.         IF MID$(TXT, I, 1) = "`" THEN
  12.             I = I + 1
  13.             SELECT CASE MID$(TXT, I, 1)
  14.                 CASE "0": COLOR 10
  15.                 CASE "1": COLOR 1
  16.                 CASE "2": COLOR 2
  17.                 CASE "3": COLOR 3
  18.                 CASE "4": COLOR 4
  19.                 CASE "5": COLOR 5
  20.                 CASE "6": COLOR 6
  21.                 CASE "7": COLOR 7
  22.                 CASE "8": COLOR 8
  23.                 CASE "9": COLOR 9
  24.                 CASE "!": COLOR 11
  25.                 CASE "@": COLOR 12
  26.                 CASE "#": COLOR 13
  27.                 CASE "$": COLOR 14
  28.                 CASE "%": COLOR 15
  29.             END SELECT
  30.             I = I + 1
  31.  
  32.         END IF
  33.         PRINT MID$(TXT, I, 1);
  34.     NEXT
  35.     PRINT ;
  36.  
  37.  
  38. SUB LWRITELN (TXT AS STRING)
  39.     LWRITE (TXT)
  40.     PRINT
  41.  
  42. FUNCTION TAG_COUNT (TXT AS STRING)
  43.     ' RETURNS THE NUMBER OF TAGS IN A STRING
  44.     DIM TCNT AS INTEGER
  45.     TCNT = 0
  46.     FOR I = 1 TO LEN(TXT)
  47.         IF MID$(TXT, I, 1) = "`" THEN TCNT = TCNT + 1
  48.     NEXT
  49.     TAG_COUNT = TCNT * 2-1 ' *2 BECAUES YOU HAVE TO ACCOUNT FOR THE MARKER AND THE TAG ID
  50.  
  51.  
  52.  
  53.  
  54. SUB CENTER (TXT AS STRING)
  55.     DIM TXT_LEN AS INTEGER
  56.  
  57.     TXT_LEN = LEN(TXT) - TAG_COUNT(TXT)
  58.     TXT_LEN = 40 - INT(TXT_LEN / 2)
  59.     LOCATE CSRLIN, TXT_LEN
  60.     LWRITE (TXT)
  61.  
  62.  

As with all my programming source (php, javascript, etc..) I like to KISS it.
« Last Edit: July 22, 2018, 12:01:52 pm by xra7en »
I just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: L.O.R.D. Oldie but goodie color text format
« Reply #1 on: July 22, 2018, 11:06:24 pm »
I don't know how many times I've keyed in Seabattle into different machines.... Cool game... Looks even better in colour!!

J
Logic is the beginning of wisdom.

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
Re: L.O.R.D. Oldie but goodie color text format
« Reply #2 on: July 24, 2018, 06:42:09 am »
I don't know how many times I've keyed in Seabattle into different machines.... Cool game... Looks even better in colour!!

J

thanks!
Min wasn't sea battle, mine was always star-trek LOL.

Im working on a 3D space game using Star-trek as the backdrop. Almost same mechanics, added "celestial bodies" to mine, these will turn out crafting materials that when crafted together will make a completely new matter, this will be coupled with a "forbidden stone"(drop % .01) that, once assembled will wipe out an entity running the galaxy. Until then, this entity ports to different quadrants of space, spawning small enemies that players will eventually need to find (up to 10 per quadrant), when not fighting them, these little enemies will start attacking celestial bodies and planets(bases?) until they are destroyed. If players end up in the same quad at the entity, the ship will be destroyed (ya, game not easy one)
/whew - LOL
I put a pretty nice color scheme on it (IceEdit) seems to look good. Yup all text.  And the one reason I use QB64 is only because it can do full screen on win7. I prefer pascal, but for some reason they have not implemented a FS feature. (win10 put it back in with the alt-enter).

Anyways.. thats my new game I might finish LOL
I just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: L.O.R.D. Oldie but goodie color text format
« Reply #3 on: July 24, 2018, 10:32:08 am »
Star Trek as well. Guilty!! Made a graphical version, based on an old basic256 program, but before that, keyed in from David Ahl's book (which I still have!!! - Of course it's getting too old so I use an ebook...)

3D? Now THAT is a challenge! You must let me know when you're done!
Logic is the beginning of wisdom.

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
Re: L.O.R.D. Oldie but goodie color text format
« Reply #4 on: July 24, 2018, 11:42:57 am »
will do. I have all three of david Ahal (my bibles) books - well the main BASIC books.

My first computer was a timex sinclair LOL, then bypassed the comador and went to the CoCo II, & III
 
Even today I write some browser based game based off those books, it is a great way to break yourself into learning a language. :-)
I just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: L.O.R.D. Oldie but goodie color text format
« Reply #5 on: July 26, 2018, 04:33:52 pm »
I have a LOT of "Basic" ebooks... Great source of ideas... can be mongrels to convert... but great ideas...

I need coffee...
Logic is the beginning of wisdom.