ID:169722
 
How will i go about doing auto-saving every 5-10 mins? I do realise there is no "the code" for it since i can be done more than 1 way :)
Put this with your world vars
world
New()
..()
spawn(10) src.Loop()

proc
Loop()
while(src)
sleep(5000) // Change this to the right time acourding to ticks
for(var/mob/Player/M in world)
M.Save

I assume this will work.
In response to ITG Master
ITG Master wrote:
Put this with your world vars
> world
> New()
> ..()
> spawn(10) src.Loop()
>
> proc
> Loop()
> while(src)
> sleep(5000) // Change this to the right time acourding to ticks
> for(var/mob/Player/M in world)
> M.Save
>

I assume this will work.


Wrong, you can't do a proc under world.
world
New()
..()
save()
proc
save()
while(1)
sleep(600*5) //Replace the 5 with how many minutes you want
for(var/mob/m in world)
if(!m.client)continue
m.save()


Of course, that works if you didn't make /mob/player typepath or a players list.
In response to Hell Ramen
Hell Ramen wrote:
Wrong, you can't do a proc under world.

Which is unfortunate and hopefully remedied in the future. Anything and everything should be modifiable. I do believe we have suggested this at least once.
In response to Loduwijk
Thanks all but

How come do i get these errors

autosave.dm:8: Inconsistent indentation.
autosave.dm:9: Inconsistent indentation.
autosave.dm:10: Inconsistent indentation.
autosave.dm:11: Inconsistent indentation.

This is what i have on lines 8 via to 11

      sleep(3000) //Replace the 5 with how many minutes you want
for(var/mob/m in world)
if(!m.client)continue
m.save()
In response to Govegtos
Don't copy and paste code from the forums. It's messes up the indentation for some reason. Delete those spaces and tab it correctly.
In response to Mega fart cannon
Mega fart cannon wrote:
Don't copy and paste code from the forums. It's messes up the indentation for some reason. Delete those spaces and tab it correctly.

Thanks its fixed now
mob/proc/Tick()
usr << "(put ur color code here)(-Auto Save-)"
usr.client.base_SaveMob()
spawn(3000) usr.Tick()

i think u might have to have dedrons char handling to use this auto save code and if u use it plese give me credit
In response to Shadow_Entertainmnet
Shadow_Entertainmnet wrote:
mob/proc/Tick()
usr << "(put ur color code here)(-Auto Save-)"
usr.client.base_SaveMob()
spawn(3000) usr.Tick()

i think u might have to have dedrons char handling to use this auto save code and if u use it plese give me credit

If he uses that, it won't really work, it'll be buggy.
*cough*usr*cough*
Plus it's better to loop through every mob, I think.
In response to Hell Ramen
Ive created my own but i am not too sure since i get this error

autosave.dm:11:error:m.save:undefined var

    m.save()


How can i fix this?
In response to Govegtos
By using a var that exists instead of m, which quite plainly does not exist. Hence the error.
In response to Govegtos
Govegtos wrote:
Ive created my own but i am not too sure since i get this error

autosave.dm:11:error:m.save:undefined var

>     m.save()
>
>

How can i fix this?

is supposed to be capitalized.

O-matic