Page 1 of 2

problem with game views (starts on page 2)

Posted: Sun Sep 08, 2013 8:26 pm
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

Re: Help With SaveData

Posted: Sun Sep 08, 2013 8:40 pm
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

Re: Help With SaveData

Posted: Sun Sep 08, 2013 8:43 pm
by Vandie
sure

Re: Help With SaveData

Posted: Sun Sep 08, 2013 10:22 pm
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

Re: Help With SaveData

Posted: Mon Sep 09, 2013 9:48 am
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

Re: Help With SaveData

Posted: Mon Sep 09, 2013 3:37 pm
by Vandie
if i change the amount to save money as it will not update it

Re: Help With SaveData

Posted: Mon Sep 09, 2013 4:23 pm
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.

Re: Help With SaveData

Posted: Mon Sep 09, 2013 4:54 pm
by Vandie
yes i do but on this updated version

Re: Help With SaveData

Posted: Mon Sep 09, 2013 5:31 pm
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.

Re: Help With SaveData

Posted: Mon Sep 09, 2013 6:40 pm
by Vandie
thanks a ton robin :ultraglee:
it worked !