ID:148365
 
I've got a problem, obviously thats why I'm posting on the forum =). But, my problem is a proc i need i was wondering if someone could help me out

      // this is a way to get around a bug if ProcResult and another proc happen at the same time
world
New()
..()
spawn(10)
ProcThing()
var/count = 0
mob/var/PT = 0
proc
ProcThing()
for(var/mob/M in world)
if(M.PT == 0)
ProcResult()
else
if(count <= 30)/*this count variable is used so that if someone goes AFK for example and leaves the proc up
when they leave it doesnt cause an infinite loop and closes the Proc so ProcResult can work bug free.
*/

spawn(40)
count++
ProcThing()
else//when it reaches 31, it just clears whatever the problem is so people dont wait for every on this infinite loop.
count = 0//sets it back down to zero
M.PT = 0//this is what it was waiting on
//Here clear whatever is causeing the problem they are waiting for
ProcResult()
ProcResult()
//calls something that causes a bug when occuring at the same time as another proc

In this example i was trying to get a way to check if every mob in the worlds PT variable was false, but it doesnt work. I want it to check if everyones variable is equal to zero, if one person's is true, then it doesnt work. can anyone help me with this procedure?

ETG
I realize im being kinda vague, what im trying to do is make a proc that checks if every mobs variable is false.
its a mob's var, so if every mobs seperate varible is false it works, say 4 out of 5 of them have a false varible, and the others is true it wont work.
mob/var/PT = 0

proc
ProcThing()
for(var/mob/M in world)
if(M.PT == 0)
ProcResult()
else
spawn(50)
ProcThing()

This doesn't work, i want to check every mobs variable value, then if they are all false it works, other wise, it will check the values after 5 seconds. so when the value works, the proc is called at the same time for everyone
If you dont understand, post and il try to explain better.

ETG
(help me out and 10 DIMES are in it for you )
In response to Erdrickthegreat2
<code>proc ProcThing() var/allfalse=1 for (var/mob/M in world) if (M.PT) allfalse=0 break if (allfalse) //All the vars are false else //At least one of the vars is true</code>