SRL Archive - SRL Archives

RC.scar


Naike

2009-06-02 00:27:02

Almost rewrote RC.scar, left 2 orginal procedures…

And before i go on, Yes. This will break old scripts using the old RC.
It would be to much of a restriction to make it fit with all those old ones,
so i simply didn't even bother.

Special thanks to Shuttleu for making FriendChars.

Made new features such as
  • Multiplie Masters
  • Multiplie triggers
  • Supports Players[].Loc setback
  • Added a custom one, which uses user-defined procs.

Becuase of the user-defined proc, I had to do a slight update to Globals.scar.
Only added a Const ( srl_OnCustomRC ) and made the SRL_Procs array +1 length.

How to use:
Been a slight change since the last one, Now you have to call SetupRC(Masters: TStringArray)
after Declareplayers which have to include your masters in a TStringArray.

When logging in for the first time on every account you might want to call
RC_SetStandards.
It sets your account settings so it can be used with RC.scar, if you fail to do
so then it might not work.

Other then that, it's the same.




Default triggers are:

These will type back the Status aka Players active.
status
check
hows it going


These will reset all the current players active to true and reset their
old .Loc string.
reset

back from square one
rewind


Will logout and terminate the script.
stop
enough
come outside


Makes the current account logout, just like that.
logout
log


Will call your user-defined proc.
that thing
hey
remember


There can easily be added/removed triggers by going inside RC.scar and
basicly change them.


RC.scar

//----------------------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- ยป Remote Control Routines Beta --//
//----------------------------------------------------------------------------//
// * Procedure RC_SetStandards; // * by N1ke!
// * Function RCReadCommand: String; // * by WT-Fakawi
// * function RC_MasterCalls(var RC_S: String): Boolean; // * by N1ke!
// * function RC_PMFound: Boolean; // * by N1ke!
// * Function RC_Busy: Boolean; // * by N1ke!
// * function RC_ReturnStatus: string; // * by N1ke!
// * Procedure RC_FixFL; // * by N1ke!
// * Function RC_MasterOnline(Var MasterCords: TPoint; Master: String): Boolean; // * by N1ke!
// * Function RC_TakeAction(AN: Integer; RC_Master: String): Boolean; // * by WT-Fakawi
// * function RC: Boolean // * by WT-Fakawi Rewritten by N1ke!
// * Procedure SetupRC(Masters: TStringArray); // * by N1ke!



Type
RC_Action = Record
Triggers: TStringArray;
Action: Integer;
end;

var
RC_Actions: Array [0..4] of RC_Action;
RC_Masters: TStringArray;
RC_TSL, RC_FriendChars: Integer;
RC_InUse: Boolean;
RC_StartLocs: TStringArray;

{*******************************************************************************
Procedure RC_SetStandards;
by: N1ke!
Description: Sets your account settings so that you can use the
features in RC.Scar.
*******************************************************************************}
Procedure RC_SetStandards;
begin
SetChat('hide', 1);
SetChat('friends', 2);

If Not GameTab(11)then
Exit;

Wait(175+Random(120));
If (GetColor(678, 341) = 987203) then
Mousebox(684, 344, 713, 372, 1);
end;

{*******************************************************************************
function RCReadCommand: String;
by: WT-Fakawi Small fix by N1ke!
Description: Returns string of red typed message (color 128)
*******************************************************************************}
function RC_ReadCommand: 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;

{*******************************************************************************
function RC_MasterCalls(var RC_S: String): Boolean;
by: N1ke!
Description: Checks if it's a master typing to you and if so it will
get the masters name.
*******************************************************************************}
function RC_MasterCalls(var RC_S: String): Boolean;
var
S: String;
I, H: Integer;
begin
S := LowerCase(GetChatBoxText(8, clBlack));
H := High(RC_Masters);
For I:= 0 to H do
If Pos(RC_Masters[I], S) > 0 then
begin
Result := True;
Delete(S, 1, 5);
Delete(S, Length(S), Length(S));
RC_S := S;
Exit;
end;
end;

{*******************************************************************************
function RC_PMFound: Boolean;
by: WT-Fakawi
Description: Returns True if Color 128 (red) was found in ChatWindow.
*******************************************************************************}
Function RC_PMFound: Boolean;
var
dumX, dumY: Integer;
begin
Result := FindColor(dumX, dumY, 128, MCX1, MCY1, MCX1 + 30, MCY2);
end;

{*******************************************************************************
Function RC_Busy: Boolean;
by: N1ke!
Description: Checks if you've done a trigger in the last 5 mins.
*******************************************************************************}
Function RC_Busy: Boolean;
begin
Result := (GetSystemTime - RC_TSL < 60000*5);
end;

