Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scrolling Text
#6
(11-03-2024, 04:09 AM)johnno56 Wrote: Ran the example and worked like a charm... of course, I will have to "give it the once over", to see how you did it... lol

Thank you for the effort. Much appreciated.

Great, glad it's suitable.
You can experiment with the variable "number_of_lines" using anything between 2 to 48 to decrease / increase the number of lines of text on the screen at any one time. For larger values you will need to change these lines though, otherwise the bottom lines will not be visible - this is the correct version:

Code:
for t = 0 to sizeof(text) - 1
        if sizeof(text) > number_of_lines
            set caret 20,   - (sizeof(text)- number_of_lines) * screen_h / number_of_lines + t * screen_h / number_of_lines
        else
            set caret 20, + t * screen_h / number_of_lines
        endif
        write text[t]
next

Quick observation - the code I have provided is very inefficient as it "prints" text unnecessarily above the start of the screen, which will not be visible when looking at the game window. I don't think that this is too important in a text adventure, as the inefficiency will not be noticed. I'm sure the code can be adapted to only print lines that will be visible on the screen, but I didn't want to over-complicate the code for an example.
Reply


Messages In This Thread
Scrolling Text - by johnno56 - 11-01-2024, 08:43 AM
RE: Scrolling Text - by kevin - 11-01-2024, 02:37 PM
RE: Scrolling Text - by Marcus - 11-01-2024, 09:02 PM
RE: Scrolling Text - by kevin - 11-02-2024, 05:39 PM
RE: Scrolling Text - by johnno56 - 11-03-2024, 04:09 AM
RE: Scrolling Text - by kevin - 11-03-2024, 05:02 AM
RE: Scrolling Text - by johnno56 - 11-03-2024, 08:03 AM
RE: Scrolling Text - by kevin - 11-03-2024, 02:53 PM
RE: Scrolling Text - by johnno56 - 11-03-2024, 07:07 PM
RE: Scrolling Text - by 1micha.elok - 11-04-2024, 01:08 AM
RE: Scrolling Text - by kevin - 11-04-2024, 02:17 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)