ID:2332476
 
Code:turf/START
icon = 'start.dmi'
Click()
usr.Newchar()
usr.loc = locate(58,7,20)
var/name = input("","Name") as text|null
if(length(name) < 2)
alert("Your name can not be less than two letters!")
return
if(length(name) > 20)
alert("Your name can not be longer than 20 letters!")
return
usr.name="[html_encode(name)]"

mob
proc
Newchar()
usr.name = input("What do you want your name to be") as text
usr.name="[usr.name]"


Problem description:Im making a map and i dont understand what im doing wrong, every time i put my png title then start.dmi to overlay the start on the png it wont work

</2>
You should put your code inside of the DM tags so that we can make sure your indentation is correct.

You need to tell input() to send the input to the proper thing. It will default to src, which is the turf. Send it to usr by supplying usr as the first argument in the input() procedure.

The same goes for the alert() calls.


Aside from that, it looks like you're doing the same thing twice. Your Newchar() proc asks the usr (this should be src) for its name. You don't need to do usr.name="[usr.name]", that's redundant.

If this code actually worked, you would be asked what your name is twice because you're calling Newchar() and then sending another name input and setting the name again.
turf/START
icon = 'start.dmi'
Click()
usr.Newchar()
usr.loc = locate(58,7,20)
var/name = input("","Name") as text|null
if(length(name) < 2)
alert("Your name can not be less than two letters!")
return
if(length(name) > 20)
alert("Your name can not be longer than 20 letters!")
return
usr.name="[html_encode(name)]"
mob
proc
Newchar()
usr.name = input("What do you want your name to be") as text
usr.name="[usr.name]"


This is it right?
In response to Zanoroku
input(usr,"text","title") as text|null

Since this is inside a Click() proc, the usr will be the mob calling the Click() proc, which would be the mob associated to the player.
In response to Albro1
input() and alert() default to usr. Check the docs.

Personally, I always pass the target argument explicitly anyway, and avoid using usr as much as possible. In verbs like Click(), I would get into a proc with proper arguments instead.