SRL Archive - SRL Archives

SRL function/procedure fixes/adds.


EvilChicken!

2008-05-31 05:28:38

o hai

First of all, in Object.scar, FindObjTPA:
if not (cts >= 0) and (cts <= 2) then
should be
if (cts > 1) or (cts < 2) then

And, PlayersOnMap in MapWalk.scar still doesn't work.
Too high tolerance, I assume.

GetCourseXP, the only procedure in Agility.scar, is useless and should be removed.

Useless skill includes should be removed. Theese are
  • Agility.scar
  • Construction.scar
  • Farming.scar
  • Fletching.scar
  • Herblore.scar
  • Hunting.scar
  • Slayer.scar
  • Thieving.scar

And, why is DisplayWindow in Mining.scar? It would be more commonly used if placed in 'core' folder. This is actually a poweful tool, especially when debugging TPAs/ATPAs. Or, simpy replace with DebugTPA/-ATPA.

Proc time now.

{*******************************************************************************
procedure Logout;
By: Starblaster100 / Raymond
Description: Logs you out.
*******************************************************************************}
function Logout: Boolean;
var
X, Y, C, I: Integer;

begin
if (not LoggedIn) or (not GameTab(14)) then
Exit;
Wait(200 + Random(100));
while LoggedIn or (c < 10) do
begin
Inc(c);
if FindText(X, Y, 'here', UpChars, MIX1, MIY1, MIX2, MIY2) then
begin
MouseBox(573, 362, 708, 389, 1);
for i := 0 to 10 do
begin
Wait(750 + random(500));
if not LoggedIn then
begin
Result := True;
Exit;
end;
end;
end;
end;
end;


{*******************************************************************************
function TheTime : string;
By: RsN (fixed by Ron)
Description: Returns current time as a string
*******************************************************************************}
function TheTime(Hours24: Boolean): string;
var
Hour, Mins, Sec, MSec: Word;
PAM: string;
begin
DecodeTime(Now, Hour, Mins, Sec, MSec);
if Hours24 then
Result := (Padz(IntToStr(Hour), 2) + ':' + Padz(IntToStr(Mins), 2) + ':' + Padz(IntToStr(Sec), 2))
else
begin
PAM := 'AM';
if Hour > 12 then
begin
DecEx(Hour, 12);
PAM := 'PM';
end else if Hour = 12 then
PAM := 'PM'
else if Hour = 0 then
Hour := 12;
Result := (Padz(IntToStr(Hour), 2) + ':' + Padz(IntToStr(Mins), 2) + ':' + Padz(IntToStr(Sec), 2) + ' ' + PAM);
end;
end;

{*******************************************************************************
function FightNPC(Colors : TIntegerArray, tol, TimeOut: Integer): Boolean;
By: WT-Fakawi & Cazax
Description: Fights NPC. Input an array of colors.
Tol = color tolerance, TimeOut = Time in MS before exiting.
*******************************************************************************}
function FightNPC(Colors: TIntegerArray; Tol, TimeOut: Integer): Boolean;
var
Mark, X, Y, I: Integer;

begin
if not LoggedIn or FindDead then exit;
for I := 0 to Length(Colors) - 1 do
if FindObjTPA(X, Y, Colors[I], Tol, 1, 5, 5, 12, ['ttack']) then
begin
Result := True;
GetMousePos(X, Y);
if random(2) = 0 then
Mouse(x, y, 0, 0, True) else
begin
Mouse(x, y, 0, 0, False);
Wait(130 + random(175));
ChooseOption('ttack');
end;
if not LoggedIn or FindDead then exit;
Wait(750 + random(850));
FFlag(0);
Mark := GetSystemTime;
repeat
if not LoggedIn or FindDead or (GetSystemTime - Mark > TimeOut) then exit;
Wait(750 + random(750));
FindNormalRandoms;
until not FindColorSpiral(X, Y, 65280, 240, 140, 290, 175);
Exit;
end;
end;

LogOut: Fixed annoying code and added mousebox.
TheTime: Added option to choose from 12 or 24-hour format.
FightNPC - Was in a horrible state. Switched to FindObjTPA and fixed.

That was all, I had a couple more funtions for QC.scar, but I deleted them. On purpose.


Tell me what you think and if you're aware of any other bugs in SRL that you self cannot fix, please post them here and I'll try my best.

n3ss3s

2008-05-31 05:53:32

Your first point fails :p

What do you consider to be between 1 and 2? CTS(1.5) :p

The one in dev version is

  if CTS * 9 mod 3 <> 0 then
CTS := 1;

Yes, I know it's sexy ;)

LogOut: Fixed annoying code and added mousebox.
TheTime: Added option to choose from 12 or 24-hour format.
FightNPC - Was in a horrible state. Switched to FindObjTPA and fixed.


Why don't you post these fixes, we can't see them anywhere making it pointless because we cannot commit them then :p


Tell me if your Logout works, if so I will add :)

EvilChicken!

2008-05-31 06:00:27

From: n3ss3s
Why don't you post these fixes, we can't see them anywhere making it pointless because we cannot commit them then :p


That's just descriptions for the three functions that are in scar tags. Which you obviously can see.

Tell me if your Logout works, if so I will add :)


It works, I've tested.

Wizzup?

2008-05-31 06:10:55

What was the 'annoying code' in logout?

EvilChicken!

2008-05-31 06:16:34

Result := (not (LoggedIn));
if Result = True then
Exit;
if GameTab(14) = False then
Exit;


That just annoyed me. :p
(Don't hate me..)

ZephyrsFury

2008-05-31 07:43:46

Whats actually wrong with PlayersOnMap? It works fine for me.

EvilChicken!

2008-05-31 07:51:00

It is supposed to count PLAYERS, right? Sometimes it counts NPCs instead.

ZephyrsFury

2008-05-31 08:06:55

From: EvilChicken!
It is supposed to count PLAYERS, right? Sometimes it counts NPCs instead.


Hmm doesn't happen for me but I'll look into it.

mastaraymond

2008-05-31 08:19:04

Logout is allright, so is the CTS fix XD

MylesMadness

2008-05-31 10:29:50

aren't player dots color static?

ZephyrsFury

2008-05-31 10:32:08

From: Mylesmadness
aren't player dots color static?


Yes there are certain constant colours. I have a similar function that uses this fact.

n3ss3s

2008-05-31 10:48:59

Sorry EvilChicken, my brains didn't bother to think about scrolling down the tag :(

MylesMadness

2008-05-31 17:48:59

so why is their tol on is. Remind me to ask footbaljds when hes on break from "hell camp"

Cazax

2008-05-31 18:46:47

I want to use XYZ with FindObjTPA!

CTS 3!

mastaraymond

2008-05-31 20:00:09

From: Cazax
I want to use XYZ with FindObjTPA!

CTS 3!

As long as there is no SRL update just copy it into your script and give it a different name > Problem solved.