I wanted a integer to count such as:
SCAR Code:Slept := Slept + 1;
now i want it to count up to something like
Once it counts the said time i want it restart counting but how? O_OSCAR Code:Slept > (3 + (random(2))
I wanted a integer to count such as:
SCAR Code:Slept := Slept + 1;
now i want it to count up to something like
Once it counts the said time i want it restart counting but how? O_OSCAR Code:Slept > (3 + (random(2))
SCAR Code:if (Slept > 3 + Random(2)) then // If counter has passed the target
begin
Slept := 0; // Reset the counter
blah; // Do what else you need to do here that should be done as well
end;
Depending on how often you test the counter, the Random(2) will be pretty useless as multiple times per loop would most likely result in it returning 0 at least once. If it's only 1 test per loop, then it should be fine (test referring to have the little code above that checks if it's larger then resets it if it is).
By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.
Slept := original value;
is this what you are looking for?
There are currently 1 users browsing this thread. (0 members and 1 guests)