ID:145515
 
Code:
turf
var/savefile/F = new(ckey) //both errors here
L
icon = 'Start.dmi'
icon_state = "L"
Click()
Read(F)
return ..()
O
icon = 'Start.dmi'
icon_state = "O"
Click()
Read(F)
return ..()
A
icon = 'Start.dmi'
icon_state = "A"
Click()
Read(F)
return ..()
D
icon = 'Start.dmi'
icon_state = "D"
Click()
Read(F)
return ..()

mob/Logout()
var/savefile/F = new(ckey)
Write(F)
del(src)

mob/Write(savefile/F)
F << x
F << y
F << z
..()
mob/Read(savefile/F)
var {saved_x; saved_y; saved_z}
F >> saved_x
F >> saved_y
F >> saved_z
..()
Move(locate(saved_x,saved_y,saved_z))


Problem description:

Never Ending Tournament.dm:37:new :warning: This appears like the old syntax for new(). The type is now passed like this: new Type(args). You can leave out the type if assigning a variable of the same type.


Never Ending Tournament.dm:37:error:ckey:undefined var
Do turfs have keys?
Only clients do. :P
So you can't use ckey with turfs.
In response to Mechanios
that still doesnt help me much... forgive me for being an idiot.

turf
L
icon = 'Start.dmi'
icon_state = "L"
Click()
var/savefile/F = new(usr.ckey)
Read(F)
return ..()

Repeat for every letter. We use Click() because the src is the usr, easy, no?
In response to Mechanios
yeah thats kinda what paul told me to do ....
CYN wrote:
Code:
turf
L
icon = 'Start.dmi'
icon_state = "L"
Click()
Read(F)
return ..()
O
icon = 'Start.dmi'
icon_state = "O"
Click()
Read(F)
return ..()
A
icon = 'Start.dmi'
icon_state = "A"
Click()
Read(F)
return ..()
D
icon = 'Start.dmi'
icon_state = "D"
Click()
Read(F)
return ..()


Ugh. Why in the world would you repeat identical code for every subtype that you can simply include in the main type? That is, icon='Start.dmi' and the Click() proc should both be defined under a type like /turf/load, and if you needed individual types like /turf/load/L, /turf/load/O, etc. (which you don't), you could always just change the icon_state, like so:

turf/load
icon = 'Start.dmi'
Click()
Read(F)
return ..()

L/icon_state = "L"
O/icon_state = "O"
A/icon_state = "A"
D/icon_state = "D"

This is of course still wrong. There is no defensible reason for having the separate L, O, A, D types when you can simply use New() to initialize this correctly, or just set icon_state for each turf on the map itself. If using New() you'd be using an obj, which is much more common with interfaces.

obj/load
New(newloc, letter)
icon_state = letter

icon = 'Start.dmi'
Click()
Read(F)
return ..()

Lummox JR