ID:145140
 
Code:
mob//mobile
proc//process
save()//name the proc
src.movement = 0
var/savefile/F =new()//make a var for the savefile
F["last_x"] << x//Save the X loc
F["last_y"] << y//Save the Y loc
F["last_z"] << z//Save the Z loc
// F["usr"] << src//Save your items and all vars
F["usr"] << Encode_Save(src)
// F["paz"] << Get_Pass(src,F)
src.client.Export(F)//Export it to its save file loc with is in the byond Key Info
src<<"\red <b><font size=1>Saving..."//tell them its been saved
sleep(20)
src<<"<b><font color=red><font size=1>Done!"
src.movement = 1



proc
Encode_Save(var/savefile/S, var/pass, var/Key, var/Save)
if(!S) return
if(pass)
if(!Key || !Save)
world.log << "Encode failed! insuficient arguments"
return
var/cipher = RC5_Encrypt(S.ExportText("/"), pass)
if(cipher)
fdel("./saves/players/[first_char(Key)]/[Key]/[Save]")
del(S)
S = new("./saves/players/[first_char(Key)]/[Key]/[Save]")
S << cipher
else world.log << "Encode failed! no cipher"
else world.log << "Encode failed! no pass"


Problem description:

I am getting the error, no pass. I havnt really experimented with encryption and stuff, but can anyone tell me whats wrong?
this might help with the "no pass" problem...
proc
first_char(T){if(T&&istext(T)&&length(T)).=copytext(T,1,min(length(T),2))}

Get_Pass(var/Key, var/Save)
var/pass = ckey("some [Key] random [Save] text")
var/list/chars = text2list(pass)
var/list/new_chars = new()
var/span = round(chars.len/10)
for(var/i = 1, i <= chars.len, i+=span)
new_chars.Add(chars[i])
pass = list2text(new_chars)
return pass
In response to Drakiel
Dude, if you want the a specific character you are over complicating it.

proc/copy_ch(text, position) 
return copytext(text, position, position+1)