ID:268160
 
var/obj/orb1/O
while(O in world)
if(istype(O,/obj/orb1))
O.icon_state="glow"

Could some one explain what Im doing wrong and how to create a refrence variable that would equal an object in the world.
Green Lime wrote:
var/obj/orb1/O
while(O in world)
if(istype(O,/obj/orb1))
O.icon_state="glow"

Could some one explain what Im doing wrong and how to create a refrence variable that would equal an object in the world.

You give var/obj/orb1/O a value the same way you give any other variable a value, using the = operator.... Of course, you need the name of the object you want to reference, i.e.

var/obj/orb1/O = joes_big_shiny_orb

Your code doesn't make any sense though. If you gave O the value of an /obj/orb1, the loop would just run endlessly constantly setting O.icon_state to "glow" until O no longer exists. I'm pretty sure that wasn't your intention though.

If you are trying to loop through every /obj/orb1 in the world and set each one's icon_state to "glow", you would want to use the for loop, not the while loop. For example:

for (/obj/orb1/O in world)
O.icon_state="glow"