Is there an Example you would like to see?

revolv
Posts: 1
Joined: Fri May 15, 2015 10:05 am

Re: Is there an Example you would like to see?

Post by revolv »

Saving data in Playmaker to cloud. And how this looks like?
All players use the same .txt file from cloud? i dont know how this works. i must generate for all players unique id or what?

Thanks.

User avatar
Joel
Moodkie Staff
Posts: 3041
Joined: Wed Nov 07, 2012 10:32 pm

Re: Is there an Example you would like to see?

Post by Joel »

revolv wrote:Saving data in Playmaker to cloud. And how this looks like?
All players use the same .txt file from cloud? i dont know how this works. i must generate for all players unique id or what?
Hi there,

An example of saving to web using Playmaker can be found here.

If you want to link data to each user instead of it being global, you should assign them a unique ID (usually a username) and either append it to the Tag or Web Filename field when saving and loading.

All the best,
Joel

gozda
Posts: 43
Joined: Wed Jun 24, 2015 3:14 pm

Re: Is there an Example you would like to see?

Post by gozda »

Saving in web.

Create an video tutorial step by step, how to setup MySQL database using the supplied ES2SQL.sql file in example scene.
"Saving and Loading from Web" tutorial is very dificult for me. Maybe you can create tutorial starting from beginning create an account in some free Sql hosting, modify web files, upload the files, and send simple message to this sql base.
And if its possible create this in Playmaker.
I think i want too much:)

Cheers

User avatar
Joel
Moodkie Staff
Posts: 3041
Joined: Wed Nov 07, 2012 10:32 pm

Re: Is there an Example you would like to see?

Post by Joel »

Hi there,

We don't currently have the facilities to do video tutorials, but maybe sometime in the future if there's enough demand.

With regards to Saving to Web; for help setting up the MySQL and PHP part you should contact your web hosting provider, as it really is dependent on them (link them to our Saving and Loading from Web guide if necessary). Our guide shows screenshots of what to do in PHPMyAdmin, which is supported by most hosting providers.

With regards to Saving and Loading from Web in Playmaker, there's an Example with a sample file here which should help with setting it up in Playmaker.

All the best,
Joel

wethecom
Posts: 12
Joined: Sun Aug 16, 2015 7:39 pm

Re: Is there an Example you would like to see?

Post by wethecom »

I would like to see an example of saving a float
i would like to see an example of saving a position
i see many examples of doing more difficult things but i need just some simple things

User avatar
Joel
Moodkie Staff
Posts: 3041
Joined: Wed Nov 07, 2012 10:32 pm

Re: Is there an Example you would like to see?

Post by Joel »

Hi there,

There's an example of saving a position on the ES2.Save documentation page, and you can save a float in the same way. I've pasted an example of each below:
// Save a float and then load it.
float myFloat = 123.45f;
ES2.Save(myFloat, "myFloat"); // Save it.
myFloat = ES2.Load<float>("myFloat"); // Load it.
// Save the position of this GameObject.
ES2.Save(transform.position, "myPosition");
// Load the position we saved and assign it to this GameObject.
transform.position = ES2.Load<Vector3>("myPosition");
For examples of more advanced features (for example, tags, which allow you to save multiple pieces of data to a file), see our Guides.

All the best,
Joel

wethecom
Posts: 12
Joined: Sun Aug 16, 2015 7:39 pm

Re: Is there an Example you would like to see?

Post by wethecom »

im sorry i miss spoke i meant from the web
ive used the web successfully for other operations but a simple position or float seems to elude me i tried reverse engineering the code but to no avail

User avatar
Joel
Moodkie Staff
Posts: 3041
Joined: Wed Nov 07, 2012 10:32 pm

Re: Is there an Example you would like to see?

Post by Joel »

With regards to saving to web, generally the examples on this page work the same way with all types. However, I've written an example for you below which specifically uploads the position of an object.

A method which uploads a position:
public IEnumerator UploadPosition()
{
    // Create a URL and add parameters to the end of it.
    string myURL = "http://www.server.com/ES2.php";
    myURL += "?webusername=user&webpassword=pass";
 
    // Create our ES2Web object and give the data a unique tag.
    ES2Web web = new ES2Web(myURL + "&tag=myPosition");
      
    // Start uploading our position and wait for it to finish.
    yield return StartCoroutine(web.Upload(transform.position));
      
    if(web.isError)
    {
        // Enter your own code to handle errors here.
        Debug.LogError(web.errorCode + ":" + web.error);
    }
}
A method which downloads a position:
public IEnumerator DownloadPosition()
{
    // Create a URL and add parameters to the end of it.
    string myURL = "http://www.server.com/ES2.php";
    myURL += "?webusername=user&webpassword=pass";
 
    // Create our ES2Web object.
    ES2Web web = new ES2Web(myURL + "&tag=myPosition");
      
    // Start downloading our data and wait for it to finish.
    yield return StartCoroutine(web.Download());
      
    if(web.isError)
    {
        // Enter your own code to handle errors here.
        Debug.LogError(web.errorCode + ":" + web.error);
    }
    else
    {
        // Or we could just load directly from the ES2Web object.
        transform.position = web.Load<Vector3>("myPosition");
    }
}
Note that this example uses tags, which are used to uniquely identify a piece of data (like a key), and are explained here.

All the best,
Joel

wethecom
Posts: 12
Joined: Sun Aug 16, 2015 7:39 pm

Re: Is there an Example you would like to see?

Post by wethecom »

ahhh the tags i was wondering how to make them unique
i see the pattern now ...i think i got this thanks

Post Reply