ID:211843
 
(See the best response by DarkCampainger.)
Code:
mob/var/learn_newskill = 0      

obj/NPCS/Persons
This_Person
icon = 'thisperson.dmi'
density = 1
New()
..()
wander(src)
Click()
if (get_dist(src, usr) > 1)
return
if(usr.race1 == 1)
if(usr.learn_newskill == 0)
alert("Hi [usr.key], I see you are race1.")
alert("If you do beat level 1 I can teach you a new skill")
if(usr.level1 == 1)
usr.verbs += new/mob/learn/verb/New_Skill()
usr.learn_newskill = 1
usr <<"This Person has taught you a New Skill"
if(usr.learn_newskill == 1)
else
return
alert("I can send you back to the start if you want")
switch(input("Where do you want to go") in list("Sart","Place 2","Cancel"))
if("start")
usr.loc = locate (15,7,46)

if("Place 2")
usr.loc = locate (1,6,1)

if("Cancel")
return

mob/learn
verb/New_Skill()
set category = "Skills"


Problem description:
I don't know what is wrong here. When the user beats level one, and then talks to the person they should automatically learn the new skill and appear in the skills tab but it doesn't. hmmm
Best response
verbs are added by path, so ditch that new:
usr.verbs += /mob/learn/verb/New_Skill


Also, instead of creating a special variable for each skill, you could create a list of the skills they know (or even test if the skill's verb path is in the usr's verbs list).

Also also, instead of creating a "Cancel" option in your input list, you can use input("") as null|anything in list("1","2") to add an actual cancel button. The input will return null if the user hits cancel.

Also x 3, instead of checking if(var == 1) and if(var == 0) for variables that can only be 0/1 (TRUE/FALSE, aka boolean values), just use boolean conditionals (they're more robust, and clearer in most cases):
if(usr.learn_newskill)
// Do this if true

if(!usr.learn_newskill)
// Do this if false


Obviously, you would use an else in the above example, but I just wanted to show you both versions.