{*******************************************************************************
function RC_ReturnStatus: string;
by: N1ke!
Description: Returns how many players are active.
If every player is active it results "Everything is cool."
*******************************************************************************}
function RC_ReturnStatus: string;
begin
If PlayersActive < HowManyPlayers then
begin
Result := IntToStr(PlayersActive) + ' out of ' + IntToStr(HowManyPlayers);
Exit;
end;
Result := 'Everything is cool.';
end;

{*******************************************************************************
Procedure RC_FixFL;
by: N1ke!
Description: Scrolls to the top of the Friend list.
*******************************************************************************}
Procedure RC_FixFL;
begin
If (GetColor(729, 248) = 2106924)then
Mouse(729, 248, 5, 2, True);
end;

{*******************************************************************************
Procedure Function RC_MasterOnline(Var MasterCords: TPoint; Master: String): Boolean;
by: N1ke!
Description: Checks if the master given is online, and results
his cords on the Friend list.
*******************************************************************************}
Function RC_MasterOnline(Var MasterCords: TPoint; Master: String): Boolean;
var
I: Integer;
S: String;
begin
If Not GameTab(8) then
Exit;
Wait(175+Random(140));
RC_FixFL;
For I:=0 to 12 do
If Not (GetColor(675, 233+(15*I)) = 255) then
begin
S := LowerCase(Trim(GetTextAtEx(558, 231+(15*I), 45, RC_FriendChars, True, False, 0, 2, 16777215, 20, False, tr_AllChars)));
Writeln(S);
If S = Lowercase(Master) then
begin
MasterCords := Point(576, 236+(15*I));
Result := True;
Exit;
end;
end;
end;

{*******************************************************************************
Function RC_TakeAction(AN: Integer; RC_Master: String): Boolean;
by: N1ke!
Description: Performs the action given in AN and sometimes responds
them using the given master.
*******************************************************************************}
Function RC_TakeAction(AN: Integer; RC_Master: String): Boolean;
var
S: String;
MasterCords: TPoint;
I: Integer;
begin
Result := False;
Case AN Of
1:
begin
Writeln('[RC.Scar] - Checking player status..');
S := RC_ReturnStatus;
Writeln('[RC.Scar] - ' + S);
If Not GameTab(8)then
Exit;
Wait(175+Random(125));
If Not RC_MasterOnline(MasterCords, Lowercase(RC_Master))then
begin
srl_Warn('RC_TakeAction', 'Problems finding master', warn_AllVersions);
Exit;
end;
Mouse(MasterCords.X, MasterCords.Y, 25, 3, True);
Wait(255+Random(175));
TypeSend(S);
Result := True;
end;

2:
begin
Writeln('[RC.Scar] - Reseting players..');
For I:=0 to High(RC_StartLocs)do
If Not I = CurrentPlayer then
begin
Players[I].Active := True;
Players[I].Loc := RC_StartLocs[I];
end;
AddToSRLLog('********** RC.SCAR RESET ');
Result := True;
end;

3:
begin
Writeln('[RC.Scar] - Stopping script..');
If LoggedIn then
Logout;
TerminateScript;
end;

4:
begin
Writeln('[RC.Scar] - Logging out..');
Logout;
Result := True;
end;

5:
begin
if (SRL_Procs[srl_OnCustomRC] <> nil) then
SRL_Procs[srl_OnCustomRC]();
Result := True;
end;

else
begin
srl_Warn('RC_TakeAction', 'Unknown action trigger, [' + IntToStr(AN) + ']', warn_AllVersions);
Exit;
end;
end;
end;

{*******************************************************************************
function RC: Boolean;
by: WT-Fakawi rewritten by N1ke!
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 if it's from any of the given masters.
If found it waits peforms the given action.
Then RC sleeps five minutes to get rid of the red text.
*******************************************************************************}
function RC: Boolean;
Var
S, Master: String;
I, II: Integer;
Begin
Result := False;
If Not RC_InUse then
Exit;
If (RC_Busy)Or(Not RC_PMFound)then
Exit;
If Not RC_MasterCalls(Master) then
Exit;
S := RC_ReadCommand;
If(S = '')then
Exit;
Writeln('Got a PM from master(' + Master + '), checking for triggers...');

For I:=0 to High(RC_Actions)do
For II:=0 to High(RC_Actions[I].Triggers)do
If Pos(RC_Actions[I].Triggers[II], S) > 0 then
begin
RC_TakeAction(RC_Actions[I].Action, Master);
RC_TSL := GetSystemTime;
Exit;
end;
end;

