SRL Archive - Test corner

RC.scar


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:

  1. Set Split Private Chat Off.
  2. Set Private Chat to Friends.
  3. Make sure you are on each others friend list. (script attached: see below…)
  4. include RC.scar in your script. (Will be standard included in 3.5)
  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';
  6. 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;

Infantry001

2006-10-07 23:31:07

wow nice! ill be sure to download when it comes out later, since ya know, i dont have another comp right now. Awesome job, fakawi!

Yakman

2006-10-08 05:42:01

very nice, iv downloaded it and i can test it if i get SOCKS proxy to work

also, why dont you just add it to FindNormalRandoms, since people use that regularly and it would make old script have it too

EDIT: i got the SOCKS to work,
i included it in your script goblin scheduler, in the FindFastRandoms procedure, it found the master quite well and said "hi" to it, but later it said hi again even though it had said it before. also when the master sent the "status" order, nothing happened, i even tried turning off public chat on the slave, still nothing.

WT-Fakawi

2006-10-08 14:11:00

hmmm. Thanks for trying Yakman!

Well I must say, I am @ work right, and I have managed to keep four Players @ the Ratz now for over 12 hours @ my homePC. I haven't had a single flaw with RC.

As soon as the master logs in, you wait for the Slaver to say "hi". Then -immidiately after that- you can give it either the command "status" or "reset". After that RC disables itself for five minutes. I have done that to get rid of the color Red in the ChatWindow.

If on status, everybody is True, the Slave replies with "Everything is cool."

I am happy with it…

Yakman

2006-10-08 15:03:53

From: WT-Fakawi

As soon as the master logs in, you wait for the Slaver to say "hi". Then -immidiately after that- you can give it either the command "status" or "reset". After that RC disables itself for five minutes. I have done that to get rid of the color Red in the ChatWindow.


i think thats why, when i was testing it was running back and fourth between two room to do it, you have to give the order within 60 seconds, i think i sent it status after that. ill try again when i get the chance

iv got a suggestion, instead of waiting five minuites, you could have it reset itself until it gets the message that the master has logged out (or set private chat off), because now it looks like you have to send status, wait five minuites, then send reset. thats all good if you have players to get out of randoms, but if "everything is cool", it would be an annoying wait in which you might get caught if your at work or school

Pyro

2006-10-08 15:30:42

Ahhh something i dont get:

If the players are set to false. Something must have gone wrong for them i.e impossible random. So why are we setting them to true again?

Yakman

2006-10-08 16:29:18

From: Pyro
Ahhh something i dont get:

If the players are set to false. Something must have gone wrong for them i.e impossible random. So why are we setting them to true again?


because, your at work/school and have access to a computer, you can go to the false players and get them out of their impossible randoms, heres an example

master:status
slave:*array of nicks*
*master logs in on all these players and gets them out their random, ready to continue*
master:reset
slave:reset (the reply to the command)

m0u53m4t

2006-10-08 18:09:08

Looks good, but where would you ever use it?

Pyro

2006-10-08 18:19:44

OOOOOOOO thanks yakman. I thought you meant just setting them to true. O man this thing rocks then :p

WT-Fakawi

2006-10-08 18:23:32

Pyro: You will ofcourse need to set them back manually into startposition :)

M0u53m4t: Here for instance. I have twice set two players back into position (maze, mime, leo, died). Ratz run 14 Hours straight with only 4 Players today.


<============== -RatZ 0.30- Progress Report ===============>
Worked for 14 Hours, 45 Minutes and 55 Seconds
Killed 804 Rats and Goblins
Chopped 330 Trees
Casted 0 Spells
Lit 339 Logs
Cooked 98 Times
**********************************************
Name :
Number : 3
Worked for : 200 minutes.
Active : True
**********************************************
0 : = T. AT 30. ST 29. DF 29. PR 9. HP 30. MG 1. CO 12. FM 17. WC 14. W : 238 min. L:
1 : = T. AT 34. ST 33. DF 33. PR 7. HP 34. MG 1. CO 9. FM 22. WC 18. W : 207 min. L:
2 : = T. AT 36. ST 33. DF 32. PR 20. HP 34. MG 1. CO 12. FM 22. WC 18. W : 206 min. L:
3 : = T. AT 34. ST 25. DF 25. PR 21. HP 30. MG 1. CO 13. FM 24. WC 20. W : 200 min. L:
**********************************************

