ID:1740717
 
(See the best response by Mightymo.)
Sorry I'm using my phone and can't paste code.

I'm trying to get my object to check in oview for the same object within one space to see if the other icon state is "normal" before it changes it's icon state to normal. I don't need the code just some help so I can figure it out please. Thank You

Best response
Check an icon state like a string.

for(var/obj/o in oview(src,1))
if(o.icon_state != "normal")
...


If you need to check the type of an object, you may want to look at istype().
Awesome, that helps a ton. I try something like this when I get home. Thanks again
DaveHere wrote:
This is my code I am using for the boards that the player can bump and will break. I'm trying to make the board return to normal only when the player tries to break a different board. The player will be surrounded by boards so they can't break the same board but need to break a different board. When that happens the board they broke is repaired. I planned to change it later on to break all boards except 1. When the player breaks that one board it will choose one of the other boards at random to be repaired making the player need to pay attention to which board is repaired.

Again I don't want someone giving me the code. I want to learn but am unsure where I need to make the correction. The world << commands are to help me figure out which part of the code the objects I bump into run. Thanks in advance for any help.

Consider what we have.

We have the goal described in your post:
1. The player bumps into one of the boards surrounding him.
2. The player then bumps into one of the unbroken boards.
3. A random one of the broken boards gets repaired.

We have a player surrounded by boards.

Bumped(atom/A) is the event called when player A bumps into one of the boards src. This handles steps 1 and 2, so all of our logic can go in it.

oview(Center, Range) returns a list of objects within Range tiles of some object Center. In our case, we can get a list of boards around the player by calling oview(A, 1) and storing that result in a variable, such as boards.

We want to check if src is already broken, in which case we do nothing. This is done by checking icon_state.

If src isn't broken, we want to break it, and then pick a random broken board to repair. You break a board by changing its icon state. Next is to get a random broken board, and that's where oview() comes in.

We want a list of broken boards. We can start off with a list of all possible boards (boards), and then filter out the unbroken ones with a for() loop. Then, with that list of broken boards, you can pick() a random one to fix.

This is as much as I can do without giving you the code.
^ Dude.....your design skills are epic...
In response to Lundex
It's not that hard to do (not to take away from him), you just need to know what you want in advance. The same way you naturally break down the steps in making coffee or cooking some food, it's no different than that.
In response to FKI
I can related but at the same time. My brain is on autopilot when it comes to everyday tasks because I do them so much.
Thanks Kiaochao. Your advice really helps me.