world
New()
..()
world.log = file("Debug.txt")
spawn(200)
AutoRepop()
XD
spawn(200)
for(var/mob/Enemy/M in world)
if(M.AItime > 0)
M.AItime -= 20
spawn(200)
for(var/mob/player/M in world)
if(M.key)
M.Save()
goto XD
if(BerryC == 1)
return
mob
proc
Save()
if(src.CANSAVE == 1)
return
fdel("savefile/[src.ckey].sav") // deletes the old save file
var/savefile/F=new("savefile/[src.ckey].sav") // creates a new save file
src.Write(F) // writes your variables/lists onto it
F["lastx"] << src.x //saves your x coord
F["lasty"] << src.y //saves your y coord
F["lastz"] << src.z //saves your z coord
Load()
if(fexists("savefile/[src.ckey].sav"))//if an existing save file exists in the folder located in the game folder
var/savefile/F=new("savefile/[src.ckey].sav") // it creates a new save file
src.Read(F) //it reads it
var/newX
var/newY
var/newZ
F["lastx"] >> newX//it takes the lastx variable in the save and puts it into the newx variable
F["lasty"] >> newY//same as above with a new variable
F["lastz"] >> newZ//same as above with a new variable
src.loc=locate(newX,newY,newZ)//makes the player located in those locations
src.rest = 0
new/obj/hudMeters/hpbar(src.client)
src.updateHealth()
if(src.Spatt1 >= 1)
src.Spatt = src.Spatt1
src.Spatt1 = 0
if(src.Spdef1 >= 1)
src.Spdef = src.Spdef1
src.Spdef1 = 0
Problem description: I have no idea why but at random times the save files will be corrupted, whenever load is pressed it takes you to a black area and you can't do anything there, I'm not sure what's wrong, any help would be appreciated ^^;
And yes I know I'm lame for using goto, idk no better lol
Would this still give the desired result?
If I understand BYOND indents properly, this should loop what used to be inside the goto statement indefinitely (I think that's what you meant to do?), as 1 will always have a value of true. If the indents don't work like that with while loops (I've only tried for loops so far), I think encasing it in a block (uses braces { } around everything in the loop) will still work.
If you did want to loop it definitely, then you might want to move the BerryC check thing you have up a bit, otherwise it'll never be reached (as the loop will go on forever). I'm not sure what it's purpose is though from just this bit of code. I looked at it from purely trying to translate your code from a goto statement to a loop - so be warned if the actual implementation isn't what you wanted. You might have to edit a little bit.
If someone else comes along and corrects me then take their word; they probably have more experience in BYOND than I.