{*******************************************************************************
Procedure SetupRC(Masters: TStringArray);
by: N1ke!
Description: Sets up everything needed to use RC.scar.
Needs to be executed AFTER DeclarePlayers.
*******************************************************************************}
Procedure SetupRC(Masters: TStringArray);
var
I: Integer;
begin
If GetArrayLength(Masters) = 0 then
begin
srl_Warn('SetupRC', 'No masters given - RC will not be used.', warn_AllVersions);
Exit;
end;
Writeln('Setting up RC..');


RC_FriendChars := LoadChars2(AppPath + 'Fonts\FriendChars\');

RC_Masters := Masters;
RC_InUse := True;

SetArrayLength(RC_StartLocs, HowManyPlayers);
For I:=0 to High(RC_StartLocs)do
RC_StartLocs[I] := Players[CurrentPlayer].Loc;

RC_Actions[0].Triggers := ['status', 'check', 'hows it going'];
RC_Actions[0].Action := 1;

RC_Actions[1].Triggers := ['reset', 'back from square one', 'rewind'];
RC_Actions[1].Action := 2;

RC_Actions[2].Triggers := ['stop', 'enough', 'come outside'];
RC_Actions[2].Action := 3;

RC_Actions[3].Triggers := ['logout', 'log'];
RC_Actions[3].Action := 4;

RC_Actions[4].Triggers := ['that thing', 'hey', 'remember'];
RC_Actions[4].Action := 5;

If LoggedIn Then
RC_SetStandards;
end;

The new updated Globals.scar

//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- ? Global Variables --//
//-----------------------------------------------------------------//
// * procedure LoadSRLBitMaps; // * by SRL Dev Team
// * procedure FreeSRLBitMaps; // * by Ron

{ const SRLVersionNumber;
Description: Repository Version Number. }
Const
SRLVersionNumber = 32;

{ var TalkAfterRandoms: Boolean;
Description: Talk random phrases after randoms are detected/solved. }
var
TalkAfterRandoms: Boolean;

{ var bmpAdmin, bmpMod, Lamp, BoxMask: Integer;
Description: Global Bitmaps. Need to be Global because of SCAR Memory leaks. }
var
bmpAdmin, bmpMod, Lamp, BoxMask: Integer;

{ var RoadColor, WaterColor, BankColor: Integer;
Description: Three variables you will almost always use. :) }
var
RoadColor, WaterColor, BankColor: Integer;

{ var LampSkill: String;
Description: Set Lamp skill. }
var
LampSkill: string;

{ const MMX1, MMY1, MMX2, MMY2;
Description: MiniMap Edge Points. }
const
MMX1 = 550;
MMY1 = 8;
MMX2 = 703;
MMY2 = 161;

{ const MMCX, MMCY;
Description: MiniMap Centre Point. }
const
MMCX = 627;
MMCY = 85;

{ const MSX1, MSY1, MSX2, MSY2;
Description: Main Screen EdgePoints. }
const
MSX1 = 4;
MSY1 = 4;
MSX2 = 516;
MSY2 = 338;

{ const MSCX, MSCY;
Description: Main Screen Centre Points. }
const
MSCX = 259;
MSCY = 170;

{ const MIX1, MIY1, MIX2, MIY2;
Description: Inventory EdgePoints. }
const
MIX1 = 547;
MIY1 = 202;
MIX2 = 737;
MIY2 = 466;

{ const MICX, MICY;
Description: Inventory Centre Points. }
const
MICX = 642;
MICY = 334;

{ const MCX1, MCY1, MCX2, MCY2;
Description: Chat Screen EdgePoints. }
const
MCX1 = 4;
MCY1 = 342;
MCX2 = 496;
MCY2 = 460;

{ const MCCX, MCCY;
Description: Chat Screen Centre Points. }
const
MCCX = 250;
MCCY = 401;

{ const SRL_Procs Constants;
Description: Constants for SRL_Procs. }
const
srl_AntiBan = 0; //Your AntiBan procedure to be called during various SRL functions and procedures. (Flag, FFlag)
srl_OnFindMod = 1; //After a player or Jagex mod is detected talking in the chat box.
srl_OnFindDead = 2; //After the text 'Oh dear you are dead' is detected.
srl_OnFindFight = 3; //After detecting a fighting random.
srl_OnFindTrade = 4; //After the trade has been attempted (either success or failure).
srl_OnNextPlayer = 5; //While the players are logged out and before CurrentPlayer changes.
srl_OnSendStats = 6; //After SRL Script Stats are sent to the server.
srl_OnRandomCall = 7; //Called in FindNormalRandoms, FindInventoryRandoms, FindNonInventoryRandoms. (NOT ONLY WHEN RANDOMS ARE DETECTED).
srl_OnFindRandom = 8; //After a random event is detected. (FNR, FIR, FNIR, FT)
srl_OnLogOut = 9; //Just before the player is logged out.
srl_InNextPlayerLoop = 10; //During the infinite loop in NextPlayer when all players are inactive.
srl_OnCustomRC = 11; //When custom RC trigger has been given.

