Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / read from text file

Author
Message
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 4th Sep 2003 18:59
Instead of having to type print "..." print "..." for my rules section, is there a way to do this in notepad, then have my program read from the .txt file and display the rules in the middle of the screen? This would make editing the rules much easier and tkae hours less time, as notepad has wordwrap and the rules are already typed on it.
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 4th Sep 2003 19:50
yup check out the 'open to read' command and learn how to use and manipulate strings


ChipOne
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Canada
Posted: 4th Sep 2003 21:09
keep in mind that notepad's wordwrap does not affect what is saved in a file (there are no line breaks saved as a result of notepad's worwrap on or off). you'll still need to worry about the line breaks when you get into your app, and/or actually put in the breaks yourself in notepad.

this also doesn't take into account the fact that you are likely using a different font and size in your game, and the rules wouldn't fit.

if you're looking for straightforward, type the rules into a graphics program (like PhotoShop) and save them on your background. you can then load the entire text as an image (one command) and display them on the screen (only one more command).

if you're stuck on text, i'd recommend using the text file commands in db, but you'll have to do some fidgeting to get it to look right on a line-by-line basis. alternatively, you can put each 'paragraph' of the rules on ONE line in your text file, then when you read it in, test the size of the paragraph with the TEXT WIDTH command and adjust as nessesary, shortening one word at a time until your text fits. this is a little more complicated, but there is example code out there that fits.

cheers

-= i only do what my rice krispies tell me to do =-
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 5th Sep 2003 18:40
thanks. I will put the rules sections onto images and load the images onto the rules pages

Login to post a reply

Server time is: 2024-09-20 21:29:08
Your offset time is: 2024-09-20 21:29:08