ID:146832
 
I'm trying to make a list of skills as Objects. I need them as objects so I can click on them to do multiple things. These will show in the statpanel with their skill number beside them, but for now, Im having problems.


Here's my Notes/Errors/Code.

Notes
#######################
-I didn't put all the errors in because they just repeated the same thing over and over but with different weapon skills.

#######################

Errors
#######################
test1.dm:551:error:obj:undefined var
test1.dm:551:error:skills:undefined var
test1.dm:551:error:attack:undefined var
test1.dm:551:error:knife:undefined var
test1.dm:551:error:obj:undefined var
test1.dm:551:error:skills:undefined var
test1.dm:551:error:attack:undefined var
test1.dm:551:error:bluntshort:undefined var

test1.dmb - 86 errors, 0 warnings (double-click on an error to jump to it)
#######################

Code
#######################

//**** This is the objects that represent the skills ****
obj/skills
var/skillnum = 0//The skill number, this changes as you get better.
var/skilltick = 0
//----------------------
attack
verb/Practice()
//will add code later.
verb/Description()
//will add code later.
//----------------------
knife
name = "Knife"
Description()
src<<"Skill: Knife -> Utilize small piercing and slashing weapons like Dagger's and Sai's in melee combat."
Practice() //This will attempt to increase a characters skill.
src<<"\red *** Do not move until Practice is completed or you forfit any potential learning.***"
//more code to come

bluntshort
//more code about this weapon skill
//*************

//* **** This is the code where I am trying to allow the player to choose what skill and how many points they have available to add to it and then put those into the object and add it to the players inventory. Once in the inventory they do not have the same verbs as other objects and are not treated as something tangible.***** */

mob/creating_character
base_save_allowed = 0

Login()
spawn()
src.CreateCharacter()

proc/CreateCharacter()
//lots of code here but not relivant
var/list/askillsfull = list((new obj/skills/attack/knife), (new obj/skills/attack/bluntshort) //I did not put all the object skills in this list. I only show the ones that are related to the errors I showed above to simplify things. It it works for more than 1 thing, it will work for more.

poolpoints=atk // atk is a number that was declaired earlyer in the program.

do
var/list/choices=new
var/obj/O
for(O in askillsfull)
choices["[O]"]=O
var/skillX=input(src,"What do you want to Learn?","Learn","Nevermind") in choices
var/skillX=input(src, help_text, prompt_title) in choices
if(skillX=="Nevermind") return
O=choices[skillX]


default_value = 0
var/numX
do//make sure player chooses a proper amount of points into the skill they chose.
if(poolpoints > 0)
i = 0
poollist = list(0)
while (i <= poolpoints)
poollist += i
i++
help_text = "How many points will you put to [skillX]? It must have at least 10 points in it. You have [poolpoints] points to spend."
numX = input(src, help_text, prompt_title, default_value) in poollist
while (numX > 0 && numX < 10 || (poolpoints-numX)<10 && (poolpoints-numX)>0)
poolpoints -= numX
askillsfull[O]=numX
O=new O.type // create a new object of this type
O.loc=usr
while(poolpoints > 0)// If there are points left, let player choose another skill.


#######################</10></10>
list((new obj/skills/attack/knife), (new obj/skills/attack/bluntshort)


When using type paths in DM, they start with a (back?)slash.

list((new /obj/skills/attack/knife), (new /obj/skills/attack/bluntshort)
Is there a line before obj/skills? If not I think your comments are messed up ://**** This is the objects that represent the skills ****/ Try that, also try posting in <pre>
 [CODE]
</PRE>Tags.
In response to YMIHere (#1)
Thx YMIHere,
Amazing what a litle slash can do. I love these forums. Sometimes you just need another pair of eyes.
In response to karver (#3)
I think I'm not understanding the code exactly.
I'm trying to put the object skills into a specific spot in the stat panel
--------------
for(var/obj/skills/attack/O in usr.contents)
stat("[O]: ", O.skillnum)
--------------
All it does is give me the default stat which is 0 and the name of the object instead of the object itself and it's name that I made the skill so I can't click it.

I think it's an assignment issue in the previous code. Im trying to make the objects 'skillnum' be passed from the previous code but Im not doing that right.

Also in the previous code, I can't get the list to remove a skill you take.
In response to karver (#4)
YOU have been told countless times already PUT YOUR CODE IN DM TAGS!

[link]
In response to karver (#4)
You have to click on the object, so you need to put the object itself into the statpanel. =)

An easy way to show the skill level at the same time as the object is to set the object's suffix variable to the level whenever it changes. =)

How objects are displayed in statpanels:
<pre>[icon] [name] [suffix]</pre>
In response to Ter13 (#5)
Coutless times? You cant count to 1?
N1ghtW1ng told me once about DM tags.

Ill keep it in mind for next time.
In response to YMIHere (#6)
Cool.
that simple thing made me look at it with more confidence so I do understand something else about it, however I'm not getting the results.
I think Ill try to do it like the way stackable money is.
I think theres a demo around somewhere that deals with that. If anything I will learn more.
Thx again YMIhere