{ var SRL_Procs: array [0..10] of procedure();
Description: Varibles to store user-defined procs to be called in SRL. }
var
SRL_Procs: array [0..11] of procedure();

{ type TAutoColorInfo;
Description: Set of information that can be used in some functions. }
type
TAutoColorInfo = record
Name: string;
Color: Integer;
ColorArray: TIntegerArray;
MinCount: Integer;
MaxCount: Integer;
MaxDist: Integer;
MaxDistCenter: Integer;
UpText: string;
UpTextMulti: TStringArray;
HueMod, SatMod: Extended;
LumTol: Integer;
MinR, MaxR, MinG, MaxG, MinB, MaxB: Integer;
MinX, MaxX, MinY, MaxY, MinZ, MaxZ: Extended;
end;

//****************************************************************************//
// * I tried to make these Bitmaps Local, but I got after a couple of hours
// * running scripts, CTB and DB handle errors. So sorry, declared them global
//****************************************************************************//

{*******************************************************************************
procedure LoadSRLBitMaps;
By: SRL Dev Team
Description: Loads SRL Bitmaps into memory.
*******************************************************************************}

procedure LoadSRLBitMaps;
begin
bmpMod := BitmapFromString(9, 6, 'beNqbPn0RWeDBgwdAkgEMkBnT' +
'p0+HS6GR+KVwAgAGXFQr');
bmpAdmin := BitmapFromString(9, 6, 'beNqbp/j9PwcZ6P//FiDJAA' +
'bIjGvzFOFSaCR+KZwIALniVEk=');
Lamp := BitmapFromString(6, 6, 'beNrzdWpr4a2qBCEZGQYGBkYgAr' +
'KLCnmtLKHczRtF8nJ5/f05dHVBIgYKCkAyPY3DzZUDogUoEubrBFE' +
'M4UJEIAwICvGyDgMAG0ERxQ==');
BoxMask := BitmapFromString(25, 25, 'beNpjYMAF/mMABtIBLo0km' +
'UyS7bhMJtsLyCbASQoBJUFKSeCMGjVq1KhRw94ouCFUKfFwcck2h4' +
'wqgCQHEDSZEo8QdjYABzDsFA==');
end;

{*******************************************************************************
procedure FreeSRLBitMaps;
By: Ron
Description: Frees SRL Bitmaps from memory.
*******************************************************************************}

procedure FreeSRLBitmaps;
begin
FreeBitmap(bmpMod);
FreeBitmap(bmpAdmin);
FreeBitmap(Lamp);
FreeBitmap(BoxMask);
end;

var
WarnSensitivity: Integer; //-2 will show Warnings and above, -3 notices too.

{*******************************************************************************
Procedure srl_Warn(ProcName, ErrorMessage: String; wVersion: Integer);
by: SRL Dev Team
Description: WriteLn's a warning message.
*******************************************************************************}

Const
warn_AllVersions = 0;
warn_Terminate = -1;
warn_Warning = -2;
warn_Notice = -3;

Procedure srl_Warn(ProcName, ErrorMessage: String; wVersion: Integer);

Begin
Case wVersion Of
warn_Terminate: begin end;
warn_AllVersions: begin end;
warn_Warning: begin end;
warn_Notice: begin end;
Else If wVersion <> SRLVersionNumber Then
Exit;
End;
if (wVersion > WarnSensitivity) then
WriteLn('** Warning in ' + ProcName + ': ' + ErrorMessage + '**');
If wVersion = -1 Then
TerminateScript;
End;


NOTE: If don't use 3.20d then you have to download
FriendsChar and place them inside SCAR\Fonts. Attached a rar with them in this post.

Gu3st...

2009-06-02 00:28:45

Very nice! :D
I love the triggers ;)

yourock12345

2009-06-02 00:29:40

good job dude ;) will use

Naike

2009-06-02 00:29:57

I just noticed that i've forgotten to update the Include description on RC.scar…
Will edit it soon…

Edit: Fixed.

Shuttleu

2009-06-02 00:42:42

