ID:146201
 
Code:
turf
login
Click()
src.CreateCharacter()


mob/creating_character
base_save_allowed = 0 // If player quits before choosing, don't want to save this mob.

Login()
usr.loc=locate(7,7,2)
//spawn()
//src.CreateCharacter()



proc/CreateCharacter()
// In this case, the code creates a /mob/human or /mob/ogre with the specified attributes.

// Get the character information from them. (You would probably want to do with this a browser page.)
var/prompt_title = "New Character"
var/help_text = "What do you want to name the character?"
var/default_value = key
var/char_name = input(src, help_text, prompt_title, default_value) as null|text

if (!char_name)
// Guess they don't want to create a new character after all, so send them to choose a character.
client.base_ChooseCharacter()
return

// Make sure there isn't already a character named that.
// Character names are stored as ckey, so get the ckey version of the name.
var/ckey_name = ckey(char_name)
var/list/characters = client.base_CharacterNames()
if (characters.Find(ckey_name))
alert("You already have a character named that! Please choose another name.")
src.CreateCharacter()
return


var/list/classes = list("Hero")
help_text = "Which class would you like to be?"
var/char_class = input(src, help_text, prompt_title) in classes
var/mob/new_mob
switch(char_class)
if("Hero")
switch(input("Please Pick Your Race.","Character Creation")in list("Saiyan","Human"))
if("Saiyan")
new_mob = new /mob/character/saiyan()
usr.loc=locate(79,7,1)
class ="Saiyan"
if("Human")
new_mob = new /mob/character/human()
usr.loc=locate(79,7,1)
class ="Human"
new_mob.name = char_name
src.client.mob = new_mob
usr.loc=locate(79,7,1)
del(src)
mob
Login()
usr.loc=locate(79,7,1)
..()


Problem description:I am trying to make it so when they click the turf it starts up the create char proc, but when i do that i get this earror
DB The Next Generation.dm:107:error:src.CreateCharacter:undefined proc
How cna i fix this?

turf
login
Click()
src.CreateCharacter()


Can you guess what src is in this situation?
In response to DeathAwaitsU
src is the turf ^_^
In response to Zmadpeter
I tried changing turf to mob but it still dosn't work.
In response to Animekid09
No, the src is the turf. So you have to use usr. In click, dblclick and a few other procs, usr = the person who clicked. So usr. would be correct here.
In response to N1ghtW1ng
ooooooo ok thanks alot.
In response to Animekid09
I still get this earror
DB The Next Generation.dm:107:error:usr.CreateCharacter:undefined proc


turf
login
Click()
usr.CreateCharacter()//this is where earror accurs


mob/creating_character
base_save_allowed = 0 // If player quits before choosing, don't want to save this mob.

Login()
usr.loc=locate(7,7,2)
//spawn()
//src.CreateCharacter()



proc/CreateCharacter()//this is what should fix earror
// In this case, the code creates a /mob/human or /mob/ogre with the specified attributes.

// Get the character information from them. (You would probably want to do with this a browser page.)
var/prompt_title = "New Character"
var/help_text = "What do you want to name the character?"
var/default_value = key
var/char_name = input(src, help_text, prompt_title, default_value) as null|text

if (!char_name)
// Guess they don't want to create a new character after all, so send them to choose a character.
client.base_ChooseCharacter()
return

// Make sure there isn't already a character named that.
// Character names are stored as ckey, so get the ckey version of the name.
var/ckey_name = ckey(char_name)
var/list/characters = client.base_CharacterNames()
if (characters.Find(ckey_name))
alert("You already have a character named that! Please choose another name.")
src.CreateCharacter()
return


var/list/classes = list("Hero")
help_text = "Which class would you like to be?"
var/char_class = input(src, help_text, prompt_title) in classes
var/mob/new_mob
switch(char_class)
if("Hero")
switch(input("Please Pick Your Race.","Character Creation")in list("Saiyan","Human"))
if("Saiyan")
new_mob = new /mob/character/saiyan()
usr.loc=locate(79,7,1)
class ="Saiyan"
if("Human")
new_mob = new /mob/character/human()
usr.loc=locate(79,7,1)
class ="Human"
new_mob.name = char_name
src.client.mob = new_mob
usr.loc=locate(79,7,1)
del(src)
mob
Login()
usr.loc=locate(79,7,1)
..()


