SRL Archive - SRL Bugs

Left/Right keycodes


Shatterhand

2012-03-20 14:49:12

I have a simple RotateCam function, but recently its not working well. It rotates the cam only one direction (right). VK_LEFT works as VK_RIGHT.

procedure RotateCam;
begin
ActivateClient;
case Random(1) of
0:
begin
Wait(100 + random(50));
KeyDown(VK_RIGHT);
Wait(500 + random(1000));
KeyUp(VK_RIGHT);
Wait(500 + random(1000));
end;
1:
begin
Wait(100 + random(50));
KeyDown(VK_LEFT);
Wait(500 + random(1000));
KeyUp(VK_LEFT);
Wait(500 + random(1000));
end;
end;
end;

Mushini

2012-03-20 14:59:28

LOL - I didn't think I was going to figure this out.
I figured it out.. I did not pay close attention at first.
You have 2 case possibilities but are only telling case to pick from 1 possibility (from 0 to 0);
Try Random(2)

eska

2012-03-20 15:00:30

There are already function that do this built in SRL.

Your function was working before?

E: ninja'd by OP big time.

Sex

2012-03-20 15:01:21

Random(1) will always return 0. You need to change it to Random(2) which will return either 0 or 1.

Edit: :ninja:'d.

Shatterhand

2012-03-20 15:10:43

Oooh my bad, you are right guys. Thanks. :D