This is a sequel (don't know the right word for it...) to the "flashing light" -topic. The flashing works, but now I have an other kind of a problem with it. This is my repeatedly_execute -script for the room:
// script for room: Repeatedly execute
if (IsTimerExpired(1) == 1) {
if (GetGlobalInt(150)==0) {
SetTimer(1,Random(20));
SetBackgroundFrame(1);
SetAreaLightLevel(2,0);
SetGlobalInt(150,1); }
else {
SetTimer(1,Random(30));
SetBackgroundFrame(0);
SetAreaLightLevel(2,-98);
SetGlobalInt(150,0); }
}
Now the background changes (=light flashes), but at some point it just stops at some point and doesn't repeat anymore. When I set the randomness(?) higher (for ex. 80), it repeats it with no problems, but I do not want the lights to flash so slowly... So is the bug in my script or is there some restrictions with repeatedly_execute and timers?
Perhaps you need to have a minimum time between flashes, if your compyetr's framerate isnt high enough. Try changing SetTimer(1,Random(20)); to SetTimer(1,Random(20)+5); and also +5 to the other settimer...
Dunno if this will help,, but I think its worth a try
It works now, thanks!
Yes, your problem was that if Random() returned 0, the timer would not be started. Just having a +1 would do the trick.