Hi All !
I have a simple script-function, which randomly triggers different events.
I am searching for a solution to make the following,
if the event from "case 0" (or another cases) is ALREADY triggered with this function,
then next time this function will call another random event except for "case 0" or another.
Example (in random): case 3 -> case 1 -> case 2 -> case 5 -> case 0.
None of these cases is repeated.
After all I have to see the following,
After using this function 5 times all 5 events have been randomly used (only once),
and in the end the function calls another event, which will define, that all 5 events finally triggered.
function script MY_FUNCTION {
switch( rand(5) ) {
case 0:
//do that;
end;
case 1:
//do that;
end;
case 2:
//do that;
end;
case 3:
//do that;
end;
case 4:
//do that;
end;
}
}
I was thinking to use variables for each "case", but don't know, how to exclude the "case",
when the script goes through "rand" function. I have to save triggering these events in random order.
switch( rand(5) ) {
case 0:
//do that;
set CASE_0_USED, 1;
end;
Any suggestions please?
Thank you.
I have a simple script-function, which randomly triggers different events.
I am searching for a solution to make the following,
if the event from "case 0" (or another cases) is ALREADY triggered with this function,
then next time this function will call another random event except for "case 0" or another.
Example (in random): case 3 -> case 1 -> case 2 -> case 5 -> case 0.
None of these cases is repeated.
After all I have to see the following,
After using this function 5 times all 5 events have been randomly used (only once),
and in the end the function calls another event, which will define, that all 5 events finally triggered.
function script MY_FUNCTION {
switch( rand(5) ) {
case 0:
//do that;
end;
case 1:
//do that;
end;
case 2:
//do that;
end;
case 3:
//do that;
end;
case 4:
//do that;
end;
}
}
I was thinking to use variables for each "case", but don't know, how to exclude the "case",
when the script goes through "rand" function. I have to save triggering these events in random order.
switch( rand(5) ) {
case 0:
//do that;
set CASE_0_USED, 1;
end;
Any suggestions please?
Thank you.