WT-Fakawi
2006-10-07 20:03:39
Following up on my idea of Remote Control, here is a first release of RC.scar. It enables ingame communication between the Controller(you) and the Slave (the autoer on a remote machine).
Instructions:
Outline:
RC handles all communication between you and the autoer. It works as follows:
It scans for the red color (128) in the chat window, so call it regularly (in FTWait f.i.)
If it finds color 128, it turns off public chat.
If it next finds RCMaster, it waits 60 seconds for one of two commands:
Status.
If it recieves the command status it will return a chat containing the Players.nick of False players. For instance "oko ada iop', meaning Players: brokobando, snadawing and kwiopuity are currently False.
Reset.
If it recieves the command reset it will set all Players to True, thus getting them back into business. :)
After recieving one of those commands, RC will now sleep for 5 minutes.
Note:
This is still very experimental, but afaik it works flawless. Please test this ingame. There are still a couple of problems: RC sleeps because the red color has to dissapear from the chat window first in order to prevent going into endless RC-loop. Need to work on that.
AddAllToFriendsList.scar is a small program that makes friends to everybody in your army.
Enjoy, and post suggestions.
Instructions:
- Set Split Private Chat Off.
- Set Private Chat to Friends.
- Make sure you are on each others friend list. (script attached: see below…)
- include RC.scar in your script. (Will be standard included in 3.5)
- set the (global) string RCMaster at script-startup. This is the Controller Nick Name (you). Take three letter from your runescape name (not the first) i.e. RCMaster:='awi';
- Call RC.
Outline:
RC handles all communication between you and the autoer. It works as follows:
It scans for the red color (128) in the chat window, so call it regularly (in FTWait f.i.)
If it finds color 128, it turns off public chat.
If it next finds RCMaster, it waits 60 seconds for one of two commands:
- status
- reset
Status.
If it recieves the command status it will return a chat containing the Players.nick of False players. For instance "oko ada iop', meaning Players: brokobando, snadawing and kwiopuity are currently False.
Reset.
If it recieves the command reset it will set all Players to True, thus getting them back into business. :)
After recieving one of those commands, RC will now sleep for 5 minutes.
Note:
This is still very experimental, but afaik it works flawless. Please test this ingame. There are still a couple of problems: RC sleeps because the red color has to dissapear from the chat window first in order to prevent going into endless RC-loop. Need to work on that.
AddAllToFriendsList.scar is a small program that makes friends to everybody in your army.
Enjoy, and post suggestions.
//----------------------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- ยป Remote Control Routines Beta --//
//----------------------------------------------------------------------------//
var
RCMaster: string; // Master Player (Controller) User Nick
var
MasterBitMapMask, RCTimeMark: integer;
{*******************************************************************************
function RCReadCommand: String;
by: WT-Fakawi
Description: Returns string of red typed message (color 128)
*******************************************************************************}
function RCReadCommand:string;
begin
Result:= lowercase(trim(GetTextAtEx(20, 415, 45, SmallChars, False, False, 0, 2, 128, 45, False, tr_NormalChars)));
end;
{*******************************************************************************
procedure RCMakeNick;
by: WT-Fakawi
Description: Creates MasterBitMapMask for recognisition
*******************************************************************************}
procedure RCSetNick;
begin
MasterBitMapMask:=CreateBitMapMaskFromText(RCMaster, smallChars);
end;
{*******************************************************************************
function RCFindMaster(var Mx, My: Integer; X1, Y1, X2, Y2: Integer): Boolean;
by: WT-Fakawi
Description: Finds MasterBitMapMask (Master Name) and returns its coordinates
in Mx and My.
Could be usefull also for friend-finding.
*******************************************************************************}
function RCFindMaster(var Mx, My:integer; X1, Y1, X2, Y2:integer):boolean;
begin
Result:= FindBitmapMaskTolerance(MasterBitMapMask, Mx, My, X1, Y1, X2, Y2, 50, 10)
end;
{*******************************************************************************
function RCHowManyOnline: Integer;
by: WT-Fakawi
Description: Returns the number of online Friends.
*******************************************************************************}
function RCHowManyOnline:integer;
var i, frX, frY, incY:integer;
begin
for i := 1 to 12 do
begin
If FindColor (frX,frY, 65280, 667, 235 + incY, 672, 243 + incY) or // green - same world
FindColor (frX, frY, 65535, 667, 235 + incY, 672, 243 + incY) then // yellow - different world
Result:=Result + 1;
incY := incY + 15;
end;
end;
{*******************************************************************************
function RCFindFriend: String;
by: WT-Fakawi
Description: Returns the name of the First Friend in the FriendList
*******************************************************************************}
function RCFindFriend:string;
begin
Result := lowercase(trim(GetTextAtEx(562, 233, 45, SmallChars, True, False, 0, 2, 16777215, 20, False, tr_NormalChars)));
end;
{*******************************************************************************
function RCPrivateMessageColorFound: Integer;
by: WT-Fakawi
Description: Returns True if Color 128 (red) was found in ChatWindow.
*******************************************************************************}
function RCPrivateMessageColorFound:Boolean;
var dumX,dumY:integer;
begin
Result:= FindColor(dumX,dumY,128,MCX1,MCY1,MCX2,MCY2);
end;
{*******************************************************************************
function ReturnStatus: String;
by: WT-Fakawi
Description: Returns a concatenated string with the False Player Names.
If you feel this is too suspicious, use Players.nick (recommended)
*******************************************************************************}
function RCReturnStatus:string;
var i:integer;
var PlayersString:string;
var oneFalse: boolean;
begin
for i := 0 to HowManyPlayers-1 do
begin
if Players[i].Active=False then
begin
// insert(Players[i].Name,PlayersString,0);
insert(Players[i].Nick,PlayersString,0);
insert(' ', PlayersString, 0);
oneFalse:=True;
end;
end;
Result:=PlayersString;
If not oneFalse then Result:='Everything is cool.';
end;
{*******************************************************************************
procedure ResetStatus;
by: WT-Fakawi
Description: Resets the Status of ALL Players to True
*******************************************************************************}
procedure RCResetStatus;
var i:integer;
begin
for i := 0 to HowManyPlayers-1 do
begin
Players[i].Active:=True;
end;
end;
{*******************************************************************************
procedure RC;
by: WT-Fakawi
Description: High Level Remote Control Command. Handles Remote Control.
Works as follows:
Checks for existence of red color in chat window.
If red color is found, it checks for the existence of the MasterBitMapMask.
If found it waits 60 seconds for pm "status" or pm "reset".
Then RC sleeps five minutes to get rid of the red text.
*******************************************************************************}
procedure RC;
var Masx, Masy, RCMark:integer;
begin
if RCPrivateMessageColorFound then // check for Color 128
begin
if TimeFromMark(RCTimeMark) > 300000 then // check once every five minutes
begin
MasterBitMapMask:=CreateBitMapMaskFromText(RCMaster,smallChars);
MarkTime(RCTimeMark);
SetChat('off',1);
if RCFindMaster(Masx,Masy,MCX1,MCY1,MCX2,MCY2) then // check for MasterBitMapMask
begin
writeln('enter RC');
MarkTime(RCMark);
GameTab(8);
if RCHowManyOnline <> 0 then
begin
RCFindMaster(Masx,Masy,MIX1,MIY1,MIX2,MIY2);
Mouse(Masx+2, Masy+2, 10, 0, true);
TypeSend('hi');
Repeat // wait 60 secs for command
if RCReadCommand = 'status' then
begin
Wait(1000+Random(500));
RCFindMaster(Masx,Masy,MIX1,MIY1,MIX2,MIY2);
Mouse(Masx+2, Masy+2, 10, 0, true);
TypeSend(RCReturnStatus);
SetChat('on',1);
SetChat('on',1); // hmm lets fix that :)
writeln('exit RC status');
FreeBitMap(MasterBitMapMask);
Exit;
end;
if RCReadCommand = 'reset' then
begin
GameTab(8);
Wait(1000+Random(500));
RCResetStatus;
RCFindMaster(Masx,Masy,MIX1,MIY1,MIX2,MIY2);
Mouse(Masx+2, Masy+2, 10, 0, true);
TypeSend('reset');
SetChat('on',1);
SetChat('on',1);
writeln('exit RC reset');
FreeBitMap(MasterBitMapMask);
Exit;
end;
wait(1000);
until (TimeFromMark(RCMark)>60000);
end;
end
writeln('exit RC eof RC');
SetChat('on',1);
SetChat('on',1);
FreeBitMap(MasterBitMapMask);
end;
end;
end;