SRL Archive - Research & Development Lounge

GameTab + GameTab2 - Hotkeys


Sandstorm

2008-10-28 22:38:15

{*******************************************************************************
function GameTab(tabnumber: Integer): Boolean;
By: Starblaster100 - Edited by Sandstorm to use a random selection of hotkeys or mouse (1-7)
Description: Switches between tabs.
*******************************************************************************}

function GameTab(tabnumber: Integer): Boolean;
var
c, x: Integer;
Coords: TPoint;
begin
if ((Tabnumber < 1) or (TabNumber > 15)) then
begin
Result := False;
Exit;
end;
if not TabExists(tabnumber) then
begin
exit;
end else if (tabnumber <= 7) then
Case 2-random(2) of
1: begin
KeyDown(111+Tabnumber)
wait(30+random(40))
KeyUp(111+Tabnumber)
wait(300+random(250))
end;

2: begin
Coords := Point(540 + ((tabnumber -1) * 33), 185);
Mouse(Coords.x, Coords.y, 8, 8, true);
end;
end else if (tabnumber = 14) then
Coords := Point(752, 12)
else if (tabnumber = 15) then
Coords := Point(538, 485)
else
Coords := Point(540 + ((tabnumber mod 7) * 33), 485);
while not(GetCurrentTab = tabnumber) and (c < 4) do
Begin
Mouse(Coords.x, Coords.y, 8, 8, true);
Inc(c);
end;
Result := (GetCurrentTab = tabnumber);
end;

What it does:

Randomly chooses whether to use the mouse or a hotkey, then applies it's choice.

Advantages (This is MY opinion!):


Looks more like a human. I find a lot of people use hotkeys, and I personally do as well. I found in my clan that at least 50-75% used hotkeys.

Any feedback? Also, is there a way to time how long you hold a key down? I'd like to edit the waits :P.

The_Shermanator

2008-10-28 23:33:51

Might be useful if you added it randomly use a hot key or click, IMO that would be much more better.

-Shermanator

Sandstorm

2008-10-29 00:23:39

Will do. Thanks for the suggestion. I finally get to learn if I know cases or not :P.

Sandstorm

2008-10-29 17:45:25

Sorry for the double post, but thanks for the suggestion Shermanator. Edited it (took a bit, since I ran into some technical difficulties, I forgot the final End; on the case :P), but it should now successfully choose one of the two on it's own :).

Edited version is in the first post and here:


{*******************************************************************************
function GameTab(tabnumber: Integer): Boolean;
By: Starblaster100 - Edited by Sandstorm to use a random selection of hotkeys or mouse (1-7)
Description: Switches between tabs.
*******************************************************************************}


function GameTab(tabnumber: Integer): Boolean;
var
c, x: Integer;
Coords: TPoint;
begin
if ((Tabnumber < 1) or (TabNumber > 15)) then
begin
Result := False;
Exit;
end;
if not TabExists(tabnumber) then
begin
exit;
end else if (tabnumber <= 7) then
Case 2-random(2) of
1: begin
KeyDown(111+Tabnumber)
wait(30+random(40))
KeyUp(111+Tabnumber)
wait(300+random(250))
end;

2: begin
Coords := Point(540 + ((tabnumber -1) * 33), 185);
Mouse(Coords.x, Coords.y, 8, 8, true);
end;
end else if (tabnumber = 14) then
Coords := Point(752, 12)
else if (tabnumber = 15) then
Coords := Point(538, 485)
else
Coords := Point(540 + ((tabnumber mod 7) * 33), 485);
while not(GetCurrentTab = tabnumber) and (c < 4) do
Begin
Mouse(Coords.x, Coords.y, 8, 8, true);
Inc(c);
end;
Result := (GetCurrentTab = tabnumber);
end;

The_Shermanator

2008-10-31 00:58:35

Looks very nice Sand Storm! You should apply for members soon!
If you need any help with anything add me on MSN :)
[email]whiteboysherman@hotmail.com[/email]

-Shermanator

Nava2

2008-10-31 17:42:47

By the way, the reason this isn't implemented is because when you press an FKey, SMART likes to type random letters. Just so you know ;).

Sandstorm

2008-10-31 17:58:25

Learned of that two days after it was edited :(. Anyways, if someone will move it to Public Test Corner, that'd be appreciated.

Nava2

2008-11-01 01:18:35

Sorry to bring it up m8!:(

Sandstorm

2008-11-01 09:02:35

Nah, not a problem. I'd still like it to be moved though, so people who want to use it, can.

ZephyrsFury

2008-11-01 10:33:48

Moved on request. :)

Sandstorm

2008-11-01 11:59:42

Thank you Zephyr. Appreciate it.