Shuttleu
2008-06-01 01:13:10
right well i went about trying to find a way to get the rc working and the only way i could think of doing it was by using bitmap masks
so i created a set of bitmap masks that will work with the friend list
then i thought that i might as well get the RC working at the same time so i did and here it is
and below is the chars which you just simply put the extracted folder into the fonts folder in the scar directory :)
EDIT:i have re uploaded the chars with working ones that i have tested
~shut
so i created a set of bitmap masks that will work with the friend list
then i thought that i might as well get the RC working at the same time so i did and here it is
//----------------------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- ยป Remote Control Routines Beta --//
//----------------------------------------------------------------------------//
// * function RCReadCommand: String; // * by WT-Fakawi
// * procedure RCSetNick; // * by WT-Fakawi
// * function RCFindMaster(var Mx, My: Integer; X1, Y1, X2, Y2: Integer): Boolean; // * by WT-Fakawi
// * function RCHowManyOnline: Integer; // * by WT-Fakawi
// * function RCFindFriend: String; // * by WT-Fakawi
// * function RCPrivateMessageColorFound: Boolean; // * by WT-Fakawi
// * function ReturnStatus: String; // * by WT-Fakawi
// * procedure RCResetStatus; // * by WT-Fakawi
// * function RC: Boolean; // * by WT-Fakawi
{ var RCMaster: String;
Description: Master Player (Controller) User Nick. }
var
RCMaster, RCLoc: string;
{ var MasterBitMapMask, RCTimeMark: Integer;
Description: Variables used in the Remote Control include. }
var
MasterBitMapMask, FriendChars, RCTimeMark: Integer;
const
RCStatus = 'status'; // commands the RCMaster types.
RCReset = 'reset'; // may be replaced by anything less suspicious
RCStop = 'stop';
RCLogOut = 'logout';
{*******************************************************************************
function RCReadCommand: String;
by: WT-Fakawi
Description: Returns string of red typed message (color 128)
*******************************************************************************}
function RCReadCommand: string;
var LC:TPoint;
begin
LC:= TextCoords(8);
Result := LowerCase(Trim(GetTextAtEx(LC.x - 2, LC.y - 2, 45, SmallChars, False, False, 0,
2, 128, 45, False, tr_NormalChars)));
end;
{*******************************************************************************
procedure RCSetNick;
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 (fixed by Shuttleu)
Description: Returns the name of the First Friend in the FriendList
*******************************************************************************}
function RCFindFriend: string;
begin
FriendChars:=(LoadChars2(AppPath+'Fonts\FriendChars\'));
Result := LowerCase(Trim(GetTextAtEx(556, 231, 45, FriendChars, True, False, 0,
2, 16777215, 20, False, tr_NormalChars)));
end;
{*******************************************************************************
function RCPrivateMessageColorFound: Boolean;
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, MCX1 + 30, 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;
PlayersString: string;
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(' ', PlayersString, 0);
oneFalse := True;
end;
end;
Result := PlayersString;
if not oneFalse then Result := 'Everything is cool.';
end;
{*******************************************************************************
procedure RCResetStatus;
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
if Players[i].Active = False then
begin
Players[i].Active := True;
if RCLoc <> '' then
Players[i].Loc := RCLoc;
end;
end;
end;
{*******************************************************************************
function RC: Boolean;
by: WT-Fakawi (fixed by Shuttleu)
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.
*******************************************************************************}
function RC: Boolean;
var
Masx, Masy, RCMark: Integer;
begin
FriendChars:=(LoadChars2(AppPath+'Fonts\FriendChars\'));
if (Trim(RCMaster) = '') then Exit;
if RCPrivateMessageColorFound then // check for Color 128
begin
RunControl(False);
Result := True;
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
MarkTime(RCMark);
GameTab(8);
if RCHowManyOnline <> 0 then
begin
IsTextInAreaEx(MIX1, MIY1, MIX2, MIY2, masx, masy, Capitalize(RCMaster), 5, FriendChars, false, false, 0, 0, 16777215);
Mouse(Masx + 2, Masy + 2, 10, 0, True);
TypeSend('hi');
repeat // wait 60 secs for command
if RCReadCommand = RCStatus then
begin
Wait(1000 + Random(500));
IsTextInAreaEx(MIX1, MIY1, MIX2, MIY2, masx, masy, Capitalize(RCMaster), 5, FriendChars, false, false, 0, 0, 16777215);
Mouse(Masx + 2, Masy + 2, 10, 0, True);
TypeSend(RCReturnStatus);
SetChat('on', 1);
SetChat('on', 1); // hmm lets fix that :)
FreeBitmap(MasterBitMapMask);
Exit;
end;
if RCReadCommand = RCReset then
begin
GameTab(8);
Wait(1000 + Random(500));
RCResetStatus;
IsTextInAreaEx(MIX1, MIY1, MIX2, MIY2, masx, masy, Capitalize(RCMaster), 5, FriendChars, false, false, 0, 0, 16777215);
Mouse(Masx + 2, Masy + 2, 10, 0, True);
TypeSend('reset');
SetChat('on', 1);
SetChat('on', 1);
FreeBitmap(MasterBitMapMask);
Exit;
end;
if RCReadCommand = RCLogout then
begin
Logout;
FreeBitmap(MasterBitMapMask);
Exit;
end;
if RCReadCommand = RCStop then
begin
TerminateScript;
end;
Wait(1000);
until (TimeFromMark(RCMark) > 20000);
end;
end;
SetChat('on', 1);
SetChat('on', 1);
FreeBitmap(MasterBitMapMask);
end;
end;
end;
and below is the chars which you just simply put the extracted folder into the fonts folder in the scar directory :)
EDIT:i have re uploaded the chars with working ones that i have tested
~shut