SRL Archive - OSR Help

Whats wrong with this case statement :c


Sin

2012-01-19 20:10:58

case(2) of :
1. Mouse(x,y,0,0,False);
wait(1000);
ChooseOption('Use');
2. Mouse(x,y,0,0,True);
I'm pretty sure that's not how it's supposed to go like…
But it's my first time using a case statement :P

Yanhua

2012-01-19 20:11:56

change the . to : after the 1 and 2.

remove the ':' after 'of', it is not needed

looking at your code, you realise it will only do 2?

If you want to do a random of 1 or 2 then do


case random(2) of
1: begin
Mouse(x,y,0,0,False);
wait(1000);
ChooseOption('Use')
end;
2: Mouse(x,y,0,0,True);
end;

Sin

2012-01-19 20:24:24

Why you so pro :c
Thanks :)

kitchenrange

2012-01-19 20:48:47

random(2) will return either 0 or 1 if I remember right.

You will probably need to change those to 0 and 1.

Dynamite

2012-01-19 20:56:21

case Random(2) of
0: begin
Mouse(x,y,0,0,False);
wait(1000);
ChooseOption('Use')
end;
1: Mouse(x,y,0,0,True);
end;

Is what you want I think :)

-Boom

Yanhua

2012-01-19 20:58:43

From: Dynamite
case Random(2) of
0: begin
Mouse(x,y,0,0,False);
wait(1000);
ChooseOption('Use')
end;
1: Mouse(x,y,0,0,True);
end;

Is what you want I think :)

-Boom


I posted the exact same thing…

Dynamite

2012-01-19 21:00:03

From: Yanhua
I posted the exact same thing…


Random(2) will generate either 0 or 1.
So no, you didn't :) <3

-Boom

Yanhua

2012-01-19 21:00:50

From: Dynamite
Random(2) will generate either 0 or 1.
So no, you didn't :) <3

-Boom


Oh, okay. In that case he can use RandomRange(1,2) :) :spot:

Dynamite

2012-01-19 21:01:37

From: Yanhua
Oh, okay. In that case he can use RandomRange(1,2) :) :spot:


Indeed :) <3

-Boom

Chris

2012-01-20 12:02:26

From: Dynamite
case Random(2) of
0: begin
Mouse(x,y,0,0,False);
wait(1000);
ChooseOption('Use')
end;
1: Mouse(x,y,0,0,True);
end;

Is what you want I think :)

-Boom


case Random(2) of
0: begin
Mouse(x,y,3,3,False);
wait(800 + random(400));
ChooseOption('Use');
end;
1: Mouse(x,y,3,3,True);
end;

This would be best :p