Beanie93 Posted August 9, 2011 Author Share Posted August 9, 2011 This is my first tutorial for Eclipse Origins.When you have completed this tutorial, you will have a working Player Notes system, which will save text into a text file, and read it back into a textbox.You will use the FileSystemObject object for doing this. Let's get on the tutorial.First of all, all of this is done Client-side. Once you got your client project loaded, go to the 'Project' menu, and at the bottom, click on 'References'. Then, look for 'Microsoft Scripting Runtime' and check it.Alright, what we just did is let VB6 have access to the FileSystemObject object. Let's start on the actual tutorial.All edits are done in frmMain.Make:1 PictureBox - picNotes1 TextBox - txtNotes2 Buttons - cmdSave and cmdCloseMake sure the PictureBox is on top of everything, then move onto the Menu (where picParty, picInventory, etc. is). Make sure the txtNotes, cmdSave and cmdClose are in it.Arrange your txtNotes, cmdSave and cmdClose at your liking.Then, create a Label named lblNotes. Place it on picOptions, or wherever you want.Now, let's get onto the code.Go at the top of frmMain's code, and below **Private PresentX As Long**, add:```'FileSystemObjectDim FSO As FileSystemObjectDim TS As TextStream```Then, double-click cmdClose, and add the following:```picNotes.Visible = FalsetxtNotes.Text = ""```After that's done, double-click cmdSave, and add the following:``` Dim Text As String Text = txtNotes.Text Set FSO = New FileSystemObject Set TS = FSO.OpenTextFile(App.Path & "\data files\notes.txt", ForWriting, True) TS.WriteLine Text TS.Close```What we just did, is declare a string variable for our txtNotes, and then look for notes.txt in data files, which we will add later. Then, it writes whatever the user has written in the txtNotes. Then, it closes it so you can open the file again later.Now, we are almost done.Double-click lblNotes and add the following:``` Set FSO = New FileSystemObject If FSO.FileExists(App.Path & "\data files\notes.txt") Then Set TS = FSO.OpenTextFile(App.Path & "\data files\notes.txt") Do While Not TS.AtEndOfStream txtNotes.Text = TS.ReadLine Loop TS.Close End If picNotes.Visible = True```This also looks for notes.txt in data files, and then sets the text notes.txt contains to txtNotes. We close it and make picNotes display.Finally, go to your data files folder, and create a text file named 'notes.txt'.There you go, a working Player Notes system with no bugs.Of course, you are free to use this in your game, as long as you give credit to me and do not claim it as your own.I have tested it, and found no bugs, but in case you find one, make sure to report it to me in this thread, or via PM. Hope this helps you in your project.Regards,Beanie93 Link to comment Share on other sites More sharing options...
Kemerd Posted August 9, 2011 Share Posted August 9, 2011 Nice… I guess? Link to comment Share on other sites More sharing options...
Domino_ Posted August 9, 2011 Share Posted August 9, 2011 Explain me, why does this needed in game? xD Link to comment Share on other sites More sharing options...
Beanie93 Posted August 9, 2011 Author Share Posted August 9, 2011 Players can store notes in-game.Example:"Kill [name] tomorrow"Things like that, it may not be useful in some games, but it may be useful in other games. Depends the genre and what is it about. Link to comment Share on other sites More sharing options...
Domino_ Posted August 9, 2011 Share Posted August 9, 2011 Thanks for info, As example , in game you can write for tomorrow " Finish [quest name] quest" :) Link to comment Share on other sites More sharing options...
Medleyy Posted August 9, 2011 Share Posted August 9, 2011 Would you mind plonking this into FinalSTAND? *Big cheesy grin* Link to comment Share on other sites More sharing options...
RyokuHasu Posted August 9, 2011 Share Posted August 9, 2011 I see how this could also help players remember certain self-hints on something.=D good job Link to comment Share on other sites More sharing options...
Darth Tyllo Posted August 10, 2011 Share Posted August 10, 2011 This isn't working for me, for some reason :( Link to comment Share on other sites More sharing options...
Beanie93 Posted August 10, 2011 Author Share Posted August 10, 2011 What's the problem? It won't save the text into the file?Without details I can do nothing.Thanks everyone, it really was something I had in mind for quite a bit. Link to comment Share on other sites More sharing options...
Darth Tyllo Posted August 10, 2011 Share Posted August 10, 2011 Oh, yeah, sorry, for me it wont open up picNotes, I don't know if it's supposed to open when you click lblNotes or not, but it doesn't for me :( Link to comment Share on other sites More sharing options...
Beanie93 Posted August 10, 2011 Author Share Posted August 10, 2011 Make sure it's at top of everything. Right-click it, and click "Bring to front".If that doesn't work, make sure picNotes is above the other pics, like picParty, picOptions, picSkills, etc.If you have what I just said done, just make sure that it got this code:``` Set FSO = New FileSystemObject If FSO.FileExists(App.Path & "\data files\notes.txt") Then Set TS = FSO.OpenTextFile(App.Path & "\data files\notes.txt") Do While Not TS.AtEndOfStream txtNotes.Text = TS.ReadLine Loop TS.Close End If picNotes.Visible = True``` Link to comment Share on other sites More sharing options...
Darth Tyllo Posted August 15, 2011 Share Posted August 15, 2011 I have the code, I even tried copy/pasting the whole thing, and it still doesn't work :( Link to comment Share on other sites More sharing options...
Beanie93 Posted August 16, 2011 Author Share Posted August 16, 2011 You even got it over the HUD? With HUD I mean where the Invetory, Skills, etc. appear. Link to comment Share on other sites More sharing options...
Craselin Posted August 17, 2011 Share Posted August 17, 2011 @Darth:> I have the code, I even tried copy/pasting the whole thing, and it still doesn't work :(This may seem like a stupid question but many newish people still don't get it. Did you compile the client using VB6? Link to comment Share on other sites More sharing options...
Darth Tyllo Posted August 19, 2011 Share Posted August 19, 2011 Beanie: If you mean within VB6, is it above all other Picture Boxes in that area, yes.Craselin: No, I have no need to compile, as it doesn't work when I test it from within VB6\. D: Link to comment Share on other sites More sharing options...
Beanie93 Posted August 19, 2011 Author Share Posted August 19, 2011 Hmm, that's weird.Try copying picNotes and then delete it. Paste it at the right side of frmMain.If that doesn't work, try following the tutorial again. Link to comment Share on other sites More sharing options...
andy200129 Posted June 17, 2012 Share Posted June 17, 2012 I Followed The Tutorial Bit By Bit Step By Step i double checked it over and overbut this is an error when compilingDim FSO As FileSystemObject Link to comment Share on other sites More sharing options...
andy200129 Posted June 17, 2012 Share Posted June 17, 2012 could do with some help Link to comment Share on other sites More sharing options...
andy200129 Posted June 17, 2012 Share Posted June 17, 2012 Sorry about the bumps but srsly im not used to EO source im used to EE only just starting to get used to it but come on i spent a hour trying to figure it out but it has a errorwithDim FSO As FileSystemObjectthe FSO As FileSystemObject is errord Link to comment Share on other sites More sharing options...
Stein Posted June 17, 2012 Share Posted June 17, 2012 You seem to have forgotten to do this part:> First of all, all of this is done Client-side. Once you got your client project loaded, go to the 'Project' menu, and at the bottom, click on 'References'. Then, look for 'Microsoft Scripting Runtime' and check it.Please don't blindly copy/paste things without reading into how it works. Or at the very least read the tutorial properly. Link to comment Share on other sites More sharing options...
andy200129 Posted June 17, 2012 Share Posted June 17, 2012 i did that the first time round it still has a error Link to comment Share on other sites More sharing options...
Stein Posted June 17, 2012 Share Posted June 17, 2012 You did it wrong there somehow then, because that will enable you to use a FileSystemObject. ;] I'd suggest looking into it some more, and see if you have the appropriate libraries installed. Link to comment Share on other sites More sharing options...
andy200129 Posted June 17, 2012 Share Posted June 17, 2012 i sorted it i added a new dim to the other 2 and it semed to work :) all good Link to comment Share on other sites More sharing options...
Stein Posted June 17, 2012 Share Posted June 17, 2012 Ehhh~ Next time show me the full code that's bugging out along with everything surrounding the declaration of the stuff.. Would've made that much more obvious. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now