Yakman

2006-10-08 18:35:08

theres other things you could use this for as well, it has potential,
you could add another player to the array, you could change a variable on the script eg. change EquipPick to true

your controlling the script, and best of all your using Jagex's own communication channels, ;) :f:

but for now, the reset and status is fine, no need to rush

warship45

2006-10-10 02:40:07

will jagex not pick on this casue sending a report like that back fast and all of the stuff it saids if they did pick up on it then it would then no longer work. also what happends in the script stops or gets stuck is there any way to start the script agin or stop the script.

it looks good and keep up working on it

Yakman

2006-10-10 02:45:51

From: warship45
also what happends in the script stops or gets stuck is there any way to start the script agin or stop the script.


no script would stop, theres that rule, no endless loops

Sumilion

2006-10-10 11:29:45

What about fagex ? Can't they just simply filter the messages for reset or status and then flag you ? Fagex probably won't do it, as with moste opportunities, but you can't ignore that the possibility is there… What you could do is set a var reset/status so that the user can set their own remote signs ( idea made by Yakman ). Sounds like a great idea Fakawi ;).

WT-Fakawi

2006-10-10 13:46:55

sure. That is very simple. My own private version uses: hi (status) and Bye (reset)

Ruroken

2006-10-10 16:52:50

works great for me =) i'll do more testing later

I Pick Axes

2006-10-10 18:45:33

Red like red clothes or like
red: message
?

Sumilion

2006-10-11 13:33:17

Like red messages ;)

Another idea, in case you don't have time to reset all players that you can use a command to reset the first/second/third/etc. player or if you want a player to catch up with the rest that you can set the time limit for that player higher. However i'll think that will be a bit to specific.

Boreas

2006-10-23 13:03:37

player 1:wuts up?
player 2:nm u?
player 1:im at work/school gtg cya

player 1:wuts up?
player 2:i got frustrated with that math homework
player 2:got stuck on problems 1, 3, and 6 so started playing rs lol
player 1:o right i forgot to do that, ill go do it now

Bam Bam

2006-10-23 15:12:54

Boreas does that have anything to do with this or are problems 1 3 6 actualy players?

Boreas

2006-10-23 16:03:46

From: Boreas

Player 1 is master, 2 is current slave

player 1:wuts up? Status
player 2:nm u? All are true
player 1:im at work/school gtg cya Excuse for Master to log out

player 1:wuts up? Status
player 2:i got frustrated with that math homework Intro to next line
player 2:got stuck on problems 1, 3, and 6 so started playing rs lol 1 3 6 are false
player 1:o right i forgot to do that, ill go do it now Excuse for Master to log out and go fix em


I was just posting some example command codewords for the people worried about jagex detecting key words like status.

lardmaster

2006-10-23 16:44:35

very good idea!

weibs

2006-10-23 20:28:15

I like this, I'm gonna try it out ( With 11 players :P ) after I post this.

EDIT: Hmm….just tried it out, but when the slave says 'hi', and I then I say the keyword, the slave doesn't respond. I've tried several different key words, but to no avail. Its probably just me doing something wrong, but any help would be appreciated..

EDIT2: Nevermind, I love it! Lol, I put the keywords back at status and reset, and it works perfectly. :D I love how I can get my guys out of the randoms and not have to stop the script, this should definately be put in SRL.

Also, I had an idea. When you say reset, it responds with 'OK', and then waits for a command. If the response is 'all' then it resets everyone to true and breaks. The other possible responses would be the Player array numbers of the people you want to set true, so that if you want to keep one of them false, you can. So, if it finds a number, it sets that player to true, responds with 'done', and waits for the next command. It does that until the master says 'ok' or 'done' or something.

And, when its recieving the numbers of the players to set to true, it could check to make sure that player exists using HowManyPlayers. Just an idea, but I would like it.

EDIT3: I just thought of another idea, but again, I'm just putting them out there as suggestions. In the RC include, have a const MinsToWait or something for how many minutes to wait before being able to receive another command, that way the master can set it lower if he/she sends commands a lot, or higher if he/she is having trouble with the red text.

Just thought I'd give some input. :tongue: