ID:141515
 
Code:
Skilltree
parent_type = /obj/
icon = 'stree.dmi'

var
reqpoints = 0
tech_obtained = /Skill/
unlocked_skills = list()

Click()

if( (name in usr.Learned_Skills) )
usr << "You have already learned this!"

else if( !(name in usr.Activated_Skills) )
usr <<"This skill is not available at this time."

else if(usr.Skill_Points < reqpoints)
usr << "You don't have the required skill points for this!"

else if( alert("Obtain [name] for [reqpoints] points?","Skill Obtain","Yes","No") == "Yes")
usr << "You have obtained [name]!"
usr.Learned_Skills += name
for(var/A in unlocked_skills)
if( !(A in usr.Activated_Skills) )
usr.Activated_Skills += A
usr.Skill_Points = max(0, usr.Skill_Points - reqpoints)
usr.contents += new tech_obtained
usr.Refresh_Skilltree()


Blank
name = "blank"
icon_state = "tech"
reqpoints = 0
unlocked_skills = list("Defend")
tech_obtained = /Skill/blank

Blank2
name = "blank2"
icon_state = "tech2"
reqpoints = 0
tech_obtained = /Skill/blank



turf
Skilltree
icon = 'stree.dmi'
Background
icon_state = "Background"
Left_Right
icon_state = "Left - Right"
Up_Down
icon_state = "Up - Down"
Skill
parent_type = /obj

blank
Click()
usr << "You clicked [src]"

blank2
Click()
usr << "You clicked [src]"
mob
verb
SkillTree()
if(Skill_Tree)
for(var/I in client.images) if(I)
del I
client.eye = src
Skill_Tree = 0
return
src << "Your view has changed, but you are still in the same spot."
Skill_Tree = 1
client.eye = locate (1,55,3)
Refresh_Skilltree()

proc
Refresh_Skilltree()
for(var/image/I in client.images) if(I && I.tag == "Skilltree")
del I
for(var/Skilltree/S in oview(client.eye) )
if( ! (S.name in Activated_Skills) )
var/image/I = new('Skill Tree.dmi',S.loc,"Unavailable",FLY_LAYER)
I.tag = "Skilltree"
client.images += I

var
Skill_Points = 0
Activated_Skills = list("blank")
Learned_Skills = list()
tmp
Skill_Tree = 0

Stat()
..()
statpanel("Skills")
if(statpanel("Skills"))
stat("Skills You've obtained")
for(var/Skill/S in contents)
stat("",S)


Problem description:
the code compiles with no errors but when someone uses the verb it takes them to a black screen instead of the skill tree any help with this would be a great help please note this is based off of axerob_skilltreedemo I dont claim any rights to this code

WOW no one even tried to help ohh well scratch that then
Your code has room for abuse under /SkillTree.Click(). See if you can find out where. Your Stat() procedure makes no sense, particularly at the if(statpanel()) part. Why would you be doing that?

Your problem is the client.perspective however. Set client.perspective to EYE_PERSPECTIVE. Look it up in the reference.
In response to CaptFalcon33035
CaptFalcon33035 wrote:
Your Stat() procedure makes no sense, particularly at the if(statpanel()) part. Why would you be doing that?

Maybe he actually looked statpanel() up. ;P Though he doesn't need the duplicate call right above.
In response to Kaioken
Kaioken wrote:
CaptFalcon33035 wrote:
Your Stat() procedure makes no sense, particularly at the if(statpanel()) part. Why would you be doing that?

Maybe he actually looked statpanel() up. ;P Though he doesn't need the duplicate call right above.

That is precisely why it makes no sense.
In response to CaptFalcon33035
Presumably he could have thought that otherwise it wouldn't create the statpanel somehow.
In response to Kaioken
Im still a noob coder I understand a good part of it but there a some things that are still unknown to me thank you for the feed back
In response to Wrath69
Okay for future reference, there is a difference between the terms "newb" and "noob".

Newb (nū.bē) - a term used to generalize people who are new to something; usually a game.

Noob (nūb) - a term used to generalize people who are, overall, jerks and/or are increasingly annoying.

So by calling yourself a "noob coder", you'd calling yourself an annoying coder.