ID:2003597
 
(See the best response by Ter13.)

mob/NEW1
icon='NewLoadDel.dmi'
icon_state="newtl"
Click()

var
Eyes
Hair
choices
icon = 'human.dmi'
Elf
Human
var/mob_path = "mob/choices/"
var/choice = input("Please select a race") in list ("Elf","Human")
mob_path += choice
var/mob/choices/new_mob = new(mob_path)
new_mob.icon_state = choice
new_mob.Eyes = input("Please select your eye color.") in list ("Black")
new_mob.Hair = input("Please select your hair color.") in list ("Black")
new_mob.name = input("Please select a name.") as text
new_mob.Move(locate(48,59,1))
src.client.mob = new_mob
del(src)


src.client.mob = new_mob is giving bad argument definition, I'm trying to get it so that when I click on the mob it activates the character creation questionnaire

Best response
#define ACTION_SET 0
#define ACTION_CALL 1

#define HUD_PLANE 100

obj
screen_button
plane = HUD_PLANE
var
enabled = 1
action
operand
value

Click()
if(!enabled) return
switch(action)
if(ACTION_SET)
usr.vars[operand] = value
if(ACTION_CALL)
if(value)
if(istype(value,/list))
call(usr,operand)(arglist(value))
else
call(usr,operand)(value)
else
call(usr,operand)()


The above is the base type for a screen button that will allow you to change the clicking mob's variable specified by operation if the action variable is ACTION_SET, or call a clicking mob's proc specified by operation if the action variable is ACTION_CALL. value in the case of ACTION_SET is the value that the variable will be changed to. value in the case of ACTION_CALL is either a list of arguments, a single argument, or in the case of null, no argument will be passed through the call.

Let's check out how we'd use something like this:

var
list/race_selection_ui = list(new/obj/screen_button(){screen_loc="CENTER+0:-16,CENTER";icon='races.dmi';icon_state="elf";name="Elf";action=ACTION_SET;operand="selection";value="elf"},
new/obj/screen_button(){screen_loc="CENTER+0:16,CENTER";icon='races.dmi';icon_state="human";name="Human";action=ACTION_SET;operand="selection";value="human"})

list/race_types = list("elf"=/mob/Elf,"human"=/mob/Human) //create a list of types related to strings

mob/char_creation
var
stage = null
selection = null
race = null

Login()
loc = null
CreateCharacter()
return 1
Logout()
stage = null

CreateCharacter()
set waitfor = 0
stage = "RaceSelect"
while(stage!=null)
call(src,stage)()
//we're assuming that character creation was completed, so create the new mob given the player's choices:
var/rtype = race_types[race]
client.mob = new race()
//this mob will self-delete

RaceSelect()
//prepare
client.screen += race_selection_ui
var/obj/screen_button/next_button = new/obj/screen_button(){screen_loc="CENTER,CENTER+0:-64";icon='screen.dmi';icon_state="done";name="Done";action=ACTION_SET;operand="selection";value="next";enabled=0}
client.screen += next_button
//the selection loop
while(stage=="RaceSelect")
//clear selection
selection = null
//wait until the player has selected something
while(selection==null)
sleep(world.tick_lag)
//check what the selection was and handle the options
switch(selection)
if("next")
if(race)
//move to the next stage
stage = null
else
race = selection
next_button.enabled = 1
//clean up
client.screen -= next_button
client.screen -= race_selection_ui


This snippet only shows on-screen selection menu, but it should be flexible enough to do everything you need.