ID:149537
 
I have this proc for main combat, yet when i choose magic the list does not come up, any hints on what to do

here is my code:

maincombat(mob/attacker as mob, mob/target as mob)
begin
switch(alert(usr,"What would you like to do?","Battle","Attack","Magic","Run"))
if ("Attack")
sleep(10)
attack(attacker, target)
if ("Run")
sleep(10)
flee(attacker, target)
if ("Magic")
var/list/magic = new
magic += usr.bio
magic += usr.cure
magic += usr.cancel
magic += ""
var/list/magic1 = input("Choose a magic skill.", "Choose:") in magic
if(magic1 == "Cure")
if(usr.MP <= 2)
usr << "\blue You dont have enough magic points to attempt this spell!"
goto begin
else
usr.MP -= 2
usr.HP += 10
if(usr.MP <= 0)
usr.MP = 0
if(usr.HP >= usr.MaxHP)
usr.HP = usr.MaxHP
if(magic1 == "Cancel")
goto begin
if(magic1 == "")
goto begin
if(magic1 == "Bio")
if(usr.MP <= 5)
usr << "\blue You dont have enough magic points to attempt the spell!"
goto begin
else
usr.MP -= 5
var/damage = rand(1,5)
if(damage == 1)
target.HP -= 5
usr << "\red Your Bio spell hits him for 5 damage!"
npcdeathcheck(attacker, target)
if(damage == 5)
target.HP -= 10
usr << "\red CRITICAL HIT! Your Bio spell hits [target] for 10 damage!"
npcdeathcheck(attacker, target)
else
usr << "\red Your Bio spell misses"
npcdeathcheck(attacker, target)

any one know?

-NilFisk
I'm guessing this is the section you're having trouble with:
if ("Magic")
var/list/magic = new
magic += usr.bio
magic += usr.cure
magic += usr.cancel
magic += ""
var/list/magic1 = input("Choose a magic skill.", "Choose:") in magic

Here's how you debug something like this:

If the pick list for the input project is empty or has only one item, you will not see it. This means that your list called magic does not have the items in it you think it does. Now since you seemingly just added in a bunch of usr.items to this list, and yet the list doesn't seem to have them. What's going on here?

Well, perhaps those things you added were null, in which case, you're picking from a list of nulls, so input won't give you anything. Why would they be null? You're pretty sure you added in those variables, aren't you.

Well look again. What is the value of usr.bio? First let's look at the usr. Um, wait a sec... who is usr here?? THERE IS NO USR!

You've already set up a variable to be attacker and target, so why aren't you referencing them instead of usr?
In response to Skysaw
Thanks You've done me a great favour :)

-NilFisk