|
Post by johnno56 on May 3, 2020 19:01:54 GMT -6
N00b,
I am going to assume that the "prints()" command uses a default font (possibly a system font) to place text on a blank canvas.
How does RC determine what the 'default' text font will be and can it be changed and if so, how?
Reason: With most of the old Text Adventure games of old, whilst playing the game, the output would just scroll off the screen. The 'default' text, when using "prints()" scrolls off the screen, but the font size is very small. So, unless a screen scroll routine is used for DrawText(), playing a TextAdv in the 'default' font would be a eye-strain... Well, for 'my' eyes, anyway... lol
I hope I am making sense...
Cheers
J
|
|
|
Post by n00b on May 3, 2020 19:41:05 GMT -6
PrintS uses a bitmap font. It is built-in and can't be changed. The printS, InputS, and ZoneInputS all use it.
I would highly recommend DrawText() and ReadInput() for an actual game.
|
|
|
Post by johnno56 on May 3, 2020 19:49:36 GMT -6
Oh... I just knew you were going to say that... nuts... Oh well.... lol
Do you happen to have, or know of, a text scrolling routine for DrawText()?
|
|
|
Post by n00b on May 3, 2020 22:50:09 GMT -6
It shouldn't be to tricky to write. You can use the GetTextSize() to get the size of rendered text. If that exceeds the width of the screen then go to the next line.
|
|
|
Post by johnno56 on May 3, 2020 23:59:20 GMT -6
Now why did I guess you were going to suggest that? I might even add, if I may be so bold, that when the height of the rendered text that is dropped to the next line exceeds the max height of the window, then move every line of rendered text above it, up at least the height of the rendered text... Sound about right?
You're going to make work for this one aren't you? lol
Thank you for the tip...
|
|
|
Post by n00b on May 4, 2020 14:13:33 GMT -6
If you can't figure this out by the end of the week I can take some time to try to tinker with it. I am going to be pretty busy most of the week.
|
|
|
Post by johnno56 on May 4, 2020 17:01:36 GMT -6
I'm in no rush for this one... I will move on with the default text, just to see if I can... lol, while researching text handling... Text... It's been SO long... Rotating, animated sprites seem so simple in comparison... lol It will eventually come back to me... lol
May the 4th be with you.
|
|
|
Post by johnno56 on May 5, 2020 19:14:02 GMT -6
I have been giving it some more thought... (stop laughing!)
I may employ a basic (no pun intended) clear screen after each input. If I remember correctly, the old text adventures used text, mainly because early machines were not capable of using graphics. Hence the need to scroll. How much scrolling do we need? Usual display will consist of a location name; A brief description of the location; List possible directions; List objects or things; Maybe display current score; The prompt for the users input. I think all that can be squeezed into one screen... What do you think?
I think a text adventure would be as complicated as I care to get, so I hesitate going down the RPG road (again, no pun intended), because simple is what I like...
This will either be fun... or a complete nightmare... Care to toss a coin?
I am not sure if I have mentioned this before, but I have an old Amstrad book from 1985 (Pentacle Adventure Creator). One of it's abilities is to create a data file of all the rooms, objects etc. It is limited to 120 locations, due to amstrad's 64K ram, but could be useful in making games. It also has the ability to play the game. But it's written with line numbers that goto's and gosub's cause it to jump about like mad fleas...
I can use the file create option then try to cobble together a simple 'player' for the file...
Fingers crossed...
|
|
|
Post by n00b on May 6, 2020 5:49:06 GMT -6
If you can post a mock-up of how you think the screen should look, I could probably help you get started.
|
|
|
Post by johnno56 on May 6, 2020 7:42:22 GMT -6
I have already started. Working on a bare-bones, 4 option, menu at the moment. Input data, Save data, Play and Quit. I am experimenting with the "ReadInput" commands (like what was used in the high score table of Asterocks) and seems to be working ok.
' Based on the Amstrad Pentacle Adventure Creator ' by Clive Gifford - 5 May 1985 ' xmax = 640 ymax = 480 title$ = "Text Adventure File Creator" WindowOpen(1,title$,0,0,xmax,ymax,0) CanvasOpen(1,xmax,ymax,0,0,xmax,ymax,0)
'Dim f$[35] 'Dim Loc$[120] 'Dim L[120,8] 'Dim Obj$[150] 'Dim Ob[150,4] 'Dim Mon$[40] 'Dim mo[40,2] Dim msg$[40] 'Dim ms[40]
' COLOURS ' black = rgb(0,0,0) blue = rgb(0,0,128) brightblue = rgb(0,0,255) red = rgb(128,0,0) magenta = rgb(128,0,128) mauve = rgb(128,0,255) brightred = rgb(255,0,0) purple = rgb(55,0,128) brightmagenta = rgb(255,0,255) green = rgb(0,128,0) cyan = rgb(0,128,128) skyblue = rgb(0,128,255) yellow = rgb(128,128,0) white = rgb(192,192,192) paleblue = rgb(128,128,255) orange = rgb(255,128,0) pink = rgb(255,128,128) palemagenta = rgb(255,18,255) brightgreen = rgb(0,255,0) seagreen = rgb(0,255,128) brightcyan = rgb(0,255,255) limegreen = rgb(128,255,0) palegreen = rgb(128,255,128) palecyan = rgb(128,255,255) brightyellow = rgb(255,255,0) paleyellow = rgb(255,255,128) brightwhite = rgb(255,255,255)
choice = 0 k = 0 w = 0 h = 0
size50 = 1 loadFont(1,"dungeonReg.ttf",50) size30 = 2 loadFont(2,"dungeonReg.ttf",30)
clearcanvas '====================================================================== sub centerx(fnt_slot, text$, xoffset, ypos, col) font(fnt_slot) setColor(col) GetTextSize(fnt_slot, text$, ByRef w, ByRef h) RenderText(199,text$) xpos = ((xmax - w) / 2) + xoffset DrawImage(199, xpos, ypos) end sub
sub inputdata() ' ADVENTURE NAME ' ReadInput_Start() ReadInput_ToggleBackspace(true) user_input$ = "" msg$[3] = "" do clearcanvas centerx(size50, "INPUT DATA", 0, 0, palegreen) font(size30) setColor(orange) user_input$ = ReadInput_Text$ DrawText("Enter name of Adventure: " + user_input$, 100, 100) if key(k_return) then exit do end if update() loop ReadInput_Stop msg$[3] = ucase(user_input$) print msg$[3] wait(500) choice = 0 end sub
sub savedata() do clearcanvas centerx(size50, "SAVE DATA", 0, 0, palegreen) centerx(size50, "Work in progress!", 0, (ymax/2)-50, orange) centerx(size30, "ESC to return to MENU", 0, ymax - 30, white) update() loop until key(k_escape) = 1 wait(500) choice = 0 end sub
sub loaddata() do clearcanvas centerx(size50, "LOAD DATA", 0, 0, palegreen) centerx(size50, "Work in progress!", 0, (ymax/2)-50, orange) centerx(size30, "ESC to return to MENU", 0, ymax - 30, white) update() loop until key(k_escape) = 1 wait(500) choice = 0 end sub
sub playgame() do clearcanvas centerx(size50, "PLAY ADVENTURE", 0, 0, palegreen) centerx(size50, "Work in progress!", 0, (ymax/2)-50, orange) centerx(size30, "ESC to return to MENU", 0, ymax - 30, white) update() loop until key(k_escape) = 1 wait(500) choice = 0 end sub
sub quit() do clearcanvas centerx(size50, "EXITING MENU", 0, 0, palegreen) centerx(size50, "Good-bye!", 0, (ymax/2)-50, orange) centerx(size30, "ESC to EXIT", 0, ymax - 30, white) update() loop until key(k_escape) = 1 wait(500) choice = 0 end sub
sub menu() clearcanvas centerx(size30, " A D V E N T U R E C R E A T O R ", 0, 50, brightyellow)
font(size30): setColor(skyblue): DrawText("1", 200, 130) centerx(size30, "INPUT DATA", 0, 130, palegreen) setColor(skyblue): DrawText("2", 200, 170) centerx(size30, "SAVE DATA", 0, 170, palegreen) setColor(skyblue): DrawText("3", 200, 210) centerx(size30, "PLAY ADVENTURE", 0, 210, palegreen) setColor(white) setColor(skyblue): DrawText("4", 200, 250) centerx(size30, "QUIT", 0, 250, white) k = inkey select case k case 49 choice = 1 inputdata() case 50 choice = 2 savedata() case 51 choice = 3 playgame() case 52 choice = 4 wait(500) quit() wait(500) cls end end select update() end sub '======================================================================
while choice = 0 menu() wend
This what I have at the moment. It isn't much but it's a start.
Simple select case inkey loop to drive the menu.
Option #1, input data, works... Only one item to enter - Adventure Title - then enter to return to menu. Eventually this will continue to all items of data input before returning to the menu. I have only one theoretical issue... Pressing enter, after keying in the adventure title, may cause a problem... Even thought ReadInput_Start and Stop are used, I have a feeling that the keyboard buffer will flag the enter key as pressed and may not allow the next item to be input. Just a theory.... I will add more once I have had some sleep....
|
|
|
Post by n00b on May 6, 2020 18:14:09 GMT -6
Could you include the font you are using?
|
|
|
Post by n00b on May 6, 2020 19:04:12 GMT -6
I just tried it out. It looks pretty good so far.
|
|
|
Post by johnno56 on May 6, 2020 20:18:15 GMT -6
Drop this next piece directly after the "choice = 0" in the input data subroutine.
' NUMBER OF LOCATIONS ' ReadInput_Start() ReadInput_ToggleBackspace(true) user_input$ = "" n = 0 do clearcanvas centerx(size50, "LOCATIONS", 0, 0, palegreen) font(size30) setColor(orange) user_input$ = ReadInput_Text$ DrawText("Enter number of locations: " + user_input$, 100, 100) if key(k_return) then exit do end if update() loop ReadInput_Stop n = val(user_input$) print "n = " + str(n) wait(500) choice = 0 Re-start and then observe my suspicion...
Enter the title then press enter. The menu will then re-appear. I think the ReadInput_Text$, in the 'locations' section, is picking up the 'enter' from the title. The user_input$ now has the value of a carriage return and because user_input$ equals 'nothing', exits the do..loop, assigns 'n' as nothing and returns to the menu. I could be wrong...
|
|
|
Post by tbird on May 6, 2020 22:20:29 GMT -6
Looks cool, I think you just need a key timer, like in my name entry example I posted a bit ago for your asterocks, then no double reading of any keys.
|
|