Mystic Software Forums

Mystic Software => General Discussion => Topic started by: DarkElite on January 17, 2006, 02:36:55 PM

Title: (no subject)
Post by: DarkElite on January 17, 2006, 02:36:55 PM
Redundant, I know, but none the less...

I'm still in need of a plug-in or some way to read .txt files in the Toolkit... Most progress is impossible without this tool.  I've completed all of the "server" log-in stuff up untill it actually checks ur information (eh...), which relates as to whether I should let you store your games on the FTP server (should Spyder or Xorlak OK it) or on your own harddrive?

Storage on computer:
Pro: No possibility of someone hacking you.
Con: Can't access your own game from anywhere but your own computer.

Storage on FTP: (opposite)
Pro: Accessibility from any computer with TR installed.
Con: Hackers (should I be "blessed" with such an honor of people liking my game that much  Smile ) could gain you password and mess with your account.
Title: (no subject)
Post by: Dude Man on January 17, 2006, 07:51:34 PM
Hmmm, I'd probabbly not play the game anywere else but my own computer. Also, people have no lives, and may try and be hax0rz.
Title: (no subject)
Post by: Xorlak on January 18, 2006, 11:25:40 AM
Well, TK3 apparently has some file I/O commands (though I haven't tested them yet).  But then of course, I'm not sure if you can get the FTP plugin working with that.
Title: (no subject)
Post by: DarkElite on January 18, 2006, 01:56:36 PM
Hm... but don't the I/O commands only work for binary files (which me + binary =  :huh: ).
Title: (no subject)
Post by: Xorlak on January 19, 2006, 12:01:49 PM
Well yes, but it looks like it transalates to and from ASCII.  I'm looking at the <a href='http://tk3.toolkitzone.com/help/?page=19#fileprint' target='_blank'>fileprint()</a> command.  And I would assume fileinput() reads and returns a line in ASCII.
Title: (no subject)
Post by: DarkElite on January 20, 2006, 04:54:15 PM
Eh... English may work better?  Wink

Just show me how to get the processor to read from an already created file, and set the data into a variable, if you can.
Title: (no subject)
Post by: Xorlak on January 21, 2006, 11:21:17 AM
Heh, ASCII means plain text.

It looks like you'd do something like this (haven't tryed any of this out yet)

Code: [Select]
openFileInput("info.txt","Files") // 'Files' is the folder you put the file in, e.g. 'Prg'
dest$ = fileInput("info.txt") // dest$ will be the info is stored in
...
closefile("info.txt")

fileInput() reads one line from the file, and each call will read the next line until it gets to the end.
Title: (no subject)
Post by: DarkElite on January 21, 2006, 01:36:16 PM
Hm... Alright, thanks.  I'll give it try.

I hope this works...  :wacko:

Edit:

Bleh! It appearantly didn't work.  When I tested the variable dest$, it was returned as some "FileInput(0)" nonsense.  Any clue what that means?
Title: (no subject)
Post by: Xorlak on January 22, 2006, 03:28:17 PM
Okay, it looks like you can't just make an arbitrary folder and read files from it.  It has to be one of the given TK folders.  So put your files that you want to read in your 'Prg' or 'Misc' folder or wherever you want them and change 'Files' to the name of that folder.  Tested it and it seems to work fine that way.
Title: (no subject)
Post by: DarkElite on January 22, 2006, 03:31:51 PM
Eh... I had had it in "Misc"...

Code: [Select]
OpenFileInput ("temporary information.txt","Misc")
dest$ = FileInput ("temporary information.txt")
CloseFile ("temporary information.txt")

Gah, Ill give it another go...

Edit:

No change.
Title: (no subject)
Post by: Xorlak on January 23, 2006, 11:55:46 AM
The file has text in it, right?  It'll give an error if you try to read a blank file.

The code I'm testing exactly is:

Code: [Select]
openFileInput("test.txt","Misc")
dest$ = fileInput("test.txt")

mwin(dest$)
wait()

dest$ = fileInput("test.txt")

mwin(dest$)
wait()

closefile("test.txt")

With test.txt being:
Code: [Select]
aaa
bbb
ccc

Running the above program will give "aaa" followed by "bbb" in an mwin().
Title: (no subject)
Post by: DarkElite on January 23, 2006, 03:23:03 PM
Oh sweet god! It's working!!
Thanks a bunch Xorlak.

Sadly, now I've gotta bust your bubble by tell you what was wrong. I normally put a space between the command and the parenthesis with the parameters inside.  For this command, it appears, the space cannot exist.  Pretty stupid.  <_<
Title: (no subject)
Post by: Michael J. Hill on January 24, 2006, 07:52:13 PM
As far as your FTP plans go.  I suppose we can allow it on your account provided it doesn't go over the hosting limit.  Though keep this in mind - I would not recommend it, because it'd be on your account, it'd have to use your username and password to access it.  If you're not careful in setting it up, your username and password can get leaked.
Title: (no subject)
Post by: DarkElite on January 24, 2006, 09:58:39 PM
Heh, thanks for the advice.

Not to worry though. I got Xorlak to set up a separate account just for the .txt files I need that also has a file limit set.  May need to be revised if people like what I offer, but we shouldn't just to conclusions yet.  ^_^