PDA

View Full Version : RandomDir and ScrewyCompas



rotflmfwao
07-12-2007, 07:39 PM
I dunno if these are already made, but if they are, Sorry! XD

I made RandomDir so I could use it as an antiban function --
eg - MakeCompas(RandomDir);
I made ScrewyCompas for the same reason (I realize I could have made it a LOT more efficient and shorter, but it was a spur of the moment idea...)
eg - ScrewyCompas;

Here they are:
RandomDir
Function RandomDir: String;
Begin
Case (random(4)) of
0: Result:='n';
1: Result:='s';
2: Result:='e';
3: Result:='w';
End;
End;

ScrewyCompas
Procedure ScrewyCompass(arrowkey:String; moveback:Boolean);//up, down, left, right, or ran
Var HoldingTime, WaitTime, RanDir, OppRanDir:Integer;
Begin
if(not(LoggedIn))then
Exit;
HoldingTime:= 500+random(1000);
WaitTime:= 500+random(250);
RanDir:= random(4);
Case (RanDir) of
0: OppRanDir:=2
1: OppRanDir:=3
2: OppRanDir:=0
3: OppRanDir:=1
End;
Case (arrowkey) of
'up': SendArrowWait(0,HoldingTime);
'down': SendArrowWait(2,HoldingTime);
'left': SendArrowWait(3,HoldingTime);
'right': SendArrowWait(1,HoldingTime);
'ran': SendArrowWait(RanDir,HoldingTime);
End;
If (moveback) Then
Begin
Wait(WaitTime);
Case (arrowkey) of
'up': SendArrowWait(2,HoldingTime);
'down': SendArrowWait(0,HoldingTime);
'left': SendArrowWait(1,HoldingTime);
'right': SendArrowWait(3,HoldingTime);
'ran': SendArrowWait(OppRanDir,HoldingTime);
End;
End;
End;


BTW, ima try to make screwy compass more efficient, brb if I can XD

itSchRis917
07-12-2007, 07:54 PM
Here's my screwy compass At the end it fixes the compass again to N and highest angle.


Procedure ScrewyCompass;
begin
Case Random(10) Of
0: begin
SendArrowWait(1, 250+Random(50));
SendArrowWait(2, 100+Random(30));
end;

1 : begin
SendArrowWait(3, 1500+Random(150));
end;

2 : begin
SendArrowWait(2, 500+Random(250));
SendArrowWait(1, 2000+Random(500));
end;
3 : SendArrowWait(1, 3000+Random(400));

4 : SendArrowSilentWait( ((Random(2) * 2) + 1), 1000 + Random(200));

5 : SendArrowSilentWait( ((Random(2) * 2) + 1), 200 + Random(200));

6 : SendArrowSilentWait( ((Random(2) * 2)), 200 + Random(200));

7 : SendArrowSilentWait( ((Random(2) * 2) + 1), 20 + Random(20));

8 : SendArrowSilentWait( ((Random(2) * 2)), 20 + Random(20));

9 : SendArrowSilentWait( ((Random(2) * 2)), 1000 + Random(200));

end;
MakeCompass('N');
HighestAngle;
end;

rotflmfwao
07-12-2007, 08:09 PM
Nice, I made mine so it returns it the way it was before though, not just to north XD

BTW, here's my compressed(lol?) ScrewyCompass:
Program FunkyXD;

{.include SRL/SRL.scar}
Procedure ScrewyCompass(arrow: String; moveback: Boolean);
Begin
Var
i, q :Integer;
Const
hold:=(500+random(1000));
Begin
if(not(LoggedIn))then Exit;
End;
Case arrow of
'up': i:=0;
'down': i:=2;
'left': i:=3;
'right': i:=1;
'ran': i:=random(4);
End;
Case i of
0,2,3: q:=abs(i-2);
1: q:=(i+2);
End;
Case moveback of
False: SendArrowWait(i,hold);
True: Begin
SendArrowWait(i,hold);
Wait(hold);
SendArrowWait(q,hold);
End;
End;
End;

itSchRis917
07-12-2007, 08:16 PM
Nice. The compressed one looks much better.

rotflmfwao
07-13-2007, 02:07 AM
Ty :D I feel appreciated XD

itSchRis917
07-13-2007, 04:55 AM
I like the way you made it rotate back to the original spot. XD Nice.

Edit: I was thinking about other possible ways to move the compass back to the original spot, and here's what I have come up with. I dont know if anyone else has come up with a procedure like this or not. Sorry if you have! It's a bit more mathematical than your way rotflmfwao.



Function AngleCompass(Angle:integer):Boolean;
Var
Ax, Ay, AMark:Integer;
Begin
MarkTime(AMark);

Ax:= Round( 6 * Sin (Angle * Pi / 180))+ 566;
Ay:= Round(-6 * Cos (Angle * Pi / 180))+ 20;

KeyDown(VK_Left);

repeat
Wait(10+random(5));
If(FindColor(x, y, 723587, Ax, Ay, Ax, Ay))then
Begin
Result:=true;
break;
End;
Until(TimeFromMark(AMark) > 10000);
KeyUp(VK_Left);
End;


And then all you would need to do is place:


CurrentAngle:=FindCompassAngle;

at the beginning of your screwy compass procedure.

And then at the end just place:


AngleCompass(CurrentAngle);


Again, sorry if someone has already made this!

BobboHobbo
07-13-2007, 05:40 AM
Good idea, nd good job.

itSchRis917
07-13-2007, 05:45 AM
Thanks. :D

rotflmfwao
07-13-2007, 05:37 PM
It is more mathematical, but it is more complex and therefore leaves more room for error. I like it though :D nice math-ing.(omgwtf?)

itSchRis917
07-13-2007, 06:48 PM
Not really, because its all mathematical. There's no room for error unless your computer or SCAR cant perform basic math functions. :D