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.
http://www.byond.com/developer/?text=text&sort=pop