Official Everybody Edits Forums

Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?

You are not logged in.

Advertisement

Hello, visitor! These forums are run off of the revenue generated from these ads. If you'd like to support us, please whitelist us or consider donating:

#1 2016-07-27 01:45:32

cercul1
Dev Team
From: USA
Joined: 2015-02-18
Posts: 91

Storing Data

I  need a way to store stats such as health and hunger and a person to teach me how to code it.  I'll give you the details when you're teaching me.

Any questions?  Just ask.


Om_1869ea_249353.jpg

Offline

#2 2016-07-27 02:06:17

ashtoin
Member
Joined: 2016-06-26
Posts: 29

Re: Storing Data

Are you using an SDK like botbits, or just the player.io client library?
Do you want to save it to a file, or just keep it in memory?
Do you want to do this for every player, and do you want it to persist even after they leave?
Does it make a difference if they're using the //forums.everybodyedits.com/img/smilies/sad smiley instead of the //forums.everybodyedits.com/img/smilies/smile smiley?


After approximately a long time of being idle...
I've finally found the time, energy, and inspiration to begin...
Announcing...
the long-awaited sequal..
with an actual GUI...
event-based system instead of threads...
..nope never mind out of inspiration. I'll be back in another month or two.
It's here: LuaBot 2.0! (Hopefully we fixed that missing DLL problem)

Offline

Wooted by: (2)

#3 2016-07-27 02:30:08

capasha
Member
Joined: 2015-02-21
Posts: 3,749

Re: Storing Data

Best ways. XML, MySQL, JSON. Choose something of that.

I have found some more threads,
http://forums.everybodyedits.com/viewtopic.php?id=35240
http://forums.everybodyedits.com/viewtopic.php?id=35107
http://forums.everybodyedits.com/viewtopic.php?id=35064

Last edited by capasha (2016-07-27 02:39:01)

Offline

Wooted by:

#4 2016-07-27 02:39:55

hummerz5
Member
From: wait I'm not a secret mod huh
Joined: 2015-08-10
Posts: 5,795

Re: Storing Data

the monthly periodic storing data debate?

To recap further inform yourself, check here, where we discussed the issue at length.

Perhaps the best way is the one you figure out yourself? I mean, everyone has their niche they like, or the ones the experienced programmers have found that have the best functionality. In the long run, if you probably aren't going to use the fancy [insert feature here] the crazy folks love, perhaps the method you understand would be the most constructive.

Offline

#5 2016-07-27 02:47:10

cercul1
Dev Team
From: USA
Joined: 2015-02-18
Posts: 91

Re: Storing Data

ashtoin wrote:

Are you using an SDK like botbits, or just the player.io client library?
Do you want to save it to a file, or just keep it in memory?
Do you want to do this for every player, and do you want it to persist even after they leave?
Does it make a difference if they're using the //forums.everybodyedits.com/img/smilies/sad smiley instead of the //forums.everybodyedits.com/img/smilies/smile smiley?

I am using botbits but i'm going to be getting rid of it because it didn't do what i wanted.  I want to be able to access the file and edit as needed.  I need it for every player and it saves as they leave.  It doesn't make a difference at all what smiley they're using.

capasha wrote:

Best ways. XML, MySQL, JSON. Choose something of that.

I was thinking JSON because I've been recommended it before but I'd need someone to teach me.  Will you be my sensei? ^-^ I was also thinking of using a text file, but I'd also need help with that.

Last edited by cercul1 (2016-07-27 02:52:23)


Om_1869ea_249353.jpg

Offline

#6 2016-07-27 03:15:06

ashtoin
Member
Joined: 2016-06-26
Posts: 29

Re: Storing Data

cercul1 wrote:
ashtoin wrote:

Are you using an SDK like botbits, or just the player.io client library?
Do you want to save it to a file, or just keep it in memory?
Do you want to do this for every player, and do you want it to persist even after they leave?
Does it make a difference if they're using the //forums.everybodyedits.com/img/smilies/sad smiley instead of the //forums.everybodyedits.com/img/smilies/smile smiley?

I am using botbits but i'm going to be getting rid of it because it didn't do what i wanted.  I want to be able to access the file and edit as needed.  I need it for every player and it saves as they leave.  It doesn't make a difference at all what smiley they're using.

capasha wrote:

Best ways. XML, MySQL, JSON. Choose something of that.

I was thinking JSON because I've been recommended it before but I'd need someone to teach me.  Will you be my sensei? ^-^ I was also thinking of using a text file, but I'd also need help with that.

XML and JSON are simply a way of storing data in a text file.
What you are talking about could be achieved by using some of botbit's events (e.g. player joined, i don't remember the exact name) plus botbits ability to store arbitrary data associated with each player.
When a player joins, just load the file, and when they leave, save it, using your language of choice

Then just use the stored data in the player variable for what you want to do.


After approximately a long time of being idle...
I've finally found the time, energy, and inspiration to begin...
Announcing...
the long-awaited sequal..
with an actual GUI...
event-based system instead of threads...
..nope never mind out of inspiration. I'll be back in another month or two.
It's here: LuaBot 2.0! (Hopefully we fixed that missing DLL problem)

Offline

#7 2016-07-27 11:07:15

realmaster42
Formerly marcoantonimsantos
From: ̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍
Joined: 2015-02-20
Posts: 1,378
Website

Re: Storing Data

Wait what why is JSON, XML and MySQL vital? I made a bot using a .txt file for saving/loading and it works just as fine, plus its a lot simplier and easier to use.

Here is how you could read data from a player:
Add on top, on the variables:

string data;

On the Form1_Loaded add:

data = System.IO.File.ReadAllText(@Environment.CurrentDirectory + @"\data.txt")