omg!
i fixed these ages ago and i got told they were going to be added
if this one gets added then then im not going to be happy
and you should also credit me for the chars too ;(

~shut

Naike

2009-06-02 00:44:52

From: Shuttleu
omg!
i fixed these ages ago and i got told they were going to be added
if this one gets added then then im not going to be happy
and you should also credit me for the chars too ;(

~shut


Not to be offensive, but what if yours wasn't good enough..
I'm sure they had a reason…

And why not be happy about SRL doing some progress?

Chars was in SCAR 3.20d?

Shuttleu

2009-06-02 00:51:07

From: N1ke!
Not to be offensive, but what if yours wasn't good enough..
I'm sure they had a reason…

And why not be happy about SRL doing some progress?

Chars was in SCAR 3.20d?


they said that they were going to add it but they were going to wait until 3.20 was released otherwise no one would have the chars
http://freddy1990.com/forums/index.php?topic=2343.msg13517#msg13517
then when scar 3.20 was released they forgot about it :(

~shut

Naike

2009-06-02 01:22:14

You're making me confused now ^^

Is it your FriendChars or not?

Shuttleu

2009-06-02 01:25:50

yes i made FriendChars
i stayed up over night making them

~shut

Naike

2009-06-02 01:54:58

From: Shuttleu
yes i made FriendChars
i stayed up over night making them

~shut


Added a thank you on first post.

Thank you ;)

Shuttleu

2009-06-02 01:56:24

fixing ;o i didn't fix them
i made them ;)

~shut

Naike

2009-06-02 02:06:13

From: Shuttleu
fixing ;o i didn't fix them
i made them ;)

~shut


Are you always this annoying xD?

Editing again, LAST TIME.

Shuttleu

2009-06-02 02:11:12

lol i can be when im in a certain mood ;)
i was only jokin anyway :p
but thanks :)

~shut

Tickyy

2009-06-03 21:32:48

Looks Sexy'

Nice work, Congradulations :p you're t3h sex :D!

Shuttleu

2009-06-03 22:01:17

make the thanks for me bigger!
i want to get noticed!
only joking XD
meh i suppose i should say well done

~shut

Gu3st...

2009-06-04 00:00:44

Will this be commited?

MylesMadness

2009-06-04 05:06:21

Someone wants to be a dev…

ZephyrsFury

2009-06-04 06:08:30

From: MylesMadness
Someone wants to be a dev…


You don't have to be a developer to help SRL you know…

Simtoon

2009-06-04 10:59:50

But his helping srl alot = DEV!! OMGWTFBBQROLFCATS

Naike

2009-06-04 12:06:40

Doing this to help SRL, not to gain higher rank.
As if I did all these fixes for a rank, I would stop when i achieved my goal which
would kill the whole point.

Jethr0x

2009-06-04 18:32:13

omfg this is amazing.

Shuttleu

2009-06-04 18:58:50

From: Jethr0x
omfg this is amazing.

do you even know what it does?

~shut

EDIT: if and when this get committed i will write a tutorial on it

Gu3st...

2009-06-04 19:38:24

From: Shuttleu
do you even know what it does?

~shut

EDIT: if and when this get committed i will write a tutorial on it

That guy is the so-called "SCAR Master" on sythe, but I do not like that guy.. he's a newb

Shuttleu

2009-06-04 19:40:07

hence the reason why i asked him if he even knows what it does

~shut

Naum

2009-06-05 10:59:01

Shut: Check Pentii's signature it's all in there - one of the links.

WT-Fakawi

2009-06-05 11:20:17

Good one N!ke. I have used RC many many times to set and reset my army. It is quite useful. Glad to see it is still alive!

Shuttleu

2009-06-05 18:39:48

From: NaumanAkhlaQ
Shut: Check Pentii's signature it's all in there - one of the links.
i know how to use it
i have used it soo many times before
and i fixed it up only to be told it would be added then forgotten :(
i was asking him because his post looked like spam

~shut

Punkgi

2009-06-05 21:39:21

What does this do?

Shuttleu

2009-06-05 21:42:45

it allows you to reset the players their locations
log out the player
terminate the script etc.
all from another computer through rs

~shut

Punkgi

2009-06-05 22:10:47

so this has nothing to do with RuneCrafting? lol

Shuttleu

2009-06-05 22:15:46

no
RC stands for Remote Control
because you can control the script remotely

~shut

Bixby Sayz

2009-08-14 05:22:38

Searched around the forums a bit but didn't see anything:

Is there a tutorial for getting started using RC? Wouldn't have to be too involved, just the basics.