problem with game views (starts on page 2)

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
Vandie
Prole
Posts: 12
Joined: Sun Sep 08, 2013 8:22 pm

problem with game views (starts on page 2)

Post by Vandie »

Im Having a problem with my save database.

Code: Select all

   --save data
    gamefile = love.filesystem.isDirectory ('CriminalData' )
    if gamefile then
        else love.filesystem.mkdir( 'CriminalData' )
    end
    
    tempsavedata = {
    roomnum = 1,
    lightnum = 1,
    tablenum = 1,
    monitornum = 1,
    casenum = 1,
    player = 1,
    money = 250
    }
    
    lastsave = 0
    savetimer = 0
    view = 1
    displaytitle = true
    
    if love.filesystem.isFile('save.txt') then
        loadSave()
    else
        initialsave()
        loadSave()
    end
it saves everything exept the money variable ... i am thankfull for any help
Last edited by Vandie on Mon Sep 09, 2013 8:59 pm, edited 1 time in total.

Code: Select all

Dear Math, please grow up and solve your own problems, I'm tired of solving them for you...
Quote my 9 year old brother...

Code: Select all

How can you make sure you never miss your target? Shoot first, and whatever you hit, call it the target.
Quote My dad...
User avatar
Plu
Inner party member
Posts: 722
Joined: Fri Mar 15, 2013 9:36 pm

Re: Help With SaveData

Post by Plu »

Can you post a full .love file?

See here if you don't know how: http://love2d.org/forums/viewtopic.php?f=4&t=451
User avatar
Vandie
Prole
Posts: 12
Joined: Sun Sep 08, 2013 8:22 pm

Re: Help With SaveData

Post by Vandie »

sure
Last edited by Vandie on Mon Sep 09, 2013 4:53 pm, edited 1 time in total.

Code: Select all

Dear Math, please grow up and solve your own problems, I'm tired of solving them for you...
Quote my 9 year old brother...

Code: Select all

How can you make sure you never miss your target? Shoot first, and whatever you hit, call it the target.
Quote My dad...
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Help With SaveData

Post by Robin »

Other than the fact that you save every frame(!) due to a bug in love.update*, it seems to load the money thing just fine. Can you be more specific about the problem you're having and how to reproduce it (basically what steps I need to take to see the problem in action)?

*This:

Code: Select all

    if savetimer > (lastsave + 60) then
        --do fuck all
    else
        save()
        lastsave = savetimer
    end
should be:

Code: Select all

    if savetimer > (lastsave + 60) then
        save()
        lastsave = savetimer
    end
Help us help you: attach a .love.
User avatar
Vandie
Prole
Posts: 12
Joined: Sun Sep 08, 2013 8:22 pm

Re: Help With SaveData

Post by Vandie »

thanks ill try it out wwhen i get back from school :awesome:
if it dosent fix the problem ill see if i can explain how to reproduce the problem

Code: Select all

Dear Math, please grow up and solve your own problems, I'm tired of solving them for you...
Quote my 9 year old brother...

Code: Select all

How can you make sure you never miss your target? Shoot first, and whatever you hit, call it the target.
Quote My dad...
User avatar
Vandie
Prole
Posts: 12
Joined: Sun Sep 08, 2013 8:22 pm

Re: Help With SaveData

Post by Vandie »

if i change the amount to save money as it will not update it

Code: Select all

Dear Math, please grow up and solve your own problems, I'm tired of solving them for you...
Quote my 9 year old brother...

Code: Select all

How can you make sure you never miss your target? Shoot first, and whatever you hit, call it the target.
Quote My dad...
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Help With SaveData

Post by Robin »

Vandie wrote:if i change the amount to save money as it will not update it
You mean you change tempsavedata? Because that is ignored if save.txt already exists.
Help us help you: attach a .love.
User avatar
Vandie
Prole
Posts: 12
Joined: Sun Sep 08, 2013 8:22 pm

Re: Help With SaveData

Post by Vandie »

yes i do but on this updated version

Code: Select all

Dear Math, please grow up and solve your own problems, I'm tired of solving them for you...
Quote my 9 year old brother...

Code: Select all

How can you make sure you never miss your target? Shoot first, and whatever you hit, call it the target.
Quote My dad...
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Help With SaveData

Post by Robin »

You deleted the line

Code: Select all

savetimer = savetimer + dt
which means it never saves.

Your construction with SaveData/tempsavedata is really weird, but it should work fine otherwise.
Help us help you: attach a .love.
User avatar
Vandie
Prole
Posts: 12
Joined: Sun Sep 08, 2013 8:22 pm

Re: Help With SaveData

Post by Vandie »

thanks a ton robin :ultraglee:
it worked !

Code: Select all

Dear Math, please grow up and solve your own problems, I'm tired of solving them for you...
Quote my 9 year old brother...

Code: Select all

How can you make sure you never miss your target? Shoot first, and whatever you hit, call it the target.
Quote My dad...
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 75 guests