Saving/md5 Problem: Saves Strings, Not Numbers & More. in Developer Help
|
|
Code:
mob verb Save() usr.Savinit() proc Savinit() if(usr.chooseslot1) var/savefile/F = new("[usr]1.sav") Write(F) if(usr.chooseslot2) var/savefile/F = new("[usr]2.sav") Write(F) if(usr.chooseslot3) var/savefile/F = new("[usr]3.sav") Write(F) Loadinit() if(fexists("[usr]1.sav")) var/savefile/F = new("[usr]1.sav") Read(F) return mob Write(var/savefile/F) var/thehash=md5("[style][moves][trainingmove][rank][fightmove1][fightmove2][fightmove3][fightmove4][attributemove][healthexp][healthexpmax][legdefexp][bodydefexp][headdefexp]") F["thehash"]<<thehash ..()
Read(var/savefile/F) var/style var/list/moves var/trainingmove var/rank var/belttesting var/fightmove1 var/fightmove2 var/fightmove3 var/fightmove4 var/attributemove var/healthexp var/healthexpmax var/legdefexp var/bodydefexp var/headdefexp var/Hash1 F["style"] >> style F["moves"] >> moves F["trainingmove"] >> trainingmove F["rank"] >> rank F["belttesting"] >> belttesting F["fightmove1"] >> fightmove1 F["fightmove2"] >> fightmove2 F["fightmove3"] >> fightmove3 F["fightmove4"] >> fightmove4 F["attributemove"] >> attributemove F["healthexp"] >> healthexp F["healthexpmax"] >> healthexpmax F["legdefexp"] >> legdefexp F["bodydefexp"] >> bodydefexp F["headdefexp"] >> headdefexp F["thehash"] >> Hash1 if(md5("[style][moves][trainingmove][rank][fightmove1][fightmove2][fightmove3][fightmove4][attributemove][healthexp][healthexpmax][legdefexp][bodydefexp][headdefexp]") != Hash1) del(src) else ..()
|
Problem description:
Well I'm messing around with md5 and stuff, I've double checked and am sure both hashes should be the same, but when I have them outputted, they come up different. Basically, even if I didn't cheat I get kicked off the game and I don't know why. I've found out that it's saving strings, but not numbers. I can output my style and get "Taekwondo" but when I output my healthexp I get nothing. Just blank. Null. Anyone know the problem?
I also get this error:
runtime error: Undefined operation: null / null
proc name: Stat (/mob/Stat)
source file: Stat.dm,12
usr: Ganing (/mob)
src: Ganing (/mob)
call stack:
Ganing (/mob): Stat()
Stat.dm 12 is this: var/percen1=usr.healthexp/usr.healthexpmax*100
|
When saving I have:
Taekwondo/listWhite Belt010000
When loading it becomes:
Taekwondo/listWhite Belt
But why... >.>