ID:901507
 
(See the best response by Makeii.)
Code:
turf/newchar
density = 1
layer = 999
Click()



mob/Guest
Login()
src.loc = locate(9,9,1)

if(src.Click(/turf/newchar))
if(fexists("players/[src.key]"))
switch(alert(usr, "Are you sure that you want to overwrite your old Character?", "Character Creation", "Yes","No"))
if("Yes")
sleep(0)
fdel("players/[usr.key].sav")
if("No")
return


Problem description: Alright, My problem is pretty simple: I can't seem to make the player click on the newchar turf and for the switch alert to appear. I'm guessing the problem would be in the "Click", but I can't find a way to fix it. Any help will be much appreciated. Thank you!




By the way, the Click() under the actual turf code is just some stuff I was testing out.

Put the switch() and the rest of the command INTO the Click().

Not sure what exactly if(src.Click()) is supposed to do.
Well, I just made my life easier and dragged the whole code under src.loc = locate(9,9,1) under the Click in turf/Newchar.
The new char needs a icon or mouse_opacity = 2 under the turf code.
Just outta curiosity, what is the practicality of layer = 999? I don't understand how you could have so many objects in between that you'd want to cover them all with this one turf.
I dont really know myself. Lol. I already changed the layer to anmouse opacoty. The icon is is also now defined there too.
Best response
turf/newchar
density = FALSE
layer = FLY_LAYER
Click()
if (istype(usr,/mob/Guest))
switch(alert(usr, "Are you sure that you want to overwrite your old Character?", "Character Creation", "Yes","No"))
if("Yes")
fdel("players/[usr.key].sav")
if("No")
return

mob/Guest
Login()
src.loc = locate(9,9,1)
Hm..That looks very similar to the one i wrote. But alas, yours is better. Ill look in the reference section to learn more about the FLY_LAYER. Thanks!
FLY_LAYER is just the topmost layer DM uses (or at least the topmost constant value). Usually FLY_LAYEr is used for effects and HUD stuff.

You can of course define your own layer constants and have a layer of any integer you'd like.
I see! Thanks Makeii!