Scrolling Text - Printable Version +- NaaLaa (https://www.naalaa.com/forum) +-- Forum: Other (https://www.naalaa.com/forum/forum-8.html) +--- Forum: Everything else (https://www.naalaa.com/forum/forum-10.html) +--- Thread: Scrolling Text (/thread-158.html) Pages:
1
2
|
Scrolling Text - johnno56 - 11-01-2024 Ok. Here is an "oldie" question. If I were to create, not that I will mind you, an old text-based adventure game** using N7, is there a way to scroll the text up the screen when the game output goes beyond a "screen full"? ** Interactive Fiction... I think is the going genre for text adventures... If this is too involved or difficult then it would be best to ignore the request... after letting me know of course... lol Cheers J RE: Scrolling Text - kevin - 11-01-2024 Hi Johnno, will you be using a game window or the console for the text output for your adventure game please? I'm confident that this can be done in a game window, but I don't think I will have time before Sunday to look at it.....Happy for others to show an example in the meantime, as I'm sure that my way will not be the most efficient. RE: Scrolling Text - Marcus - 11-01-2024 One can keep track of the line njmber and use the is the 'scroll' function combined with 'set caret', probably manage all of it in a custom print-function. If kevin doesn't beat me to it I'll post an example this weekend RE: Scrolling Text - kevin - 11-02-2024 (11-01-2024, 08:43 AM)johnno56 Wrote: Ok. Here is an "oldie" question. Hi Johnno, One solution using a table to hold your lines of text: Code: visible screen_w = 640,screen_h = 480 There will of course be more elegant solutions, and I may have misunderstood your question, so I look forward to seeing alternatives.... Please let me know if there are other things needed for this task? All the best - Kevin. RE: Scrolling Text - johnno56 - 11-03-2024 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. RE: Scrolling Text - kevin - 11-03-2024 (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 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 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. RE: Scrolling Text - johnno56 - 11-03-2024 Cool... The "number_of_lines" was the first thing I tinkered with... lol I had a crazy thought about the 'efficiency' in relation to text printing beyond the top of the screen... what if the "y" half of set caret was monitored and only display the text if it is greater than zero... or something like that... too crazy? (not sure if I worded that correctly... after all... it's been more than 8 hours since my last coffee... lol) If I take up a text adventure, and there is no promise or guarantee of that happening, it will involve a LOT of work... I know that there are many "Interactive Fiction" engines out there, which will certainly shorten the creative time immensely, but that will reduce the amount of fun and satisfaction of creating it "by hand"... Oh. Another use for the "scrolling"... replace the pressing of the space bar with a timer and it could be used to create a "Star Wars" crawl... of course the "shrinking" font will need to be worked on... but still... Thanks for the code... this could be fun... RE: Scrolling Text - kevin - 11-03-2024 "what if the "y" half of set caret was monitored and only display the text if it is greater than zero... " That would work Johnno. I just did a quick test here, and for a table with up to 1000 items (lines to print), there is no difference between printing all lines, or just those that appear on screen (on my pc). However, by the time the table has reached 2000 items, the frame per second figure for printing all lines is 300, compared to 500 when I just print the lines that appear on screen. So, it is really down to how many lines of narrative you would want to store in the table for the text adventure. You may even have the option of removing some lines from the table if they are no longer needed? RE: Scrolling Text - johnno56 - 11-03-2024 1,000 to 2,000 lines of text is a lot... String space would then begin to be a concern... In the "old days", the text that scrolled off the top of the screen, would never be seen again. The players own memory (or hand drawn map) would have to be used... therefore, if the text is being 'deleted', the only text that needs to be 'stored' is the text that appears on the screen at any given time... Usually that would be 25 lines of text... (depending on the font used)... in theory... Room "descriptions" can be stored in a file(s) and "read" when needed... Ever player "Zork"? (I never did get to finish it... lol) Even though it was "text based" it relied on the best graphics engine available... the imagination... I miss the old days... Ha. The last time I tackled a "Type-in" adventure game was using Basic with line numbers... It would be fun to try something like that with N7... the only problem I have with conversions is that "goto" command that can send you out of a loop to who knows where... lol Hmm... Food for thought... RE: Scrolling Text - 1micha.elok - 11-04-2024 This is my version of scrolling text , very simple .... Code: set window "scrolling text",1000,500,false Another simple text game ... Code: pln "==============" |