SRL Archive - SRL Archives

Friend list chars and RC Master (fixed)


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


//----------------------------------------------------------------------------//
//-- 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

Bobarkinator

2008-06-01 15:24:24

When did RC stop working?

Shuttleu

2008-06-01 15:39:27

From: Bobarkinator
When did RC stop working?

RC stopped working when jages updated the friends list about a month ago (i think)
and they are using a font that is being used no where else in the game

~shut

Wizzup?

2008-06-02 10:32:12

You should get Freddy1990 to add these to SCAR.

ZephyrsFury

2008-06-02 10:39:38

Yup, perhaps post on his forums. :)

Bobarkinator

2008-06-02 13:44:58

Adding them to SCAR seems to make them to static. We would need a SCAR update if it broke. Remember when we added MSX1, MSY1, etc. to SCAR? Jagex changed them.

Shuttleu

2008-06-02 13:52:14

From: Bobarkinator
Adding them to SCAR seems to make them to static. We would need a SCAR update if it broke. Remember when we added MSX1, MSY1, etc. to SCAR? Jagex changed them.

add them to srl?

although that would mean alot of files for subversion to download

but think about it we have gone about a month without them anyway

~shut

mastaraymond

2008-06-02 13:53:35

From: Bobarkinator
Adding them to SCAR seems to make them to static. We would need a SCAR update if it broke. Remember when we added MSX1, MSY1, etc. to SCAR? Jagex changed them.

The other charsets are also in SCAR, I don't see the problem?

Bobarkinator

2008-06-02 13:59:01

Ah ok, the characters, I thought he meant the whole thing.

Shuttleu

2008-06-02 14:02:37

From: Bobarkinator
Ah ok, the characters, I thought he meant the whole thing.

what did you think they ment the whole rc function?

~shut

Freddy1990

2008-06-02 14:59:19

From: Bobarkinator
Adding them to SCAR seems to make them to static. We would need a SCAR update if it broke. Remember when we added MSX1, MSY1, etc. to SCAR? Jagex changed them.


We didn't add those to SCAR, I did, I was stupid enough to do so back then, now I'm banning pretty much any rs specific stuff from SCAR, but I'll add the chars.

Shuttleu

2008-06-02 15:02:18

From: Freddy1990
I'm banning pretty much any rs specific stuff from SCAR, but I'll add the chars.

yay thank you
at last something i have made will be with everyone that downloads scar
im soo happy

~shut

Shuttleu

2009-04-30 20:40:49

bump!
just wondering if this is going to be added now that scar has the FriendChars preinstalled

~shut

ZephyrsFury

2009-05-01 11:24:40

From: Shuttleu
bump!
just wondering if this is going to be added now that scar has the FriendChars preinstalled

~shut


Oh yeah, I'll try adding it later. It will only work with SCAR 3.20b. So anyone using these functions in a script would have to make sure anyone using their script has 3.20b.

Shuttleu

2009-05-01 19:58:53

well freddy hasnt made it so that it loads the charsets when scar loads so it doesnt matter if you dont have scar 3.20 becuase of the way that it loads the charsets

~shut