SRL Archive - SRL Archives

Couple functions ..


EvilChicken!

2008-06-27 20:13:04

  • Logging out in FindMod should be removed. Script writer should decide what would happen if a mod/admin is detected.
  • RC no longer works, JaGex replaced Friends chars with new, unique ones. Check out my temp fix.
  • SetChat coords are not working.
  • InConvo in AntiRandoms.scar allwars returns true.
  • FindFightEx is a replacement function for FindFight in AntiRandoms.scar.
  • My SetOption replaces both SetRun and Retaliate in GameTab.scar, and also has support for the other options, such as "chat effects", "mouse buttons" ect.

Please comment on anything you can think of.

function InConvoEx: Boolean;
var
X, Y: Integer;

begin
Result := (not FindColor(X, Y, 0, 9, 459, 31, 471) and LoggedIn);
end;


procedure SetOption(Which: string; TurnOn: Boolean);
var // Replaces SetRun and Retaliate in GameTab.SCAR and adds more options.
MBox: TBox;
XY: TPoint;


begin
if not LoggedIn or NoGameTab then exit;
case LowerCase(Which) of
'retaliate': begin
XY := IntToPoint(664, 358);
MBox := IntToBox(570, 360, 715, 399);
end;
'mousebuttons', 'mouse buttons': begin
XY := IntToPoint(585, 357);
MBox := IntToBox(568, 358, 603, 394);
end;
'chat effects', 'chateffects', 'chat effect', 'chateffect': begin
XY := IntToPoint(644, 357);
MBox := IntToBox(624, 359, 659, 394);
end;
'split private', 'splitchat', 'spilt private chat': begin
XY := IntToPoint(692, 357);
MBox := IntToBox(679, 358, 715, 393);
end;
'aid', 'accept aid': begin
XY := IntToPoint(588, 450);
MBox := IntToBox(568, 413, 603, 447);
end;
'run': begin
XY := IntToPoint(622, 421);
MBox := IntToBox(624, 413, 659, 448);
end;
else
begin
SRL_Warn('SetOption', '"' + Which + '" is not a valid option', Warn_AllVersions);
Exit;
end;
end;
if LowerCase(Which) = 'retaliate' then GameTab(1) else GameTab(11);
if GetColor(XY.X, XY.Y) = 10551295 then // Pop-up-shit.
begin
MouseBox(551, 452, 778, 497, 3);
FTWait(2 + random(3));
end;
if (GetColor(XY.X, XY.Y) = 987203) xor TurnOn then
MouseBox(MBox.X1, MBox.Y1, MBox.X2, MBox.Y2, 1);
end;

procedure SetChatEx(State: string; Chat: Byte); // Replaces SetChat in FlagChat.SCAR.
var// Also, small thingy: Integer variable should be replaced with Byte var in ChatsOff.
Color: Integer;
X1X2: TBox;

begin
if (LowerCase(State) = 'hide') and (Chat > 1) then
begin
srl_Warn('SetChatEx', 'State "' + Capitalize(State) +
'" is not available for chat(' + IntToStr(Chat) + ') ', warn_AllVersions);
Exit;
end;
case Chat of
1: X1X2 := IntToBox(122, 171, 145, 0);
2: X1X2 := IntToBox(178, 228, 200, 0);
3: X1X2 := IntToBox(236, 284, 260, 0);
4: X1X2 := IntToBox(294, 342, 320, 0);
5: X1X2 := IntToBox(350, 398, 373, 0);
else
begin
srl_Warn('SetChatEx', 'Chat(' + IntToStr(Chat) + ') does not exist ', warn_AllVersions);
Exit;
end;
end;
case LowerCase(State) of
'on': Color := 65280;
'off': Color := 255;
'hide': Color := 16776960;
'friends': Color := 65535;
else
begin
srl_Warn('SetChatEx', 'State "' + Capitalize(State) + '" does not exist ', warn_AllVersions);
Exit;
end;
end;
if not FindColorSpiral(X1X2.X2, X1X2.X2, Color, X1X2.X2 - 10, 486, X1X2.X2 + 10, 506) then
begin
MouseBox(X1X2.X1, 482, X1X2.Y1, 500, 2);
Wait(175 + random(175));
ChooseOption(Capitalize(LowerCase(State)));
end;
end;