Let's say our division from data is '/'
(plr/data/etc)
Then just add a void or anything to do this:

for (i=0; i<data.Split('\n').Length; i++)
{
   string plrLine = data.Split('\n')[i];
   for (k=0; k<plrLine.Split('/').Length; k++) // here we use the divisor
   {
        string data = plrLine.Split('/')[k];
   }
   // plrLine.Split('/')[0] would return the first item in the divisor order. plrName/etc/etc -> plrName
   // to change a value add a void with the code above, and replace data: plrLine with data: newPlrLine
}

http://i.imgur.com/bjvgH5L.png?1

Offline

#8 2016-07-27 12:48:37

capasha
Member
Joined: 2015-02-21
Posts: 3,749

Re: Storing Data

marcoantonimsantos wrote:

Wait what why is JSON, XML and MySQL vital? I made a bot using a .txt file for saving/loading and it works just as fine, plus its a lot simplier and easier to use.

Here is how you could read data from a player:
Add on top, on the variables:

string data;

On the Form1_Loaded add:

data = System.IO.File.ReadAllText(@Environment.CurrentDirectory + @"\data.txt")

Let's say our division from data is '/'
(plr/data/etc)
Then just add a void or anything to do this:

for (i=0; i<data.Split('\n').Length; i++)
{
   string plrLine = data.Split('\n')[i];
   for (k=0; k<plrLine.Split('/').Length; k++) // here we use the divisor
   {
        string data = plrLine.Split('/')[k];
   }
   // plrLine.Split('/')[0] would return the first item in the divisor order. plrName/etc/etc -> plrName
   // to change a value add a void with the code above, and replace data: plrLine with data: newPlrLine
}

This code must be the worst I have ever seen. Please use XML, JSON or MySQL.

Offline

#9 2016-07-27 14:37:53

realmaster42
Formerly marcoantonimsantos
From: ̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍̍
Joined: 2015-02-20
Posts: 1,378
Website

Re: Storing Data

capasha wrote:
marcoantonimsantos wrote:

Wait what why is JSON, XML and MySQL vital? I made a bot using a .txt file for saving/loading and it works just as fine, plus its a lot simplier and easier to use.

Here is how you could read data from a player:
Add on top, on the variables:

string data;

On the Form1_Loaded add:

data = System.IO.File.ReadAllText(@Environment.CurrentDirectory + @"\data.txt")

Let's say our division from data is '/'
(plr/data/etc)
Then just add a void or anything to do this:

for (i=0; i<data.Split('\n').Length; i++)
{
   string plrLine = data.Split('\n')[i];
   for (k=0; k<plrLine.Split('/').Length; k++) // here we use the divisor
   {
        string data = plrLine.Split('/')[k];
   }
   // plrLine.Split('/')[0] would return the first item in the divisor order. plrName/etc/etc -> plrName
   // to change a value add a void with the code above, and replace data: plrLine with data: newPlrLine
}

This code must be the worst I have ever seen. Please use XML, JSON or MySQL.

Listen, he is a newbie. He wants to learn
Let him start off easy


http://i.imgur.com/bjvgH5L.png?1

Offline

#10 2016-07-27 15:08:32

capasha
Member
Joined: 2015-02-21
Posts: 3,749

Re: Storing Data

marcoantonimsantos wrote:
capasha wrote:
marcoantonimsantos wrote:

Wait what why is JSON, XML and MySQL vital? I made a bot using a .txt file for saving/loading and it works just as fine, plus its a lot simplier and easier to use.

Here is how you could read data from a player:
Add on top, on the variables:

string data;

On the Form1_Loaded add:

data = System.IO.File.ReadAllText(@Environment.CurrentDirectory + @"\data.txt")

Let's say our division from data is '/'
(plr/data/etc)
Then just add a void or anything to do this:

for (i=0; i<data.Split('\n').Length; i++)
{
   string plrLine = data.Split('\n')[i];
   for (k=0; k<plrLine.Split('/').Length; k++) // here we use the divisor
   {
        string data = plrLine.Split('/')[k];
   }
   // plrLine.Split('/')[0] would return the first item in the divisor order. plrName/etc/etc -> plrName
   // to change a value add a void with the code above, and replace data: plrLine with data: newPlrLine
}

This code must be the worst I have ever seen. Please use XML, JSON or MySQL.

Listen, he is a newbie. He wants to learn
Let him start off easy

He want someone to "learn" him to code things. If he can't even use a document, then it's really bad.
And I don't think this thread is only for EE. It's for saving data. Which can be found in reading a book about C# or reading tutorials on internet.

And there is some different ways to store data:

Text File
Binary File
INI File
XML
JSON
MySQL Database

I guess it exist even more ways to store data.

Offline

Wooted by:

#11 2016-07-27 15:13:07

Koya
Fabulous Design Team
From: The island with those Brits
Joined: 2015-02-18
Posts: 6,287

Re: Storing Data

I completely outlined how to save data as JSON and XML with examples you can download and full source : http://forums.everybodyedits.com/viewto … 06#p607706

It is modeled after saving a listbox to file but ignore the listbox stuff and just put data into a class and do the saving and loading.

Last edited by Koya (2016-07-27 15:15:20)


Po9cnQh.png

PLNQVL8.png
Thank you eleizibeth ^

1SYOldu.png

I stack my signatures rather than delete them so I don't lose them
giphy.gif

WfSi4mm.png

Offline

Koya1469628787614548

Board footer

Powered by FluxBB

[ Started around 1560631360.3822 - Generated in 0.049 seconds, 10 queries executed - Memory usage: 1.46 MiB (Peak: 1.64 MiB) ]