ID:145921
 
Code:
mob
create_char
Login()
..()
var/mob/New
var/mob/OldMob=src
alert("Hello [src]!","Continue")
while(!charactername) //while you have a nullified name
charactername=input(src,"Welcome! What is your name?","Character Creation")as text
if(length(charactername)>=20)
src<<"Must be smaller then 20 characters!"
return
var/gender=alert(src,"What gender do you wish to be?","Character Creation","Male","Female")
var/race=input("What race do you want to be?","Character Creation") in list("Warrior","Archer","Mage")
var/M=text2path("/mob/characters/[race]")
New = new M
New.icon = 'Icons.dmi'
New.icon_state=copytext("[race]",1,4)+"[gender]" // So for example, you call your male warrior's icon_state: Warmale
New.name = name
src.client.mob = New
New.loc=locate(1,1,1)
raceskills()
del(OldMob)

mob/proc
raceskills()
if(src.race == "Archer")
src.verbs += /mob/archer/verb/Fire
if(src.race == "Warrior")
src.verbs += /mob/warrior/verb/Slash
if(src.race == "Mage")
src.verbs += /mob/mage/verb/Psuedonym


Problem description: src.race:undefined var

umm .. just a guess here u might have 2 make it usr.race ill look over the code if that dont work
In response to JRR-Zero
I try to avoid usr in procs as much as possible, but I've tryed though, didn't work
And there is a race var for mobs?
By the way, why are you setting a variable for src then only using it as a del() argument? Just remove that and use del(src).
You might want to pass an argument through raceskills(), as in your New var.
In response to Artemio
I've made
mob/var
race



Solves the error, but gives a runtime

runtime error: Cannot modify null.race.
proc name: Login (/mob/create_char/Login)
source file: levelup.dm,36
usr: Mysame (/mob/create_char)
src: Mysame (/mob/create_char)
call stack:
Mysame (/mob/create_char): Login()
In response to Mysame
I fixed that login doesn't do a thing (Cheers Cheetoz)

But now, the
mob/var
race

didn't to a thing. It needs to be the race that's made in the character creation. Gonna try a few things out, but any help would be nice! *hint*
In response to Mysame
If you're going to do that, you'd have to pass some arguements.
mob/create/Login()
..()
var/mob/M
//blah
var/race=input(src,"Choose your race.")in list("Human","Dog")
M.RaceProc(race)
//blah

mob/proc/RaceProc(var/race)
if(race=="Human") src.skills.Add(new/obj/Punch)
if(race=="Dog") src.skills.Add(new/obj/Bite)


Or you can do it this way:
mob/create/Login()
..()
var/mob/M
//blah
var/race=input(src,"Choose your race.")in list("Human","Dog")
RaceProc(M,race)
//blah

mob/create/proc/RaceProc(var/mob/M,var/race)
if(race=="Human") M.skills.Add(new/obj/Punch)
if(race=="Dog") M.skills.Add(new/obj/Bite)


I'm assuming you didn't make a mob var for "race".
In response to Mega fart cannon
And I'm assuming you didn't read the other posts, now, did you?
hm.. i decided to make a new inviroment 2 test this out and i have 0 errors heres the code.
mob/var
race
charactername

mob
create_char
Login()
..()
var/mob/New
var/mob/OldMob=src
alert("Hello [src]!","Continue")
while(!charactername) //while you have a nullified name
charactername=input(src,"Welcome! What is your name?","Character Creation")as text
if(length(charactername)>=20)
src<<"Must be smaller then 20 characters!"
return
var/gender=alert(src,"What gender do you wish to be?","Character Creation","Male","Female")
race=input("What race do you want to be?","Character Creation") in list("Warrior","Archer","Mage")
var/M=text2path("/mob/characters/[race]")
New = new M
New.icon = 'Icons.dmi'
New.icon_state=copytext("[race]",1,4)+"[gender]" // So for example, you call your male warrior's icon_state: Warmale
New.name = name
src.client.mob = New
New.loc=locate(1,1,1)
raceskills()
del(OldMob)

mob/proc
raceskills()
if(src.race == "Archer")
src.verbs += /mob/verb/a
if(src.race == "Warrior")
src.verbs += /mob/verb/a
if(src.race == "Mage")
src.verbs += /mob/verb/a


mob
verb
a()

loading test.dme
saving test.dmb

test.dmb - 0 errors, 0 warnings

In response to JRR-Zero
I've already fixed that, and it won't work. You've done it wrong you know.

See, you've already made a
var/race=input(...) in list (...)


And then you make a
mob/var
race


If you could read, you would see I've already tried that and that it didn't work, because you're overwriting 2 variables at once.

Now don't go on and tell people you can make a library.