here is the code:
begin
Case random (2) of
0: TypeSend('lets do this');
1: TypeSend('yay');
end;
end;
now what if i wanted it to do case 0 90% of the time? and case 1 only 10% of the time? how would i do this? i still want it to be random!
here is the code:
begin
Case random (2) of
0: TypeSend('lets do this');
1: TypeSend('yay');
end;
end;
now what if i wanted it to do case 0 90% of the time? and case 1 only 10% of the time? how would i do this? i still want it to be random!
i know this is kinda cheating... but i forget how to do the shortcut for cases without having to type in 1 , 2, 3, 4, 5, 6, 7, 8; (onl know it for java)
so the other way would be.
SCAR Code:begin
if random (10) > 9 then
begin
TypeSend('lets do this');
end
else begin
TypeSend('yay');
end;
[IMG]http://farm3.static.flickr.com/2120/2052732965_348f3629d0_o.jpg[/IMG]
@Greg: desperate for syntax errors?![]()
ok thanks.
anyone else know a way? other than ifs thens?
i so wish scar was written in JAVA! id have a much easier time!.....
ty! thats the one i wanted, thanks mick!
Well footballdjs got what he wanted, but I'll continue the discussion -
who said you have to use a case?
SCAR Code:program New;
Var
I: Integer;
begin
I := Random(100);
If I > 80 Then
Writeln('I was larger than 80')
Else
If I > 50 Then
Writeln('I was larger than 50, but smaller than 80!')
Else
If I > 20 Then
Writeln('I was larger than 20, but smaller than 50')
Else
If I >= 0 Then
Writeln('I was smaller than 20');
end.
Also, who said you couldn't make an array of procedure/function calls?
Then you will survive with a for loop.
There are currently 1 users browsing this thread. (0 members and 1 guests)