ID:165673
 
Ok im making this text based game (a mud) that needs skills yet whel they chose skills as their attack i cant seem to get their skills into a list that they can chose from, please help me.

        startbattle()
src.win=0
src.action = input("What type of action do you want to take?.","Battle",src.action) in list("Attack","Defend","Run","HELP!!!!!")
if(src.action=="Attack")
src.attack=1
src.str-=src.mmdef
src.mmhp-=src.str
src<<"You attack [monname] for [str] damage."
src.str=src.mstr
deathcheck()
if(src.action== "Defend")
src.attack=1
src<<"[monname] saw through your defence."
src.defend=0
deathcheck()
if(usr.action=="Run")
src.run=1
runaway()
if(usr.action=="Skill")
skill stuff here
if(usr.action=="HELP!!!!!")
src.help=1
deathcheck3()
monsterattack()
if(src.mmagi>= src.agi && src.defend==0)
src.attack=0
src.def-=src.mmstr
src.hp-=src.mmstr
src<<"You got attacked by [monname] for [str] damage."
src.mmstr=src.mmmstr
src.def=src.mdef
deathcheck2()
return
else
src<<"[monname] missed their attack."
src.attack=0
src.defend=0
startbattle()
return
That depends on how you're keeping track of their skills. Hopefully you have a list on the player already, as doing this variable by variable is more work (now and later if you choose to add more skills). If you'd like to change to a different skill system, hop on over to Lummox JR's Datums Are Our Friends article and pay close attention to the stat datum he has setup. With some slight modification that can be turned into a skill datum, and you could make an associative list full of them. Then adding a skill later is as easy as adding it to the list. =)

He also has an article on associative lists too, if you're not sure what that's all about.
In response to YMIHere
ok i did something like this
mob/var/list/skill = list()

mob
New()
skill = new("Kamehameha") // new skill
..()


now how do i call that with this:

        startbattle()
src.win=0
src.action = input("What type of action do you want to take?.","Battle",src.action) in list("Attack","Defend","Run","HELP!!!!!")
if(src.action=="Attack")
src.attack=1
src.str-=src.mmdef
src.mmhp-=src.str
src<<"You attack [monname] for [str] damage."
src.str=src.mstr
deathcheck()
if(src.action== "Defend")
src.attack=1
src<<"[monname] saw through your defence."
src.defend=0
deathcheck()
if(src.action=="Run")
src.run=1
runaway()
if(src.action=="Skill")
//what do i put here to call the skill list?
if(src.action=="HELP!!!!!")
src.help=1
deathcheck3()

thats inutracy's smartened up battle system somewhat, it had too many bugs so i rewrote it, but there wasnt anything about skills.

Someone help me, Volks.
In response to VolksBlade
First, look up switch(), it will clean up those extended "if" checks.

Next, look up for() and in. An example:
for(var/skill/s in src.skills)
src << "[s]"

That will loop through everything in the var skills and display it to src.