some sort of regulator

admin

Administrator
Staff member
ok, heres my situation: i have a thing with basically an infinite loop, something like this:

var first = 1;
var second = 2;

if (first==1){
first++;
second--;
}
if (first==2){
first--;
second++;
}

but i need some sort of regulator so it doesnt seriously slow down the page...ive tried setTimeout and setInterval, but i cant really understand how they work, and they dont seem to make any difference...is there any way i could make it search to see if these are true, say once every second or so?
 
Back
Top