any1 kno how to fix it?
In response to Animekid09
This is an easy to fix, but even a mistake I make accidentally sometimes

The login you have put, is trying to call a mob/proc

But you defined the proc as a mob/creating_character/proc

So either change the "mob/creating_character" to "mob"
turf
login
Click()
usr.CreateCharacter()//this is where earror accurs


mob
base_save_allowed = 0 // If player quits before choosing, don't want to save this mob.

Login()
usr.loc=locate(7,7,2)
//spawn()
//src.CreateCharacter()



proc/CreateCharacter()//this is what should fix earror
// In this case, the code creates a /mob/human or /mob/ogre with the specified attributes.

// Get the character information from them. (You would probably want to do with this a browser page.)
var/prompt_title = "New Character"
var/help_text = "What do you want to name the character?"
var/default_value = key
var/char_name = input(src, help_text, prompt_title, default_value) as null|text

if (!char_name)
// Guess they don't want to create a new character after all, so send them to choose a character.
client.base_ChooseCharacter()
return

// Make sure there isn't already a character named that.
// Character names are stored as ckey, so get the ckey version of the name.
var/ckey_name = ckey(char_name)
var/list/characters = client.base_CharacterNames()
if (characters.Find(ckey_name))
alert("You already have a character named that! Please choose another name.")
src.CreateCharacter()
return


var/list/classes = list("Hero")
help_text = "Which class would you like to be?"
var/char_class = input(src, help_text, prompt_title) in classes
var/mob/new_mob
switch(char_class)
if("Hero")
switch(input("Please Pick Your Race.","Character Creation")in list("Saiyan","Human"))
if("Saiyan")
new_mob = new /mob/character/saiyan()
usr.loc=locate(79,7,1)
class ="Saiyan"
if("Human")
new_mob = new /mob/character/human()
usr.loc=locate(79,7,1)
class ="Human"
new_mob.name = char_name
src.client.mob = new_mob
usr.loc=locate(79,7,1)
del(src)




or do things how I would... Example below

turf
login
Click()
CreateCharacter(usr)//this is where earror occurs

proc/CreateCharacter(mob/creating_character/M)//this is what should fix earror
// In this case, the code creates a /mob/human or /mob/ogre with the specified attributes.

// Get the character information from them. (You would probably want to do with this a browser page.)
var/prompt_title = "New Character"
var/help_text = "What do you want to name the character?"
var/default_value = key
var/char_name = input(M, help_text, prompt_title, default_value) as null|text

if (!char_name)
// Guess they don't want to create a new character after all, so send them to choose a character.
client.base_ChooseCharacter()
return

// Make sure there isn't already a character named that.
// Character names are stored as ckey, so get the ckey version of the name.
var/ckey_name = ckey(char_name)
var/list/characters = client.base_CharacterNames()
if (characters.Find(ckey_name))
alert("You already have a character named that! Please choose another name.")
M.CreateCharacter()
return


var/list/classes = list("Hero")
help_text = "Which class would you like to be?"
var/char_class = input(M, help_text, prompt_title) in classes
var/mob/new_mob
switch(char_class)
if("Hero")
switch(input("Please Pick Your Race.","Character Creation")in list("Saiyan","Human"))
if("Saiyan")
new_mob = new /mob/character/saiyan()
M.loc=locate(79,7,1)
class ="Saiyan"
if("Human")
new_mob = new /mob/character/human()
M.loc=locate(79,7,1)
class ="Human"
new_mob.name = char_name
M.client.mob = new_mob
M.loc=locate(79,7,1)
del(M)


But then, I have some odd idea's of how to code, I have not had much interaction with the community so I only know what works and what does not, not whats better, this has been your problem all the way through, cause src and usr both work in turf clicks from what I can remember...