const // Constants for RCEx;
RC_Master = ''; // RC master.

RC_Reset = 'reset'; // Reset all players to active | command.
RC_Deactivate = 'kthxbai'; // Deactivate ONLY current player | command.
RC_Terminate = 'stop'; // Terminate script | command.
RC_LogOut = 'logout'; // Log out current player | command.

function RCEx: Boolean; // Removed all non-working commands, added one. Works now.
var // Doesn't wait for command, nor replies. I think it's much more efficient that way.
X, Y: Integer;

begin
if (Trim(RC_Master) = '') or (not FindColor(X, Y, 128, MCX1, MCY1, MCX2, MCY2)) then exit;
MasterBitMapMask := CreateBitmapMaskFromText(RCMaster, SmallChars);
if (not FindBitmapMaskTolerance(MasterBitMapMask, X, Y, MCX1, MCY1, MCX2, MCY2, 10, 6)) then
begin
try
FreeBitmap(MasterBitMapMask);
except end;
Exit;
end;
case RCReadCommand of
RC_Reset: begin
RCResetStatus;
Result := True;
end;
RC_LogOut: begin
Logout;
Result := True;
end;
RC_Deactivate: begin
LogOut;
Players[CurrentPlayer].Active := False;
Result := True;
end;
RC_Terminate: begin
if random(2) = 1 then LogOut;
try
FreeBitmap(MasterBitMapMask);
except end;
TerminateScript;
end;
end;
try
FreeBitmap(MasterBitMapMask);
except end;
end;

function FindFightEx: Boolean;
var
X, Y: Integer;
CurTab: Byte;

begin
if (not FindColor(x, y, 65280, 230, 130, 280, 180) or
not FindColor(x, y, 255, 230, 130, 280, 180)) then exit;
CurTab := GetCurrentTab;
if CheckHpFirst then
if HPPercent <= 100 then exit;
Result := True;
WriteLn('******** FOUND FIGHTING RANDOM ********');
WriteFileString(TheFile, '******** FOUND FIGHTING RANDOM ********' + Chr(13));
GameTab(CurTab);
TakeScreen('Found fight');
Inc(Fights);
end;


I repeat, please let me know anything that is on your mind regarding this.

ZephyrsFury

2008-06-28 04:07:43

shuttleu has made a new friends charset which Freddy has added to the next SCAR version I believe.

SetChat was working last time I used it. Maybe it was updated in the Dev Svn.

I agree with you on editing FindMod. Perhaps we could add another variable 'LogoutOnMod' to SetupSRL.

EvilChicken!

2008-06-28 11:23:47

From: ZephyrsFury
shuttleu has made a new friends charset which Freddy has added to the next SCAR version I believe.


I know, thats why I just made a temp fix, not for SRL. I just didn't want to spam by making a seperate thread for it. It's not good anyway. But it works.

SetChat was working last time I used it. Maybe it was updated in the Dev Svn.


It misses the correct box or sets wrong chat 1/3 times. And, mine has MouseBoxes.

I agree with you on editing FindMod. Perhaps we could add another variable 'LogoutOnMod' to SetupSRL.


"FindMod(LogOut: Boolean)"?


Thanks for your reply.

ZephyrsFury

2008-06-28 11:34:24

From: EvilChicken!
I know, thats why I just made a temp fix, not for SRL. I just didn't want to spam by making a seperate thread for it. It's not good anyway. But it works.


shuttle had a temp fix on his thread too. But nice job with this anyway.

From: EvilChicken!

"FindMod(LogOut: Boolean)"?



We still need to add a line to SetupSRL to allow people to easily change it to their own liking. I suppose your way would be good for people who want to do 'if (FindMod(False)) then TypeSend('wow a mod');' or something.

PvH

2008-06-28 13:14:35

Why not make it worldswitch when a mod is found?
And yes, shuttleu already made the friend thing;)

Zezi

2008-07-05 01:54:48

Nice idea about find mod.

Would that be set up in declare players, such as atm we have
  Players[0].Active := true;

It'd be different for each player or something

  Players[0].ModHop := true;

Or something like that lol. Mhm, coords fixed for setchat, nice.

Mis-lead however, srl new functions implys new not updated :D!