writing text to any file from inside AM

This forum is meant for people to share their knowledge by writing their own tutorials for Adventure Maker.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

writing text to any file from inside AM

Postby reneuend » Thu Oct 15, 2009 3:47 am

I figured out how to write a text stream to any file you want in any format to a file from inside AM. No plugin needed.

Tutorial coming soon!
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2762
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby Lyberodoggy » Thu Oct 15, 2009 2:22 pm

Great!!! I'd love to read that tutorial...
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby ShadowHunter » Thu Oct 15, 2009 3:04 pm

Same here :D
User avatar
ShadowHunter
Forum Admin and Games Page admin
 
Posts: 1304
Joined: Fri Jun 06, 2003 10:37 pm
Location: Belgium

Postby Kat12 » Mon Oct 19, 2009 2:43 pm

Sounds interesting!
Kat
User avatar
Kat12
Frequent Poster
 
Posts: 103
Joined: Sun Mar 22, 2009 10:42 pm

Postby reneuend » Mon Oct 19, 2009 5:08 pm

I haven't forgotten this....I've been busy beta-testing something that is going to really shake up the AM world! :D
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2762
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby reneuend » Sat Jan 08, 2011 9:37 pm

OK..First, I know I posted how to do this somewhere in these forums a very long time ago, because I used this with my Throwman game. I'm confused! :shock:

I used it to save passwords, game stats and scores, and lines of text.

It is very very simple to use.
NOTE: I'm going to add a tutorial on this in issue 15 of bbb. :wink:


Code: Select all
Sub Write2File(yourfilename, byval savetext)

  dim myfile
  set filesys = CreateObject ("Scripting.FileSystemObject")
  set myfile = filesys.CreateTextFile (GetPath(2) & yourfilename, true)
  set myfile = filesys.GetFile(GetPath(2) & yourfilename)
  set txtstream = myfile.OpenAsTextStream (2, -2)
  txtstream.Write savetext
  txtstream.Close

End Sub



Code: Select all
Function GetAllFileContents(yourfilename)

  Dim mytext
  Dim myfile

  set filesys = CreateObject ("Scripting.FileSystemObject")
  set myfile = filesys.GetFile(GetPath(2) & yourfilename)
  set txtstream = myfile.OpenAsTextStream (1, -2)

  mytext = txtstream.readall()
  txtstream.Close

  GetAllFileContents = mytext

End Function
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2762
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby Lyberodoggy » Sun Jan 09, 2011 11:03 pm

Great! works perfectly, thanks
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens


Return to Post Your Own Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests