ID:146377
 
Code:
                    var
picked = pick(playersb)
world << "[picked] got picked to be hit by the ball haha!!"
picked.icon_state="dead"


Problem description:
Dodgeball.dm:109:error:picked.icon_state:undefined var

I don't know why it reconize picked as a variable in the last line. It does in the one above it though.

In that situtation, it looks like picked is just a variable. Nothing more. Perhaps you should show us the code so we can find a better way to do whatever it is your doing. Variables don't have icon_states, but that's what the dream seeker is picking up, most likely.
You need to define 'picked' so that it's a reference, not just a variable. For instance:

var/mob/m=locate(/mob)
m << "Assuming locate() isn't being stupid, you're a mob."
m.icon_state="OMGWTFBBQUBER1337THUPERTHAYIN"


Picked is defined. picked.icon_state isn't. Because the compiler doesn't know what type picked is.

Why does that var statement on the top line have no indentation after it?
In response to CaptFalcon33035
Sorry I guess I should have included more code. The variable picked was storing a player. So I would think that it would reconize picked as a player. I still think it should, but I'm probably wrong.

This is the code, now indented correctly:
                    var/picked = pick(playersb)
world << "[picked] got picked to be hit by the ball haha!!"
picked.icon_state="dead"


Here is an explaination as to what playersb, playersr are and what the variable picked was storing.
var/list/playersb = new()
var/list/playersr = new()


mob
Login(O)
src.verbs-=/mob/verb/Throw
if(!src.teamed)
src.name=input("What is your desired name?")
src.teamed=input("Choose your team color.") in list ("Blue","Red")
switch(src.teamed)
if("Blue")
..()
src.teamed=1
src.team=0
src.loc = locate(2,2,1)
src.icon=/mob/blue
playersb.Add(src)
if("Red")
..()
src.teamed=1
src.team=1
src.loc = locate(10,2,1)
src.icon=/mob/red
playersr.Add(src)


Picked is still not working. I understand that variables don't have an icon_state, but do they if the value they hold is a player? (Same problem as before.)
In response to Shizzal
mob/picked = pick(playersb)
world << "[picked] got picked to be hit by the ball haha!!"
picked.icon_state="dead"


Maybe that will work? I don't know.
Shizzal wrote:
Code:
>                   var
> picked = pick(playersb)
> world << "[picked] got picked to be hit by the ball haha!!"
> picked.icon_state="dead"
>

Problem description:
Dodgeball.dm:109:error:picked.icon_state:undefined var

I don't know why it reconize picked as a variable in the last line. It does in the one above it though.


You've put in 'var' for some reason.. maybe incorrect indentation or just accidental, however
                    picked = pick(playersb)
world << "[picked] got picked to be hit by the ball haha!!"
picked.icon_state="dead"