Really sorry save and load issue

nakki1718nakki1718 Member Posts: 25
edited May 2012 in Working with GS (Mac)
Hi, been struggling with this for ages, have watched the videos and read other peoples problems on the forum, I'm still stuck. I've put the save attribute on the scene so that when button is pressed it should save (game.scene). So far i have 5 scenes and on the main menu i have a resume button into which i have put the load attribute so when touch is pressed load game.scene. The resume button doesn't do anything when i tested it on AdHoc. Any help would be great as I'm pulling my hair out :) thank you.

Best Answers

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,922
    Accepted Answer
    Make sure the load is at the top of the code in the button and set a short timer like .5sec before it changes scene.
  • stackpoolestackpoole Melbourne, Victoria, AustraliaPosts: 473
    edited May 2012 Accepted Answer
    No need to be sorry :D

    If it is the Save and Load not working

    MAKE SURE

    you don't use the "e" when typing in the key
    i.e. make sure the expression editor does not come out when typing in the key..



    hope this helped

    Sydney Swans 2014!!

  • jonmulcahyjonmulcahy Posts: 10,408
    Accepted Answer
    It's case sensitive so make sure that is the same.

    Can you post a screenshot of your code?
  • jckmcgrawjckmcgraw Posts: 647
    edited May 2012 Accepted Answer
    @nakki1718

    Take a look at this video.



    Jack McGraw
  • tatiangtatiang Posts: 11,949
    edited May 2012 Accepted Answer
    @nakki1718 As much as it would be awesome to be able to simply save the current scene and load it again, you can't actually do that by just saving game.scene (integer) and then loading it. GameSalad doesn't know what to do with that attribute because it just thinks of it as a regular old integer. It could just as well be game.coins or game.score. Naming it "scene" doesn't make it a scene.

    The only way to save and load the current scene is to save an integer (or index) value to a key -- as you've done -- and then when you load the scene value, to have a rule that says When attribute game.scene=1 --> Change Scene [Level 1]; Otherwise When attribute game.scene=2 --> Change Scene [Level 2]; Otherwise ... etc.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Answers

  • nakki1718nakki1718 Member Posts: 25
    Do i need to do it within a rule e.g when touch is pressed?
  • nakki1718nakki1718 Member Posts: 25
    @brendanzh926 lol i know this is an issue for a lot of us newbies. I made sure the expression editor isn't coming up but still cant get it to work. Thank you
  • nakki1718nakki1718 Member Posts: 25
    @jnmlchay hi, what i have is the save attribute on the continue button but the continue button is a spawned actor, would that make a difference? Then the Load attribute is on the resume button on the home screen and that button is doing nothing when touched....Could it be the attribute game.scene attribute is wrong.....wow lol this is frustrating @-). Ok i guess screen shots of the attributes would be what you need to see?
    Thanks.
  • nakki1718nakki1718 Member Posts: 25
    Hi, still struggling with this just wondered if anyone would have a look at this for me please??

    Thank you!!
  • nakki1718nakki1718 Member Posts: 25
    Hi, thank you i have already watched this. I don't know what I'm doing wrong its so frustrating!! Thank you for all your answers tho.
  • jckmcgrawjckmcgraw Member Posts: 647
    @nakki1718

    Upload your file and put a link so we can have a look at what you are doing wrong.
  • nakki1718nakki1718 Member Posts: 25
    @tatiang guess it was wishful thinking it would be simple for someone like me who has the ideas and is just trying their hand at it :)

    It makes complete sense in theory in my mind what you have said I need to do and I get the load part I think, but the save part is still confusing me - no excuse but young baby in the house and no sleep for days isn't helping lol. If you have a minute can you show an example of the save/ load on the project i linked over to you? From that I can physically see what to do then implement throughout the whole game? Then this save load will stop being a nightmare.

    Thank you again
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I would rename game.scene to game.level since you're actually saving the level number, not the scene number. And naming a save key "save" isn't generally a good idea. I would change it to "level" so that it matches the attribute name.

    And you need a way to increase the level attribute each time you advance. I added this to the Continue actor.

    I sent you a PM with the link to the updated file.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    From what I've come across, and I don't know why, but my actor won't load anything if it has more than 10 rules in it. I create a separate actor for all load attributes.

    Hope this helps,
    Bray
  • nakki1718nakki1718 Member Posts: 25
    @Braydon_SFX thank you i will keep that in mind as i progress.

    Thanks everyone for your help! :D
Sign In or Register to comment.