ID:144476
 
Code:
client/base_num_characters_allowed = 3
world/mob = /mob/creating_character
mob/creating_character
base_save_allowed = 0

Login()

spawn()
loc = locate(76,9,3)
src << sound('ChaseTheChance.mid',1)

src.CreateCharacter()
proc/CreateCharacter()
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


Problem description:I'm pretty new to coding; however, I have pieced together this login code... The problem is that I dont see the title screen or hear the midi untill I click "create a new character". How do I fix that?

For one you should'nt need the spawn.
client/base_num_characters_allowed = 3
world/mob = /mob/creating_character
client/creating_character
base_save_allowed = 0
New()
mob.loc = locate(76,9,3)
mob << sound('ChaseTheChance.mid',1)
mob.CreateCharacter()
proc/CreateCharacter()
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

I'm not sure if im right on this but im still learning also.
~Grand~
In response to KillerGrand
Hmm... No matter what I try I can't work it so I don't get an error... I can't take out spawn because when I do and try to create a new character it fails to bring up the name prompt.
In response to Crybox
client/base_num_characters_allowed = 3
world/mob = /mob/creating_character
mob/creating_character
base_save_allowed = 0

Login()

spawn()
loc = locate(76,9,3)

src.CreateCharacter()
proc/CreateCharacter()
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

client
New()
src << sound('ChaseTheChance.mid',1)
In response to Digital Hero
No man, I think you misunderstood. I DONT want it to go to the title screen and play music AFTER you select create a new character. I want it to be there from the get go.
In response to Crybox
//instead of using mob=mob/creating_char, just use mob, its much easier to do..
client/base_num_characters_allowed = 3
mob/
base_save_allowed = 0
Login()
loc = locate(76,9,3)
src << sound('ChaseTheChance.mid',1)
spawn(10)//waits 1 second until the proc is called
src.CreateCharacter()
mob/proc/CreateCharacter()
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


this should work
In response to Axerob
Lol well all went well until I went to start my game up. When it loaded, still had the plain black screen and had the character box up. Whats even beeter is that when I went to create or load one it acted wildly and made a continuous loop of the create a character option. I know I used a demo to code this login but it obviously wasn't what I was looking for. What my real aim was, was to eventually code in a title screen with clickable options i.e. New Character, Load Character, Delete Character and Quit. Is there any reference I could use to make this happen or even a siter which explains how the Login proc works and its complete functionality? Thanks in advance.
In response to Crybox
world
hub = "XXXX.XXXXXX" //This can be gotten from your hub link: http://byond.com/hub/[?YourHubKeyHere]/[?HubnameHere]
hub_password="**********"

client/base_num_characters_allowed = 3
base_save_allowed = 0

mob/spectator
icon = null // has no icon, so even people with see_invisible can not see it

Move() // overide the default Move() proc
// leave the Move() proc empty, so the mob may not Move().
// You will have to set its loc directly.

New()
..() // do the default New() proc
loc = locate("title_screen") // start the mob on the turf with the tag "title_screen"
// see StartLocation for more info

Logout()
..()
del(src) // delete the mob when a player logs out of it
// this prevents unused spectators from cluttering memory

world
mob = /mob/spectator // make spectator the default mob for players
mob/spectator/verb/join()
set desc = "Join the game!"
client.mob = new/mob/CreateCharacter()
// change the type path to whatever mob type you want the player to begin play as.
turf/title_screen
icon = 'title1.bmp'

Click()
if(istype(usr,/mob/spectator)) // make sure it's a spectator clicking the button
usr.client.mob = new/mob/CreateCharacter()
mob/spectator/Login() // overide the the spectator Login() proc
..()
spawn(600) // in 60 seconds...
client.mob = new/mob/choosing_char()
world<<"<font color=white>[usr] </font><font color=teal>has logged in!</font>"
src.CreateCharacter()

proc/CreateCharacter()
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)
client.base_ChooseCharacter()
return
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("Male", "Female")
help_text = "Which gender would you like to be?"
default_value = "Male"
var/char_class = input(src, help_text, prompt_title, default_value) in classes
var/mob/new_mob
switch(char_class)
if ("Male") new_mob = new /mob/Male()
if ("Female") new_mob = new /mob/Female()
new_mob.name = char_name
src.client.mob = new_mob
var/turf/first_location = locate(1, 1, 1)
new_mob.Move(first_location)
del(src)
mob/Male
icon = 'Base.dmi'
mob/Female
icon = 'Base.dmi'

mob
Login()
..()
client.view = src.screensize



I came up with this after reading a ByondBwicki on title screens; however, it gives an error (title.dm:45:error: proc definition not allowed inside another proc) and highlights var/prompt_title = "New Character". Not too sure what the deal is with that. Any help would be accepted! Thanks!
Consider using hub://AndroidData.CharacterHandling (technically it could be considered a library, but consider it a demo)
In response to Crybox
Ok. With a little help from AxeRob, and a little playing around, I managed to make a title screen that is fully functional. Thanks guys.