# getting more than one kind of thing to behave the same way

All right, I was unable to find the solution to this problem I’m having in I7. I want all of a kind of thing to do the same thing every turn, except when I’ve tried to it only applies to one instance of that kind of thing at a time. For example, I have:

``````
A buddy is a kind of person. A buddy has has a number called hp.

Bob is a buddy.
Jody is a buddy.

every turn:
if a buddy (called B) is in the location of the player and hp of B is greater than 1:
decrease HP of B by 10;
say "[hp of B]".``````

If Bob and Jody are both buddies, and both are in the same room as the player, this code only applies to Bob, since he’s the first thing the compiler reads. How can I have it so that both Bob and Jody both execute this code every turn? Many thanks in advance.

``````Every turn:
repeat with B running through buddies in the location:
if the HP of B is greater than 1:
decrease the HP of B by 10;
say "[hp of B]".``````

Thanks Draconis! I actually figured it out a couple of hours ago discussing it with a programmer who wasn’t an I7 guy, but still more competent than me. He mentioned that I probably needed a loop, so I read up on that and figured it out with some tinkering. I came up with something pretty similar to what you did. Except I made:

```every turn: repeat with Q running through buddy: if hp of Q is greater than 1: say "Whoa [Q]!!".```

Which I know isn’t really related to my original example, but this was just to test some functionality.