1. Game Du Skill
- Posted by Paul Kerslake <paulk at UNISERVE.COM> Jan 12, 2001
- 429 views
------=_NextPart_000_0043_01C07CC3.FE6E91E0 charset="iso-8859-1" Hey, all. I'm thinking of starting a role-playing game and I thought I'd use = the Dragon Warrior top down view. I then got to thinking I should use a = TXT file, with a series of numbers that represent the landscape.=20 Like this: 1=3Dgrass plain 2=3Dhills 11112222111 Which would make 4 squares of grass plains, the 4 hills, the 3 more = grass plains. The problem is, I don't know how to read and write files. = Even a text file for crying out loud. So, if one of you great big gurus = in the sky could teach me how to read and write text files. -----Thanks -------------------/\=3D=3D=3D=3DThomas ------=_NextPart_000_0043_01C07CC3.FE6E91E0 charset="iso-8859-1" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-1" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>Hey, all.</FONT></DIV> <DIV> </DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2> I'm thinking of = starting a=20 role-playing game and I thought I'd use the <EM>Dragon Warrior </EM>top = down=20 view. I then got to thinking I should use a TXT file, with a series of = numbers=20 that represent the landscape. </FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>Like this:</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>1=3Dgrass plain</FONT></DIV> <DIV><FONT face=3DArial size=3D2>2=3Dhills</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>11112222111</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>Which would make 4 squares of grass = plains, the 4=20 hills, the 3 more grass plains. The problem is, I don't know how to read = and=20 write files. Even a text file for crying out loud. So, if one of you = great big=20 gurus in the sky could teach me how to read and write text = files.</FONT></DIV> <DIV> </DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>-----Thanks</FONT></DIV> <DIV><FONT face=3DArial = ------=_NextPart_000_0043_01C07CC3.FE6E91E0--
2. Re: Game Du Skill
- Posted by chris bensler <bensler at Mailops.Com> Jan 13, 2001
- 420 views
Hi Paul, No offense, but if you don't take the time to look at the docs, of course your going to have a hard time to figure things out. What you want to know is in the Library.Doc If you learn to find things out for yourself, you will learn much more quickly. As well, you will get ansers to your questions more quickly. People don't mind helping you, but many things you ask about can be found in the EU Docs. Have you DL'd ABGTE2? Have you read through the ENTIRE refman.doc? before you post to the list asking questions, in would be in your own benefit to look in the library.doc The library.doc contains info on all the essential commands included with EU. Try checking out the File and Device I/O section... If you are really stuck, I'm sure people will be more than glad to help, myself included. As a matter of fact, I was in the midst of looking it up for you, when I realized that there isn't much chance that you yourself actually looked. Because it is quite easy to find. Reading the documentation is the best advice you will ever get when learning to program, in fact, that can be applied to pretty much anything, not just EU, or even programming. If you still don't understand, read it again. THEN, when you have questions, they will be much more specific, and others will be more able, (and more willing) to help you. I have already prepared an example for you on how to do file input/output, but by me telling you, you will easily forget. If you find out for yourself, chances are, you will NEVER forget. Trust me, I'm a Teacher, trial and error will take you MUCH further than someone handing you the answers. imagine if I gave my students work to do in class, and instead of letting them make mistakes, and trying on their own, I just told them the aswers to the questions.. Do you think they would even remember the next day what I told them? Chris ________________________________________________________________
3. Re: Game Du Skill
- Posted by Ferdinand Greyling <mwfch at MWEB.CO.ZA> Feb 11, 2000
- 418 views
------=_NextPart_000_0039_01BF7439.527C50E0 charset="iso-8859-1" Hey bro , i`m also bussy with a RPG like that ! Cool ! Hope the best of = coding with your game ! I`m telling you man , RPG is awsome stuff . O , = make a nice sad ending ! bye .. Read ya later ! Ferdinand Greyling=20 ----- Original Message -----=20 From: Paul Kerslake=20 To: EUPHORIA at LISTSERV.MUOHIO.EDU=20 Sent: Saturday, January 13, 2001 4:17 AM Subject: Game Du Skill Hey, all. I'm thinking of starting a role-playing game and I thought I'd use = the Dragon Warrior top down view. I then got to thinking I should use a = TXT file, with a series of numbers that represent the landscape.=20 Like this: 1=3Dgrass plain 2=3Dhills 11112222111 Which would make 4 squares of grass plains, the 4 hills, the 3 more = grass plains. The problem is, I don't know how to read and write files. = Even a text file for crying out loud. So, if one of you great big gurus = in the sky could teach me how to read and write text files. -----Thanks -------------------/\=3D=3D=3D=3DThomas ------=_NextPart_000_0039_01BF7439.527C50E0 charset="iso-8859-1" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-1" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV>Hey bro , i`m also bussy with a RPG like that ! Cool ! Hope the = best of=20 coding with your game ! I`m telling you man , RPG is awsome stuff . O , = make=20 a nice sad ending ! bye ..</DIV> <DIV> </DIV> <DIV><FONT face=3DArial>Read ya later !</FONT></DIV> <DIV>Ferdinand Greyling </DIV> <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: = 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px"> <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV> <DIV=20 style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: = black"><B>From:</B>=20 <A href=3D"mailto:paulk at UNISERVE.COM" title=3Dpaulk at UNISERVE.COM>Paul = Kerslake</A>=20 </DIV> <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A=20 href=3D"mailto:EUPHORIA at LISTSERV.MUOHIO.EDU"=20 title=3DEUPHORIA at LISTSERV.MUOHIO.EDU>EUPHORIA at LISTSERV.MUOHIO.EDU</A> = </DIV> <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Saturday, January 13, = 2001 4:17=20 AM</DIV> <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Game Du Skill</DIV> <DIV><BR></DIV> <DIV><FONT face=3DArial size=3D2>Hey, all.</FONT></DIV> <DIV> </DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2> I'm thinking of = starting a=20 role-playing game and I thought I'd use the <EM>Dragon Warrior = </EM>top down=20 view. I then got to thinking I should use a TXT file, with a series of = numbers=20 that represent the landscape. </FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>Like this:</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>1=3Dgrass plain</FONT></DIV> <DIV><FONT face=3DArial size=3D2>2=3Dhills</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>11112222111</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>Which would make 4 squares of grass = plains, the 4=20 hills, the 3 more grass plains. The problem is, I don't know how to = read and=20 write files. Even a text file for crying out loud. So, if one of you = great big=20 gurus in the sky could teach me how to read and write text = files.</FONT></DIV> <DIV> </DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>-----Thanks</FONT></DIV> <DIV><FONT face=3DArial = ------=_NextPart_000_0039_01BF7439.527C50E0--
4. Re: Game Du Skill
- Posted by "Thomas Parslow (PatRat)" <patrat at rat-software.com> Jan 13, 2001
- 447 views
- Last edited Jan 14, 2001
> Hey, all. > > > I'm thinking of starting a role-playing game and I thought I'd use the > Dragon Warrior top down view. I then got to thinking I should use a TXT file, > with a series of numbers that represent the > landscape. > > Like this: > > 1=grass plain > 2=hills > > 11112222111 > > Which would make 4 squares of grass plains, the 4 hills, the 3 more grass > plains. The problem is, I don't know how to read and write files. Even a text > file for crying out loud. So, if one of you > great big gurus in the sky could teach me how to read and write text files. > > > -----Thanks > -------------------/\====Thomas Reading from a file is almost the same as reading from the keyboard, you mostly use the same functions. File can be opened in either BINARY or ASCII mode. In ASCII mode all carriage-return/newline pairs will be converted to a '/n' (newline) character and all '/n' characters being output will be convert to a carriage-return/newline, this is the mode you should use for what your doing. OPENING THE FILE You have to tell the operating system that you want to use the file and what you want to use it for, you do this using the open() function: FileNumber = open(Filename, Mode) Filename is the name of the file you want to open, for example "test.txt" Mode is a string containing one or two letters to indicate what you want to do with the file. Use "r" if you want to read the contents of the file, "w" if you want to output to a file (any existing file of the same name will be deleted) or "a" if you want to start writing at the end of an existing file (append data to it). You can append "b" to the Mode string to open the file in BINARY mode but if you leave it off then ASCII mode will be assumed. FileNumber is a number returned by open() that identifies the file, you must use this number wherever you read or write to the file. READING FROM A TEXT FILE ONE LINE AT A TIME You can read a file one line at a time using the gets() function. The gets() function will return the next line in the file as a sequence or a -1 if there are no more lines to read: Line = gets(FileNumber) Line should be an object, after each call to gets check if Line is an atom, if it is then then you have finished reading the file. FileNumber should be a file number returned by open. Make sure you open the file for reading (with mode set to "r"). WRITING TO A TEXT FILE The easiest way to write to a file is to use the puts() function, used exactly the same as when writing to the screen except use the filenumber in place of 1: puts(FileNumber,String) Make sure you open the file for writing or appending (with mode set to "w" or "a"). CLOSING THE FILE You should always close the file after using it, do this with the close() function: close(FileNumber) EXAMPLE atom FileNumber object Line --Create a new text file for writing FileNumber = open("test.txt","w") --Write to the file puts(FileNumber,"First line of test file!\nAnd another line!\n") puts(FileNumber,"WOW! A third line!!!!!") --And close it close(FileNumber) --Reopen the file for reading FileNumber = open("test.txt","r") while 1 do --Read in the next line Line = gets(FileNumber) --Check if we've reached the end of the file if atom(Line) then --We have, exit the loop exit end if --Print the line on the screen so that we can check that it's working puts(1,Line) end while --Close the file close(FileNumber) Hope that's helpful or at least makes some sort of sense, it's a little late here (ok, not that late, but I'm very tired all the same:) Thomas Parslow (PatRat) ICQ #:26359483 Rat Software http://www.rat-software.com/ Please leave quoted text in place when replying