SRL Archive - SRL Archives

[REJECTED] New 'GameTab' function!


Harry

2008-05-11 21:27:42

I was really bored today, so I wrote this up. It is GameTab with a loooot more randomness, and it has never misclicked for me :) Try it out! Hopefully this can be added into SRL :D

{*******************************************************************************
function GameTab(tabnumber: Integer): Boolean;
By: Mr. Clown
Description: Switches between tabs.
*******************************************************************************}

function GameTab(tabnumber: Integer): Boolean;
var
c,t,tx,ty: Integer;
begin
if ((Tabnumber < 1) or (TabNumber > 15)) then
begin
srl_Warn('GameTab', IntToStr(tabnumber) + ' is not a valid GameTab', warn_AllVersions);
Result := False;
Exit;
end;
if not TabExists(tabnumber) then
begin
srl_Warn('GameTab', IntToStr(tabnumber) + ' does not exist', warn_AllVersions);
Result := False;
Exit;
end;
if tabnumber <> GetCurrentTab then
case Tabnumber of
1: MouseBox(528,171,554,198,3);
2: MouseBox(564,171,589,198,3);
3: MouseBox(598,171,622,198,3);
4: MouseBox(630,171,653,198,3);
5: MouseBox(663,171,687,198,3);
6: MouseBox(696,171,720,198,3);
7: MouseBox(729,171,760,198,3);
8: MouseBox(564,469,590,499,3);
9: MouseBox(597,469,622,499,3);
10: MouseBox(629,469,656,499,3);
11: MouseBox(662,469,689,499,3);
12: MouseBox(696,469,721,499,3);
13: MouseBox(729,469,758,499,3);
14: MouseBox(743,3,762,23,3);
15: MouseBox(527,469,555,499,3);
end;
while not(GetCurrentTab = tabnumber) and (c < 4) do
Begin
GetMousePos(tx,ty);
Mouse(tx,ty,0,0,True); // MouseBox has already added randomness ;)
Inc(c);
Wait(Random(100));
end;
t := GetCurrentTab;
Result := (t = tabnumber);
if t <> Tabnumber then
srl_Warn('GameTab', 'Failed to switch to tab'+ IntToStr(tabnumber), warn_AllVersions);
end;

Thanks for reading…
~ Harry

GoF

2008-05-12 15:09:27

Hy71194 sanoo:
Http://www.srl-forums.com/forum/new-gametab-function-t32865.html bump it

lol k noob.

Nice.

Zezi

2008-05-12 15:59:15

Updated, thanks.
It looked really bannable before?? I wonder why that was? :S

Tyvm. ++ rep

EvilChicken!

2008-05-12 17:34:54

Good job, Harry. If you don't mind, I think I improved the code slightly. (I don't care about credits, just replace the function on the fisrt post with this one if you agree.) If current gametab fuction won't be replaced with this, I'll implement this into my script by myself.

{*******************************************************************************
function GameTab(TabNumber: Integer): Boolean;
By: Starblaster100 and Hy71194.
Description: Switches between tabs.
*******************************************************************************}

function GameTab(TabNumber: Integer): Boolean;
var
TX, TY: Integer;
T, C: Byte;

begin
if not InRange(Tabnumber, 1, 15) then
begin
srl_Warn('GameTab', IntToStr(tabnumber) + ' is not a valid GameTab', warn_AllVersions);
Result := False;
Exit;
end;
if not TabExists(TabNumber) then
begin
srl_Warn('GameTab', IntToStr(TabNumber) + ' does not exist', warn_AllVersions);
Result := False;
Exit;
end;
if TabNumber = GetCurrentTab then
begin
Result := True;
Exit;
end;
case Tabnumber of
1: MouseBox(528, 171, 554, 198, 3);
2: MouseBox(564, 171, 589, 198, 3);
3: MouseBox(598, 171, 622, 198, 3);
4: MouseBox(630, 171, 653, 198, 3);
5: MouseBox(663, 171, 687, 198, 3);
6: MouseBox(696, 171, 720, 198, 3);
7: MouseBox(729, 171, 760, 198, 3);
8: MouseBox(564, 469, 590, 499, 3);
9: MouseBox(597, 469, 622, 499, 3);
10: MouseBox(629, 469, 656, 499, 3);
11: MouseBox(662, 469, 689, 499, 3);
12: MouseBox(696, 469, 721, 499, 3);
13: MouseBox(729, 469, 758, 499, 3);
14: MouseBox(743, 3, 762, 23, 3);
15: MouseBox(527, 469, 555,499, 3);
end;
Wait(20 + random(50));
while not (GetCurrentTab = TabNumber) and (c < 4) do
begin
GetMousePos(TX, TY);
Mouse(TX, TY, 0, 0, true);
Inc(C);
Wait(25 + random(100));
end;
T := GetCurrentTab;
Result := (T = TabNumber);
if T <> Tabnumber then
srl_Warn('GameTab', 'Failed to switch to tab'+ IntToStr(TabNumber), warn_AllVersions);
end;

Harry

2008-05-12 22:10:05

@EvilChicken: It needs to check if the tab is already current before it moves its mouse, or it fails (I think you don't check it… it is late here and I am tired…)

itSchRis917

2008-05-13 01:51:59

EvilChicken's checks it:

if TabNumber = GetCurrentTab then
begin
Result := True;
Exit;
end;

Markus

2008-05-24 14:34:38

Doesn't the old one look 200 times as neat?

Harry

2008-05-24 22:04:42

I don't know - how about you let me access the Developer Repos to let me see? (jk) How about you post the new one Markus :)

Wizzup?

2008-05-25 05:16:11

The current Gametab is the same as in #16, which is why Markus said 'old'.
I was planning on modifying it, and I'll post the new version here, when I finish it.

Harry

2008-05-25 11:23:31

Oh.. though he meant the old one as in the one in the Developer Repos.

Yes, the old one looks more neat, but does neatness really matter based on detectably, and efficientness?

Best of luck on the new one you are writing Wizzup? :)

SKy Scripter

2008-05-27 04:21:31

Nice function but this will not be necessary in SRL. :)

-Closed.