ID:1302910
 
(See the best response by Neimo.)
Saving Code

Code:
client
proc
Save()
if(!src)return
if(!src.mob)return

var/savefile/save
save = new ("Player Saves/[mob.ckey]/[mob.savednames].sav")
save["mob"] << src.mob
save["x"] << src.mob.x
save["y"] << src.mob.y
save["z"] << src.mob.z


Turf Load (unfinished trying to get the list to work)

turf/Load
icon = 'Load.dmi'
density = 1
Click()
if(usr.clickspam)
return
if(fexists("Player Saves/[usr.client.ckey]/"))
var/list/char_list = usr.Shorten_Names()
var/list/Options = "Cancel"
var/list/Lines = "- - - - - - - - - - - -"
var/choice = input ("Welcome to [world.name]! What would you like to do?\n\nTo go back, hit cancel. \
"
,"Login")as null|anything in char_list|Options


Part of the code that I am having trouble with.

mob/proc/Shorten_Names()
var/list/names = flist("Player Saves/[usr.client.ckey]/")
var/list/display_names = list()
for(var/n in names)
if(copytext(n,1,20)==".sav")
n-=".sav"
display_names.Add(n)
return display_names


Problem description:Before adding the if(copytext) block, the list when i would click on the Load turf would load as "Chiwy8.sav" and all would be fine. However I am trying to make the ".sav" go away so that it only shows "Chiwy8". I am really not familiar (or have ever practiced really) with text strings. I've turned to the DM guide to read about it as well as several references and that is what made the most sense to me (again, i suck at text strings). What can I do to make that work? >.<

Right now, the way I have that ^, nothing shows up on the list except for the "Cancel" button.

All help is much appreciated.

Look up some text re-placers in the library section, a lot of the "Text" utility libraries feature these.

http://www.byond.com/developer/?text=text&sort=pop
Best response
var/string = "kvaokgea.sav"
var/i = findtext(string, ".sav")
world << copytext(string, 1, i)
Well the Text libraries were included in my "several references" that I noted. I just had trouble even understanding them. But I'll make sure to keep going back there in the future and attempt to learn more about them since I'll probably be using it more often lol.

Thanks Neimo, that makes a lot more sense to me at least. Used a similar method inside the proc and it worked. Thanks!