world
mob = /mob/player
makes everyone who logs in the default mob
but if they have a save file it makes their mob that mob anyway even if they've switched bodies, how can I make it check for a save file first?
I tried this
world
if(fexists("[src.key]")==0)
mob = /mob/player
but it gives me 3 errors if bad or missplaced statement
src.key undefined var
bad or missplaced statement
I'm not sure how I should check for the save file. The files are being saved as the users key.
ID:155202
![]() Aug 20 2011, 10:35 am
|
|
if(fexists("Players/[ckey].sav")) If that file exists, create a new instance of it in the variable F, and load it's X,Y,Z and whatever else you want it to load just put F >> make sure when loading you use >> and when writing use << |
No, I want to test for a savefile to decide which mob is the default mob, if the player has a savefile then it should load from their file instead of loading the default mob for them.
for example, when I switch bodies, and log off it should load the mob body that I switched to instead of the default mob mob = /mob/player how can I have the game check if they player already has a save file? Is it possible? Oh and I have my files saving as the users ckey without any extension so I don't need to put .sav, but when I change it to ckey it still gives me the same errors. |
mob/var There's my explanation, but I haven't coded in a long, long time so there may be a few flaws. Also, this might help: http://www.byond.com/developer/Lugia319/ChangeMobDemo |
Instead of src.key you should just have src.ckey. "ckey" is the key turned into canonical form. And also, I'm pretty certain that it is mandatory to add .sav after the name of the file.
Another helpful tip is that you put these .sav files into a folder, such as Player Saves by just adding "Player Saves/" before "[src.ckey]" in total, making it "Player Saves/[src.ckey].sav" to avoid a cluster of files in your main folder!
And to get to the point, you shouldn't be calling
in world, but rather in Login()
I hope I've helped and if you see that I am incorrect, please let me know :) I would love to enlighten my knowledge! :D