This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Lord_Spelunky's profile picture

Hard Saving Variables And Checking Specific Chars And Words

Started by Lord_Spelunky, 12 August 2013 - 12:24 PM
Lord_Spelunky #1
Posted 12 August 2013 - 02:24 PM
Wanting to make a store that has its own credit, but the server gets restarted a lot, wondered how I can hard save them onto say a floppy disk and or just a program, then I want to know how to read from them I know how read words, but I plan to have it all in one, and try to make it have some kind of formula, so if anyone tampers with it, it will just lower their credit so if they put it higher then it actually makes it lower :)/> thanks for help in advance :D/>
Engineer #2
Posted 12 August 2013 - 02:56 PM
Well.. here is a neat tutorial: http://www.computercraft.info/forums2/index.php?/topic/10654-storing-variables-in-a-file/page__fromsearch__1
Lord_Spelunky #3
Posted 12 August 2013 - 02:58 PM
Thanks, I searched saving variables and Saving things into files but nothing came up, thanks for the help
theoriginalbit #4
Posted 12 August 2013 - 03:02 PM
Also, I would say that your best bet would be to do 1 of two things…

1. save two copies of the file, and compare the two, making sure that one file is well hidden somewhere (maybe even on a webserver)
2. create your own file format, with a custom encoding system… this way even if they get access to your file, they have to figure out how the data is stored first to then be able to edit it…
Lord_Spelunky #5
Posted 12 August 2013 - 03:05 PM
I know how to do the first, but not the second, they said they can't put encryption tuts on the forum did they? I will google it now :P/>
Lord_Spelunky #6
Posted 12 August 2013 - 03:12 PM
Gah :(/>/> can someone help, Wikipedia is very complicated and I found a function to do it, but it doesnt explain anything, I understood the basics, changing a string or anything into something that doesn't make any sense, then having a specific thing at e end to figure the un- understandable stuff, but I have no clue how to do it? >.<

Website: http://forums.coronalabs.com/topic/14032-very-simple-string-encryption-decryption/
theoriginalbit #7
Posted 12 August 2013 - 03:15 PM
Encoding… not encryption… and I'm not aware of any such rule unless it was added in the past few days…
Sadly though most people in the past, well, attempt to create a tutorial, and just simply don't…

A project I was working on with another person on these forums we created our own file format scheme… You can see examples of what I mean by encoding.
https://github.com/t.&#46;&#46;/apis/CCTStream
Here is an example of one of our encoded files.
https://raw.github.com/theoriginalbit/CCTube/develop/videos/transcoded-compressed
Lord_Spelunky #8
Posted 12 August 2013 - 03:34 PM
How do I pull specific chars then?
theoriginalbit #9
Posted 12 August 2013 - 04:36 PM
the read function on the file handle allows you to read one byte at a time. That's the read, not the readAll (with the fs handle).