SRL Archive - MSI Archives

Karamja Lobster/Tuna Fisher.


Tniffoc

2009-04-01 21:03:56

Some of you have received a pm from me about this, but this forum really needs a Karamja fisher that works flawlessly. I would prefer to stay in Color because of downtime and reliability of reflection but, if needed, it has it's place. Post here if you would like to join. Also, should we do Draynor or Faldor walking? I'll start writing the boat-riding code as soon as I post.

This script would be kept SRL Members only because of Leeching and Jagex control. Obviously, as seen by my FFA releases, I don't usually like to keep things high up, but this one has it's advantages. I've used an RSBot Karamja fisher before and made profit like no other. This is a great opportunity for SRL.

I will set up some sourceforge/svn if the interest is large enough.

Project IRC: #srl:karaproject

Thanks for looking!
~Tniffoc


Developers:
  1. Mormonman
  2. noidea
  3. Blumblebee
  4. Dr D Dervish

Helpers:
  1. Iron Man
  2. kingarabian

This is the current version of the script. Not completed yet. Duh.

{*******************************************************************************
CURRENT CREDITS
Wizzup? - DebugTPA
Tniffoc - GetTolerance, HueSatTolCol, SaFindObjectTPA, SaFindObjectColorArray
noidea - FindFish
*******************************************************************************}

program Kara;
{.include SRL/SRL.scar}
type
THSLColor = record
h: Extended;
s: Extended;
l: Extended;
end;
TRGBColor = record
r: Integer;
g: Integer;
b: Integer;
end;
TXYZColor = record
x: Extended;
y: Extended;
z: Extended;
end;

function GetTolerance(arr: array of Integer; theCTS: Integer): Integer;
var
cts,i: Integer;
begin
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(theCTS);
for i:=0 to High(arr)-1 do
begin
Result := 0;
while(not SimilarColors(arr[i],arr[i+1],Result)) do
begin
Inc(Result);
end;
end;
ColorToleranceSpeed(cts);
Inc(Result);
end;

procedure HueSatTolCol(var hue,sat: Extended; var tol,col: Integer; arr: array of Integer; cts: Integer);
var
i,ii,r,g,b: Integer;
hslarr: array of THSLColor;
rgbarr: array of TRGBColor;
xyzarr: array of TXYZColor;
rgbminmax: array[0..1] of TRGBColor;
minmax: array[0..1] of THSLColor;
xyzminmax: array[0..1] of TXYZColor;
h,s,l,x,y,z: Extended;
hmod,smod: Extended;
bestCol: THSLColor;
begin
SetLength(hslarr,Length(arr));
for i:=0 to High(arr) do
begin
ColorToHSL(arr[i],hslarr[i].h,hslarr[i].s,hslarr[i].l);
end;
// hslarr now contains the contents of arr in HSL form.
minmax[0].h := 255;
minmax[0].s := 255;
minmax[0].l := 255;
// MinMax[0] = MIN MinMax[1] = MAX
ii := High(hslarr);
for i:=0 to ii do
begin
minmax[0].h := MinE(minmax[0].h,hslarr[i].h);
minmax[0].s := MinE(minmax[0].s,hslarr[i].s);
minmax[0].l := MinE(minmax[0].l,hslarr[i].l);
minmax[1].h := MaxE(minmax[1].h,hslarr[i].h);
minmax[1].s := MaxE(minmax[1].s,hslarr[i].s);
minmax[1].l := MaxE(minmax[1].l,hslarr[i].l);
end;
h := minmax[1].h - minmax[0].h;
s := minmax[1].s - minmax[0].s;
l := minmax[1].l - minmax[0].l;
hmod := (h/l);
smod := (s/l);
if(hmod < 0.1)then
hmod := 0.1;
if(smod < 0.1) then
smod := 0.1;
hue := hmod;
sat := smod;
if(cts < 2)then
begin
ii := High(arr);
SetLength(rgbarr, ii+1);
for i:=0 to ii do
begin
ColorToRGB(arr[i],rgbarr[i].r,rgbarr[i].g,rgbarr[i].b);
end;
ii := High(rgbarr);
rgbminmax[0].r := 255;
rgbminmax[0].g := 255;
rgbminmax[0].b := 255;
for i:=0 to ii do
begin
rgbminmax[0].r := Min(rgbminmax[0].r, rgbarr[i].r);
rgbminmax[0].g := Min(rgbminmax[0].g, rgbarr[i].g);
rgbminmax[0].b := Min(rgbminmax[0].b, rgbarr[i].b);
rgbminmax[1].r := Max(rgbminmax[1].r, rgbarr[i].r);
rgbminmax[1].g := Max(rgbminmax[1].g, rgbarr[i].g);
rgbminmax[1].b := Max(rgbminmax[1].b, rgbarr[i].b);
end;
r := rgbminmax[1].r - rgbminmax[0].r;
g := rgbminmax[1].g - rgbminmax[0].g;
b := rgbminmax[1].b - rgbminmax[0].b;
col := RGBToColor(r,g,b);
tol := GetTolerance(arr,cts);
end;
if(cts = 2) then
begin
bestCol.h := (minmax[0].h + minmax[1].h) div 2;
bestCol.s := (minmax[0].s + minmax[1].s) div 2;
bestCol.l := (minmax[0].l + minmax[1].l) div 2;
col := HSLToColor(bestCol.h,bestCol.s,bestCol.l);
tol := Round(l + 0.1);
end;
if(cts = 3) then
begin
SetLength(xyzarr,Length(arr));
for i:=0 to High(xyzarr) do
begin
ColorToXYZ(arr[i],xyzarr[i].x,xyzarr[i].y,xyzarr[i].z);
end;
xyzminmax[0].x := 255;
xyzminmax[0].y := 255;
xyzminmax[0].z := 255;
for i:=0 to High(xyzarr) do
begin
xyzminmax[0].x := MinE(xyzminmax[0].x,xyzarr[i].x);
xyzminmax[0].y := MinE(xyzminmax[0].y,xyzarr[i].y);
xyzminmax[0].z := MinE(xyzminmax[0].z,xyzarr[i].z);
xyzminmax[1].x := MaxE(xyzminmax[1].x,xyzarr[i].x);
xyzminmax[1].y := MaxE(xyzminmax[1].y,xyzarr[i].y);
xyzminmax[1].z := MaxE(xyzminmax[1].z,xyzarr[i].z);
end;
x := xyzminmax[1].x - xyzminmax[0].x;
y := xyzminmax[1].y - xyzminmax[0].y;
z := xyzminmax[1].z - xyzminmax[0].z;
col := XYZToColor(x,y,z);
tol := GetTolerance(arr,cts);
end;
end;

Function DebugTPA(Points: TPointArray; BmpName: String): Boolean;

Var
Width, Height, ClientBMP, I, L: Integer;
xs, ys, xe, ye: Integer;

Begin
Try
Begin
xe := xs xor xs;
ye := ys xor ys;
xs := 1 shl 20;
ys := 1 shl 20;

For I := 0 To High(Points) Do
Begin
xs := Min(xs, Points[i].X);
ys := Min(ys, Points[i].Y);

xe := Max(xe, Points[i].X);
ye := Max(ye, Points[i].Y);
End;

Width := xe - xs;
Height := ye - ys;

DisplayDebugImgWindow(0, 0);
DisplayDebugImgWindow(Width, Height);
ClientBMP := BitmapFromString(Width, Height, '');

CopyClientToBitmap(ClientBMP, xs, ys, xe, ye);
For I := 0 To High(Points) Do
FastSetPixel(ClientBMP, Points[i].X - xs, Points[i].Y - ys, 255);
If BmpName <> '' Then
SaveBitmap(ClientBMP, ScriptPath + BmpName + '.bmp');
SafeDrawBitmap(ClientBMP, GetDebugCanvas, 0, 0);
DisplayDebugImgWindow(Width, Height);

FreeBitmap(ClientBMP);
End
Except
FreeBitmap(ClientBMP);
End;
Result := True;
End;
{*******************************************************************************
function SaFindObjectTPA(color: Integer; upTexts: TStringArray; huemod, satmod: Extended; colorSpeed, tolerance, splitX, splitY: Integer): TPoint;
By: Tniffoc
Description: Returns the x,y coordinates of the object defined by the arguments
on the main screen.
Valid Arguments:
color - The color the the object
upTexts - All the possible up texts for the object being found
huemod - The hue modifier (only applicable if you are using colorSpeed 2)
satmod - The sat modifier (only applicable if you are using colorSpeed 2)
colorSpeed - The speed to be used. If you don't know what this is, look it up.
tolerance - The tolerance to be used when finding the object.
splitX: The size of the object across the x axis.
splitY: the size of the object across the y axis.
*******************************************************************************}
function SaFindObjectTPA(color: Integer; upTexts: TStringArray; huemod, satmod: Extended; colorSpeed, tolerance, splitX, splitY: Integer): TPoint;
var
cts,i,sax,say,count: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(colorSpeed);
if(colorSpeed = 2) then
SetColorSpeed2Modifiers(huemod,satmod);
FindColorsSpiralTolerance(MSCX,MSCY,TPA,color,MSX1,MSY1,MSX2,MSY2,tolerance);
//DebugTPA(TPA,'');
i := Length(TPA);
if((i > splitX) and (i > splitY)) then
begin
ATPA := SplitTPAEx(TPA,splitX,splitY);
for i:=0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i],sax,say);
MMouse(sax,say,2,2);
wait(500 + random(500));
wait(200 + random(500));
for count:=0 to High(upTexts) do
begin
if(IsUpText(upTexts[count])) then
begin
GetMousePos(sax,say);
Result := Point(sax,say);
ColorToleranceSpeed(cts);
Exit;
end;
end;
end;
end else
begin
for i:=0 to High(TPA) do
begin
MMouse(TPA[i].x,TPA[i].y,2,2);
wait(500 + random(500));
wait(200 + random(500));
if(IsUpText(upTexts[count])) then
begin
GetMousePos(sax,say);
Result := Point(sax,say);
ColorToleranceSpeed(cts);
Exit;
end;
end;
end;
Result := Point(0,0);
end;
{*******************************************************************************
function SaFindObjectColorArray(arr: array of Integer; upTexts: TStringArray; colorSpeed,splitX,splitY: Integer): TPoint;
By: Tniffoc
Description: Finds the object defined by the parameters.
Valid Arguments:
arr - An array of colors from the object.
upTexts - An array of strings possible for the UpTexts of the object ex. 'illow' for willow.
colorSpeed - The speed to be used. If you don't know, look up ColorSpeedTolerance.
splitX - The size of the object across the X axis.
splitY - The size of the object across the Y axis.
*******************************************************************************}
function SaFindObjectColorArray(arr: array of Integer; upTexts: TStringArray; colorSpeed,splitX,splitY: Integer): TPoint;
var
color,tolerance: Integer;
hm,sm: Extended;
begin
HueSatTolCol(hm,sm,tolerance,color,arr,colorSpeed);
Result := SaFindObjectTPA(color,upTexts,hm,sm,colorSpeed,tolerance,splitX,splitY);
end;

Function FindFish(var Spot: TPoint; x1, y1, x2, y2: Integer) : Boolean;
Var
CTS, I: Integer;
Spott: TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.10, 0.24);
FindColorsSpiralTolerance(MSCX, MSCY, Spott, 11972264 , x1, y1, x2, y2, 13);
//DebugTPA(Spott, 'lll');
If Length(Spott) < 1 then
begin
Writeln('Error, couldn''t find fishing spot!');
Result := False;
exit;
end;
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(Spott, 6, 6);
For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], Spot.x, Spot.y);
If not (distance(Spot.x, Spot.y, MSCX, MSCY) > 200)then
begin
Result := True;
Break;
end;
end;
end;
{*******************************************************************************
function SaFindObjectTPA(color: Integer; upTexts: TStringArray; huemod, satmod: Extended; colorSpeed, tolerance, splitX, splitY: Integer): TPoint;
By: Tniffoc
Description: Returns the x,y coordinates of the object defined by the arguments
on the main screen.
Valid Arguments:
color - The color the the object
upTexts - All the possible up texts for the object being found
huemod - The hue modifier (only applicable if you are using colorSpeed 2)
satmod - The sat modifier (only applicable if you are using colorSpeed 2)
colorSpeed - The speed to be used. If you don't know what this is, look it up.
tolerance - The tolerance to be used when finding the object.
splitX: The size of the object across the x axis.
splitY: the size of the object across the y axis.
*******************************************************************************}
function SaFindObjectTPAEx(color: Integer; upTexts: TStringArray; huemod, satmod: Extended; colorSpeed, tolerance, splitX, splitY: Integer; sortPoint: TPoint): TPoint;
var
cts,i,sax,say,count: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(colorSpeed);
if(colorSpeed = 2) then
SetColorSpeed2Modifiers(huemod,satmod);
FindColorsSpiralTolerance(MSCX,MSCY,TPA,color,MSX1,MSY1,MSX2,MSY2,tolerance);
SortTPAFrom(TPA,sortPoint);
DebugTPA(TPA,'');
i := Length(TPA);
if((i > splitX) and (i > splitY)) then
begin
ATPA := SplitTPAEx(TPA,splitX,splitY);
for i:=0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i],sax,say);
MMouse(sax,say,2,2);
wait(500 + random(500));
wait(200 + random(500));
for count:=0 to High(upTexts) do
begin
if(IsUpText(upTexts[count])) then
begin
GetMousePos(sax,say);
Result := Point(sax,say);
ColorToleranceSpeed(cts);
Exit;
end;
end;
end;
end else
begin
for i:=0 to High(TPA) do
begin
MMouse(TPA[i].x,TPA[i].y,2,2);
wait(500 + random(500));
wait(200 + random(500));
if(IsUpText(upTexts[count])) then
begin
GetMousePos(sax,say);
Result := Point(sax,say);
ColorToleranceSpeed(cts);
Exit;
end;
end;
end;
Result := Point(0,0);
end;
{*******************************************************************************
function SaFindObjectColorArray(arr: array of Integer; upTexts: TStringArray; colorSpeed,splitX,splitY: Integer): TPoint;
By: Tniffoc
Description: Finds the object defined by the parameters.
Valid Arguments:
arr - An array of colors from the object.
upTexts - An array of strings possible for the UpTexts of the object ex. 'illow' for willow.
colorSpeed - The speed to be used. If you don't know, look up ColorSpeedTolerance.
splitX - The size of the object across the X axis.
splitY - The size of the object across the Y axis.
*******************************************************************************}
function SaFindObjectColorArrayEx(arr: array of Integer; upTexts: TStringArray; colorSpeed,splitX,splitY: Integer; sortPoint: TPoint): TPoint;
var
color,tolerance: Integer;
hm,sm: Extended;
begin
HueSatTolCol(hm,sm,tolerance,color,arr,colorSpeed);
Result := SaFindObjectTPAEx(color,upTexts,hm,sm,colorSpeed,tolerance,splitX,splitY,sortPoint);
end;
function FindSailor(var Spot: TPoint): Boolean;
var
colors: array of Integer;
p: TPoint;
i: Integer;
begin
colors := [7884600,7490357,8870207,8475964];
p := Point(0,0);
while((i < 6) and (p.x = 0) and (p.y = 0)) do
begin
p := SaFindObjectColorArray(colors,['eaman','orris','resnor'],2,5,5);
if((p.x = 0) and (p.y = 0)) then
Result := false
else
begin
Result := true;
Spot := p;
end;
Inc(i);
end;
end;
function FindGankPlank(var Spot: TPoint; b: Boolean): Boolean;
var
p: TPoint;
begin
if b then
MakeCompass('S')
else
MakeCompass('E');
SetAngle(false);
p := SaFindObjectColorArrayEx([2243147,2506835,3166569,3562358],['plank'],3,5,5,Point(MSCX,MSCY+40));
if((p.x = 0) and (p.y = 0)) then
Result := false
else
Result := true;
Spot := p;
end;
procedure SeamanToKaraDock;
var
p: TPoint;
i: Integer;
begin
if(FindSailor(p)) then
begin
Mouse(p.x,p.y,0,0,true);
wait(1000 + random(500));
i := 0;
while(i < 10) do
begin
if(ClickContinue(false,false)) then
break
else
begin
FindSailor(p);
Mouse(p.x,p.y,0,0,true);
wait(1000 + random(500));
end;
Inc(i);
end;
if(i > 10) then
begin
Players[CurrentPlayer].Active := false;
Exit;
end;
FFlag(0);
wait(250 + random(250));
ClickContinue(true,true);
ClickContinue(true,true);
MouseBox(226, 398, 292, 406, 1);
wait(500 + random(200));
ClickContinue(true,true);
i := MSCX xor MSCX;
while(i < 10) do
begin
if(ClickContinue(false,false)) then
break;
wait(1000 + random(500));
Inc(i);
end;
if(i > 10) then
begin
Players[CurrentPlayer].Active := false;
Exit;
end;
if(FindGankPlank(p,true))then
begin
Mouse(p.x,p.y,0,0,true);
end;
end;
end;
var
p: TPoint;
begin
ActivateClient;
SetupSRL;
SeamanToKaraDock;
Writeln(IntToStr(p.x) + ',' + IntToStr(p.y));
end.

noidea

2009-04-01 21:09:17

This sounds awsome. I could help if you need me :)

Iron Man

2009-04-01 21:55:12

I'll join if we plan to not continue the Cooks Assistant. If we are still going to work on it, I'll join once that project is done.

mormonman

2009-04-01 22:25:11

I'll join.

Tniffoc

2009-04-02 00:34:31

I'm posting a list of Devs in the first post.

mormonman

2009-04-02 01:02:40

Hmm… I don't know where to try to start.

noidea

2009-04-02 01:35:30

First we should get all the people that are going to work on it, then assign parts.

Blumblebee

2009-04-02 02:03:41

yeah toss me in I guess :/

mormonman

2009-04-02 02:08:04

From: Blumblebee
yeah toss me in I guess :/


yeah blum!!! i call i don't do walkin :p (jokes)

Tniffoc

2009-04-02 02:51:39

I'll leave the thread up a little longer (1 day?) then we can start our work.

noidea

2009-04-02 02:57:59

From: Tniffoc
I'll leave the thread up a little longer (1 day?) then we can start our work.


No, this is a big project, we are going to need more people than we can get in one day.

Tniffoc

2009-04-02 03:01:46

From: noidea
No, this is a big project, we are going to need more people than we can get in one day.


Ok, but we should probably start dividing up some tasks in the near future. To make our lives easier, I could apply my massive object-finding framework to the project?

Sir R. M8gic1an

2009-04-02 03:04:19

hummm…. if you guys want to use my fisher go ahead. all you'd need to change would be the Relocate function.

~RM

Tniffoc

2009-04-02 03:10:14

I'd rather start from scratch although if you're fishing spot finder is good that could be usefull.

ZephyrsFury

2009-04-02 03:22:41

Isn't a Karamja Fisher like a bit too simple for a team script?

noidea

2009-04-02 03:28:53

From: ZephyrsFury
Isn't a Karamja Fisher like a bit too simple for a team script?


A flawless Karamja fisher?

ZephyrsFury

2009-04-02 03:31:45

No script is flawless, but I'd expected a team script especially an MSI script to be something like the previous idea we had - a Varrock Pwner.

NiCbaZ

2009-04-02 06:40:42

Zeph, you should know by now projects like that never get done.

kingarabian

2009-04-02 07:09:43

I'll help if you need anythng reflection wise. Just use methods paste bin for the latest hooks. They are updated nearly instantly.

Tniffoc

2009-04-02 11:07:05

From: ZephyrsFury
Isn't a Karamja Fisher like a bit too simple for a team script?


Most people get a basic fisher done but by that point, they're so tired of scripting they release too early and it never gets perfected. With a team, it can be as close to flawless as we can get.

Dervish

2009-04-02 11:29:08

Can I join ?

I'll help for anti ban and stuff ? :p.

Tniffoc

2009-04-02 11:32:02

From: Dr D. Dervish
Can I join ?

I'll help for anti ban and stuff ? :p.


Sure! in.

EDIT: I think 1 more developer would be a good number for the start, but more help is always appreciated.

kingarabian

2009-04-02 16:52:09

When are you guys starting?

Tniffoc

2009-04-02 18:03:55

Very soon. The only thing left is to decide whether or not to use reflection. I would prefer to stay away from it though as it was stated in the first post of this thread.

mormonman

2009-04-02 18:05:12

No Reflection. Way more reliable atm. Especially with the shutdown and compass things going on. Maybe after it is fixed, make one version with reflection walking.

Tniffoc

2009-04-02 18:11:40

Same thoughts here. I'm going to maintain the script just via the thread at first so post what you have for it on this thread. We already have a fishing spot finder thanks to noidea. He claims it is flawless and he will pm it to me later. I'll post up what I've got so far as my object finding framework which takes an array of colors instead of all those complicated args and works with all three CTS. It'll take me a few minutes to assemble the script then it will be in SCAR tags in the initial post. Just post what you've got.

And. the decision has been made: No Reflection

EDIT: Script Posted

EDIT1: Added this.

function FindSailor(var Spot: TPoint): Boolean;
var
colors: array of Integer;
p: TPoint;
begin
colors := [7884600,7490357,8870207,8475964];
p := SaFindObjectColorArray(colors,['eaman','orris','resnor'],2,5,5);
if((p.x = 0) and (p.y = 0)) then
Result := false
else
begin
Result := true;
Spot := p;
end;
end;

Blumblebee

2009-04-02 22:29:16

if I'm gunna do this i would like it to be more organized. Like certain procedures ect that are required ect. I could do some of the walking I guess but I'm a tad lazy so i dunno about doing all of it haha

edit: i whipped these up, they are untested and probably dont work haha but w/e. if someone would like to improve on them, or SniffCock if you wanna add your color finding shinanigans to it be my guest.

Function FindFishingSpot(var X, Y: Integer; UpTexts: TStringArray): Boolean;
var P: TPoint; TPA: TPointArray; ATPA: T2DPointArray; CTS, L, i: Integer;
begin
try
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.25, 0.03);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 11577763, MSX1, MSY1, MSX2, MSY2, 3);
SortTPAFrom(TPA, Point(MSCX, MSCY));
ATPA := SplitTPAEx(TPA, 25, 25);
L := High(ATPA);
for i := 0 to L do
begin
P := MiddleTPA(ATPA[i]);
MMouse(P.x, P.y, 5, 5);
Wait(150 + Random(150));
if IsUpTextMultiCustom(UpTexts) then
begin
if (X <> 0) and (Y <> 0) then
begin
Result := True;
GetMousePos(X, Y)
Break;
end else
Continue;
end;
end;
finally
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
except end;
end;

Function CheckSpot(var X, Y: Integer): Boolean;
var CTS: Integer; P: Tpoint; TPA: TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.25, 0.03);
FindColorsTolerance(TPA, 11577763, X - 25, Y - 25, X + 25, Y + 25, 3);
if Length(TPA) <= 0 then
begin
WriteLn('Spot Gone, Moving On');
Result := False;
end else
begin
P := MiddleTPA(TPA);
GetMousePos(Fx, Fy);
Result := True;
end;
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;

noidea

2009-04-02 22:58:23

We need to asign parts.
Plus, i really, Really love this function. It helps allllllloooootttt for walking.

//took from one of Home's scripts / thanks :)
procedure AlignMM(Direction: Char);
var DTM, x, y, i: integer;
acc: extended;
begin
MakeCompass(Direction)
DTM := DTMFromString('78DA634C676260086240016F9F7C641001D28' +
'C40FC1F0818416AFC71AB0101B09A7022D44413A1C60BBF1A009F' +
'1015DF');
wait(50)
if FindDtmRotated(DTM, x, y, MMX1, MMY1, MMX2, MMY2, radians(-40), radians(40), 0.01, acc) then
begin
if (acc < 0.1) and (acc > -0.1) then
exit
else
begin
repeat
if FindDtmRotated(DTM, x, y, MMX1, MMY1, MMX2, MMY2, radians(-40), radians(40), 0.01, acc) then
begin
if acc < 0 then
begin
KeyDown(VK_RIGHT)
Wait(20 + random(10))
KeyUp(VK_RIGHT)
end;
if acc > 0 then
begin
KeyDown(VK_LEFT)
Wait(20 + random(10))
KeyUp(VK_LEFT)
end;
if acc = 0 then break;
end else
exit;
wait(20)
Inc(i)
until (((acc < 0.1) and (acc > -0.1)) or (i > 25))
end;
end else MakeCompass(Direction);
freeDtm(DTM)
end;

Special Ed

2009-04-02 23:19:02

Btw, there is an MSI dedicated SVN that I already have set up you can use. There's a thread about it in the MSI forum.

Another thought would be to incorporate some lesser demon / spider killing as well to give this project some more "tasks" to work on.

noidea

2009-04-02 23:24:04

From: Special Ed
Btw, there is an MSI dedicated SVN that I already have set up you can use. There's a thread about it in the MSI forum.

Another thought would be to incorporate some lesser demon / spider killing as well to give this project some more "tasks" to work on.


So like a Karajma do-er?

Tniffoc

2009-04-03 00:52:40

We may make that later, but for now, it's fishing first. I want to get fishing done, then we may add other things.

Dervish

2009-04-03 02:07:38

Thanks for letting me in, I'll work on it when I get back from school :

I'll manage :

SetUp
AntiBan
and any other little but helpful stuff you'd want :p.

noidea

2009-04-03 02:11:16

Btw, every one, the irc channel is

#srl:karaProject

Tniffoc

2009-04-03 02:37:24

From: noidea
Btw, every one, the irc channel is

#srl:karaProject


I added it to the first message as well.

Sir R. M8gic1an

2009-04-03 07:12:06


Function FindFishSpot(var TPA:TPointArray): Boolean;
var
ATPA: T2DPointArray;
TimeMark, i, tmpCTS: Integer;
TP: TPoint;
begin
if not LoggedIN then exit;
writeln('FindFishSpot: Looking for fish spot');
Result := False;
MarkTime(TimeMark);

tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.12, 0.27);

FindColorsSpiralTolerance(MSCX, MSCY, TPA, 11379611, MSX1, MSY1, MSX2, MSY2, 11);

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

TimeMark := TimeFromMark(TimeMark);

if Length(TPA) <= 0 then
begin
writeln('FindFishSpot: Couldn''t find fish spot - TPA <= 0');
exit;
end;


ATPA := SplitTPA(TPA, 10);
SortATPAFrom(ATPA, IntToPoint(MSCX, MSCY));

SetLength(TPA, Lenght(ATPA));
for i := 0 to High(ATPA) do
begin
TP := MiddleTPA(ATPA[i]);
//if FindWhirlPoolXY(TP.x, TP.y) then Continue;
TPA[i] := TP;
end;

writeln('FindFishSpot: Could not find fish spot');

end;

this will give you a TPA with the centre of all fish spots. in karamja you might need to check a few of them to find what you're looing for (some are only cage, some are only harpoon)

in my version it rules out the whirlpools, but i commented it out.

~RM

noidea

2009-04-03 11:05:25

Mine finds all of them, then goes through the Array, and returns the closest one.

Sir R. M8gic1an

2009-04-03 12:48:33

From: noidea
Mine finds all of them, then goes through the Array, and returns the closest one.


closest one might not you be what you need in karamja, as i said, in karamja some spots are harpoon only, some are cage only.

~RM

noidea

2009-04-03 12:59:42

From: Rasta Magician
closest one might not you be what you need in karamja, as i said, in karamja some spots are harpoon only, some are cage only.

~RM


No, if the uptext is 'cage' then if you right click, there WILL be and option of harpooning.

noidea

2009-04-05 01:54:32

Here: My part: Dock –> Fishes / Fishies –> Dock;

program New;
{.include srl/srl.scar}


//Thank Wizzup? !
Function DebugTPA(Points: TPointArray; BmpName: String): Boolean;

Var
Width, Height, ClientBMP, I: Integer;
xs, ys, xe, ye: Integer;

Begin
Try
Begin
xe := xs xor xs;
ye := ys xor ys;
xs := 1 shl 20;
ys := 1 shl 20;

For I := 0 To High(Points) Do
Begin
xs := Min(xs, Points[i].X);
ys := Min(ys, Points[i].Y);

xe := Max(xe, Points[i].X);
ye := Max(ye, Points[i].Y);
End;

Width := xe - xs;
Height := ye - ys;

DisplayDebugImgWindow(0, 0);
DisplayDebugImgWindow(Width, Height);
ClientBMP := BitmapFromString(Width, Height, '');

CopyClientToBitmap(ClientBMP, xs, ys, xe, ye);
For I := 0 To High(Points) Do
FastSetPixel(ClientBMP, Points[i].X - xs, Points[i].Y - ys, 255);
If BmpName <> '' Then
SaveBitmap(ClientBMP, ScriptPath + BmpName + '.bmp');
SafeDrawBitmap(ClientBMP, GetDebugCanvas, 0, 0);
DisplayDebugImgWindow(Width, Height);

FreeBitmap(ClientBMP);
End
Except
FreeBitmap(ClientBMP);
End;
Result := True;
End;


Procedure KaraWrite( Mess : String );
begin
writeln('Karamja Island : '+mess+'.');
end;



//took it out of one of Home's scripts...
procedure AlignMM(Direction: Char);
var DTM, x, y, i: integer;
acc: extended;
begin
MakeCompass(Direction)
DTM := DTMFromString('78DA634C676260086240016F9F7C641001D28' +
'C40FC1F0818416AFC71AB0101B09A7022D44413A1C60BBF1A009F' +
'1015DF');
wait(50)
if FindDtmRotated(DTM, x, y, MMX1, MMY1, MMX2, MMY2, radians(-40), radians(40), 0.01, acc) then
begin
if (acc < 0.1) and (acc > -0.1) then
exit
else
begin
repeat
if FindDtmRotated(DTM, x, y, MMX1, MMY1, MMX2, MMY2, radians(-40), radians(40), 0.01, acc) then
begin
if acc < 0 then
begin
KeyDown(VK_RIGHT)
Wait(20 + random(10))
KeyUp(VK_RIGHT)
end;
if acc > 0 then
begin
KeyDown(VK_LEFT)
Wait(20 + random(10))
KeyUp(VK_LEFT)
end;
if acc = 0 then break;
end else
exit;
wait(20)
Inc(i)
until (((acc < 0.1) and (acc > -0.1)) or (i > 25))
end;
end else MakeCompass(Direction);
freeDtm(DTM)
end;





{********************************************
Function : function FindKaramjaRoadColor: Integer;
Author : noidea
Description : Finds the Karamja Road Color.
*********************************************}
function FindKaramjaRoadColor: Integer;
var
R, G, B, GC, TestColor, i: Integer;
H, S, L, X, Y, Z: Extended;
Colors: TPointArray;
begin
GC := 1276824;
FindColorsSpiralTolerance(MSCX, MSCY, Colors, GC, MMX1, MMY1, MMX2, MMY2, 60);
if Length(Colors) = 0 then
begin
Writeln('Couldnt find Karajma Road Color!');
Result := 0;
exit;
end;
for i := 0 to high(Colors)-1 do
begin
if RS_OnMinimap(Colors[i].X, Colors[i].Y) then
begin
TestColor := GetColor(Colors[i].X, Colors[i].Y);
if SimilarColors(TestColor, GC, 60) then
begin
ColorToRGB(TestColor, R, G, B);
ColorToHSL(TestColor, H, S, L);
ColorToXYZ(TestColor, X, Y, Z);
if InRange(R - G, 9, 52) then
if InRange(R - B, 113, 153) then
if InRange(G - B, 70, 134) then
if InRange(Round(S) - Round(H), 50, 80) then
if InRange(Round(L) - Round(H), 6, 36) then
if InRange(Round(S) - Round(L), 27, 57) then
if InRange(Round(X) - Round(Y), - 8, 6) then
if InRange(Round(Y) - Round(Z), 10, 24) then
if GetColor(Colors[i].X + 2, Colors[i].Y + 2) = TestColor then
if GetColor(Colors[i].X + 1, Colors[i].Y + 1) = TestColor then
begin
Writeln('Karajma Road Color = ' + Inttostr(TestColor));
Result := TestColor;
Exit;
end;
end;
end;
end;
Writeln('Couldnt find Karajma Road Color!');
Result := 0;
end;


{********************************************
Function : Function FindBridgeColor2: Integer;
Author : noidea
Description : Made this since the old one is
broken. It find the bridge color.
*********************************************}
Function FindBridgeColor2: Integer;
var
p: Array of TPoint;
GC, i, testColour1, c, x, y: Integer;
begin
If WaterColor = 0 then
WaterColor := FindWaterColor;
If FindWaterColor = 0 then
begin
Writeln('There was no water nearby!');
Result := 0;
exit;
end;
GC := 10803;
FindColorsSpiralTolerance(MMCX, MMCY, P, GC, MMX1, MMY1, MMX2, MMY2, 65);
//debugtpa(p, '');
If length(p) = 0 then
begin
writeln('Unable to find Bridge Color!');
result := 0;
exit;
end;
c := GetArrayLength(P);
For i := 0 to c - 1 do
begin
if rs_OnMinimap(P[i].x,P[i].y) then
begin
TestColour1 := GetColor(P[i].x, P[i].y);
if GetColor(P[i].x - 2, P[i].y) = TestColour1 then
if getcolor(P[i].x + 4 , P[i].y + 4) = testcolour1 then
if FindColor(x, y, WaterColor, P[i].x - 3, P[i].y - 3, P[i].x + 3, P[i].y + 3) then
begin
Result := TestColour1;
Writeln('Bridge color = '+inttostr(Result));
exit;
end;
end;
end;
Writeln('Could not find Bridge Color!');
Result := 0;
end;


{********************************************
Function : Function FindStoreFloorColor: Integer;
Author : noidea
Description : Find the colour of the Shops floor
on the MM.
*********************************************}
Function FindStoreFloorColor: Integer;
var
testColor, i, c, GC : Integer;
TPA : TPointArray;
begin
GC := 3953001;
FindColorsSpiralTolerance(mmcx, mmcy, TPA, GC, mmx1, mmy1, mmx2, mmy2, 60);
if Length(TPA) = 0 then
begin
writeln('Couldnt find Store Floor Color!');
Result := 0;
exit;
end;
c := Getarraylength(TPA);
for i := 0 to c - 1 do
begin
if rs_OnMinimap(TPA[i].x, TPA[i].y) then
begin
TestColor := GetColor(TPA[i].x, TPA[i].y);
If SimilarColors(GC, TestColor, 30) then
begin
if GetColor(TPA[i].x - 8, TPA[i].y - 6) = TestColor then
if GetColor(TPA[i].x + 3, TPA[i].y + 4) = TestColor then
if GetColor(TPA[i].x - 5, TPA[i].y + 2) = TestColor then
begin
result := TestColor;
writeln('Store Floor Color = '+inttostr(result));
exit;
end;
end;
end;
end;
writeln('Couldnt find Store Floor Color!');
Result := 0;
end;

{********************************************
Function : Function GSW(Colour, Toler, SR, ER, Rad, xOffSet, yOffSet: Integer): Boolean;
Author : noidea
Description : Just like RadialWalking but,
user defines how many pixels up or down,
left or right, it clicks
*********************************************}
Function GSW(Colour, Toler, SR, ER, Rad, xOffSet, yOffSet: Integer): Boolean;
var
orly: TPointArray;
I: Integer;
begin
if RadialWalkEx(orly, MMCX, MMCY, Colour, Toler, SR, ER, Rad) then
for I := 0 to High(orly) do
begin
repeat
mouse(orly[I].x + xOffSet, orly[I].y + yOffset, 3, 3, true);
wait(400+random(200));
until flagPresent;
wait(200+random(200));
Result := FlagPresent;
Flag;
wait(100);
break;
end;
end;

//Small edit until CountFlag() is fixed.
function _RadialRoadWalk(TheColor: Integer; StartRadial, EndRadial: Integer; Radius: Integer; Xmod, Ymod: Integer): Boolean;
var
tpa: TPointArray;
i: Integer;
begin
Result := False;
if (not LoggedIn) then Exit;
if (RoadColorChecker) then
if (DebugRadialRoad) then
WriteLn(' THROUGH _RadialRoadWalk= ---> ' + IntToStr(RoadColor));
if RadialWalkEx(tpa, MMCX, MMCY, TheColor, 0, StartRadial, EndRadial, Radius) then
for i := 0 to High(tpa) do
if MFNF(tpa[i].x, tpa[i].y, Xmod, Ymod) then
begin
Flag;//Flagg;//CountFlag(10);
Result := True;
Break;
end;
end;



Function DockToTPoint(var Black : TPoint) : Boolean;
var
i, c, col : Integer;
dc: Array of TPoint;
begin
FindColorsSpiralTolerance(mmcx, mmcy, dc, 65536, mmx1, mmy1, mmx2, mmy2, 0);
col := FindBridgeColor2;
if Length(dc) = 0 then exit;
c := GetArrayLength(dc);
for i := 0 to c - 1 do
begin
if not getcolor(dc[i].x, dc[i].y - 2) = 195836 then
if GetColor(dc[i].x, dc[i].y - 2) = col then
if GetColor(dc[i].x, dc[i].y + 6) = FindWaterColor then
begin
Black.x := dc[i].x;
Black.y := dc[i].y;
Result := true;
exit;
end;
end;
KaraWrite('Didnt find with DockToTPoint!');
black.x := 0;
black.y := 0;
end;


Function IsNearAbsoluteBridge: Boolean;
var
cc : Array of TPoint;
i, c, kc, bc : Integer;
begin
kc := FindKaramjaRoadColor;
bc := FindBridgecolor2;
FindColorsTolerance(cc, FindBridgeColor2, mmx1, mmy1, mmx2, mmy2, 0)
if Length(cc) = 0 then
begin
KaraWrite('Couldnt find bridge color! -Near bridge-');
result := false;
exit;
end;
c := GetArrayLength(cc);
for i := 0 to c - 1 do
begin
if getcolor(cc[i].x, cc[i].y + 3) = kc then
if Getcolor(cc[i].x, cc[i].y - 3) {= FindBridgeColor2} or
getColor(cc[i].x - 1, cc[i].y - 3) = bc then
begin
Result := (Distance(mmcx, mmcy, cc[i].x, cc[i].y) > 89);
KaraWrite('Near bridge '+booltostr(result));
exit;
end;
end;
Result := false;
KaraWrite('Near bridge '+booltostr(result));
end;





Procedure KaraDockToFishies;
var
bc, kc, i, x, y, ii, ki : INteger;
one: Boolean;
begin
AlignMM('n');
setrun(false);
SetAngle(true);
kc := FindKaramjaRoadColor;
WaterColor := FindWaterColor;
bc := FindBridgeColor2;
for i := 0 to 7 do
begin
One := True;
case i of
0 : If not _RadialRoadWalk(kc, 255, 315, 60, 2, 2) then
If not GSW(bc, 0, 275 - 10, 275 + 10, 40, 30, 0) then
one := False;
1 : If not _RadialRoadWalk(kc, 265, 325, 60, 2, 2) then
if not GSW(FindStoreFloorColor, 0, 275 - 20, 275, 62, - 10, - 15)then
one := False;
2 : If not _RadialRoadWalk(kc, 255, 315, 60, 2, 2) then
if FindSymbol(x, y, 'water') then
begin
mouse(x, y - 50, 3, 3, true);
KaraWrite('Used water symbol');
wait(100);
flag;
end else One := False;
3 : If not _RadialRoadWalk(kc, 260, 325, 60, 2, 2) then
if not GSW(FindStoreFloorColor, 0, 270, 280, 60, - 0, -20) then
One := False;
4 : If not _RadialRoadWalk(kc, 300, 380, 60, 2, 2) then
begin
mouse(613+4, 31 + 3, 3, 3, true);
KaraWrite('Bind clicked -step 4-');
flag;
end;
5 : begin
if IsNearAbsoluteBridge then
if not _RadialRoadWalk(kc, 355, 365, 20, 2, 2)then
begin
mouse(mmcx, mmcy - 8, 3, 4, true);
flag;
end;
end;
6 : begin
one := false;
bc := FindBridgeColor2;
for ii := 0 to 30 do
begin
If GSW(bc, 0, 0, 55, 40 + ii, 35, 40)then
begin
flag;
KaraWrite('Found bridge at '+inttostr(ii)+' try');
one := true;
break;
end;
end;
if not One then
If not GSW(kc, 0, 5, 60, 50, 20, 15) then
One := False;
end;

7 : begin
one := false;
ii := 0;
for ii := 0 to 15 do
begin
If RadialWalk(bc, 35, 95, 55, 0, 2)then
begin
flag;
KaraWrite('Found fishing bridge at '+inttostr(ii)+' try');
one := true;
break;
end;
end;
if not one then
if FindSymbol(x, y, 'Fishing spot') then
begin
mouse(x + 3, y, 3, 3, true);
KaraWrite('Used fishing symbol! -Onto fishing bridge-');
flag;
one := true;
end else One := False;
end;
end;
KaraWrite('Step : '+inttostr(i)+'; Made it there : '+BoolToStr(One));
wait(500+random(200));
If One then
ki := 0;
if not One then
begin
dec(i);
inc(ki);
if ki > 4 then
begin
KaraWrite('Player was lost while walking! Setting Player false');
logout;
Players[CurrentPlayer].active := false;
exit;
end;
end;
end;
end;




Procedure FishiesToKaraDock;
var
bc, kc, i, x, y, ki : INteger;
one: Boolean;
n : TPoint;
begin
AlignMM('n');
setrun(false);
SetAngle(true);
kc := FindKaramjaRoadColor;
WaterColor := FindWaterColor;
bc := FindBridgeColor2;
for i := 0 to 7 do
begin
one := true;
case i of
0 : begin
one := false;
if GSW(WaterColor, 0, 275, 285, 50, 0, + 20)then
begin
one := true;
KaraWrite('Used gsw to water');
flag;
end;
if not One then
if Findsymbol(x, y, 'fishing spot') then
begin
mouse(x - 40, y + 20, 3, 3, true);
KaraWrite('used symbol to get off fishing bridge');
flag;
one := true;
end else one := false;
end;

1 : if not _RadialRoadWalk(FindKaramjaRoadColor, 260, 280, 65, 2, 2) then
if not GSW(FindBridgeColor2, 0, 280, 360, 55, -10, 20)then
one := false;

2 : If IsNearAbsoluteBridge then
begin
mouse(mmcx, mmcy + 15, 4, 4, true);
KaraWrite('We were to close to the bridge on the way back');
flag;
end;

3 : if not _RadialRoadWalk(FindKaramjaRoadColor, 215, 160, 57, 2, 2) then
if not GSW(WaterColor, 0, 240, 180, 60, + 20, 0) then
one := false;

4 : if not _RadialRoadWalk(FindKaramjaRoadColor, 80, 160, 60, 2, 2) then
if not GSW(FindStoreFloorColor, 0, 180, 160, 50, 15, - 5)then
if findsymbol(x, y, 'store') then
begin
KaraWrite('Used store symbol, fail safe');
mouse(x + 20, y, 3, 3, true);
flag;
end else one := false;

5 : If not GSW(FindKaramjaRoadColor, 0, 70, 110, 60, 0, 5) then
if not GSW(FindStoreFloorColor, 0, 160, 90, 64, 0, -20) then
if findsymbol(x, y, 'water') then
begin
mouse(x + 15, y - 30, 3, 3, true);
KaraWrite('Used water symbol, fail safe ');
flag;
end else one := false;
6 : if not _RadialRoadWalk(FindKaramjaRoadColor, 10, 130, 65, 2, 2) then
begin
mouse(686, 99, 3, 3, true);
KaraWrite('Used blind click on step 6');
flag;
end;

7 : begin
If DockToTPoint( n ) then
begin
mouse(n.x, n.y - 4, 3, 3, true);
KaraWrite('Used docktotpoint');
flag;
end else one := false;
if not one then
begin
if not GSW(FindBridgeColor2, 0, 80, 110, 50, 0, 6) then
begin
mouse(mmcx + 20, mmcy, 3, 3, true);
KaraWrite('Used mouse to bridge 7th step');
flag;
end else
begin
if Findsymbolin(x, y, 'transportation', 553, 62, mmx2, mmy2)then
begin
if Distance(mmcx, mmcy, x, y) < 13 then
begin
KaraWrite('We have successfully made it to the dock');
exit;
end;
end;
end;
if DockToTPoint(n) then
begin
mouse(n.x, n.y - 4, 3, 3, true);
KaraWrite('Used DockToTPoint try 2');
KaraWrite('We have successfully made it to the dock');
flag;
exit;
end else
if Findsymbolin(x, y, 'transportation', 553, 62, mmx2, mmy2) then
begin
mouse(x, y, 3, 3, true);
flag;
KaraWrite('Used symbol trans on bridge');
KaraWrite('We have successfully made it to the dock');
exit;
end else One := false;
end;
end;
end;
KaraWrite('Step : '+inttostr(i)+'; Made it there : '+booltostr(one));
wait(500+random(200));
If One then
ki := 0;
if not One then
begin
dec(i);
inc(ki);
if ki > 4 then
begin
KaraWrite('Player was lost while walking!');
logout;
Players[CurrentPlayer].active := false;
exit;
end;
end;
end;
end;


Function InKaramja: Boolean;
var x, y: Integer;
begin
If FindColor(x, y, FindKaramjaRoadColor, mmx1, mmy1, mmx2, mmy2) then
If FindColor(x, y, FindWaterColor, mmx1, mmy1, mmx2, mmy2) then
If FindColor(x, y, FindBridgeColor2, mmx1, mmy1, mmx2, mmy2) then
result := true;
end;


Function SetupKaramjaWalking: Boolean;
begin
if FindKaramjaRoadColor = 0 then
begin
KaraWrite('We were unable to find the Karamja Road Color');
KaraWrite('This is a massive problem');
KaraWrite('Please let the authors of the script know, and post on the thread');
Players[CurrentPlayer].Active := False;
logout;
result := false;
exit;
end;
Result := InKaramja;
end;




var c: Array of TPoint;
cc: TPoint;
ii,bc : Integer;
begin
setupsrl;
symbolaccuracy := 0.45;
//DockToTPoint(cc);
//mmouse(cc.x, cc.y, 0, 0);
//writeln(Booltostr(SetupKaramjaWalking));
//FindColor(cc.x, cc.y, FindBridgeColor2, mmx1, mmy1, mmx2, mmy2)
//mmouse(cc.x, cc.y, 0, 0);

repeat
KaraDockToFishies;
FishiesToKaraDock;
until false
//FindColorsTolerance(c, FindBridgeColor2, MMX1, MMY1, MMX2, MMY2, 0);
//DebugTPA(c, ''); }
end.

//KaraDockToFishies;
//FindStoreFloorColor
//FindKaramjaRoadColor
//Findbirdgecolor2
//IsNearAbsoluteBridge;
//FindColorsTolerance(c, Findbridgecolor2, MMX1, MMY1, MMX2, MMY2, 0);
//DebugTPA(c, '');
//DockToTPoint(dc);
//mmouse(dc.x, dc.y, 1, 1);

Special Ed

2009-04-05 18:41:04

Anything I could help with? You need something setup with the SvN or anything?

lordsaturn

2009-04-05 19:05:39

So do we have a repository set up? Because if not I can create one in about 10 seconds…

noidea

2009-04-05 19:14:54

Tniffoc is maintaining everything (giving out parts ect..) afaik

Tniffoc

2009-04-05 19:23:01

From: noidea
Tniffoc is maintaining everything (giving out parts ect..) afaik


I'm maintaining it so far. I'll post who's doing what and what's done in the first post. When you finish something post it in the thread. Before you start something, pm me so I know. If this gets much bigger I'll set up a repository though.


~Tniffoc

noidea

2009-04-05 20:04:32

Well, I have added al my shiz like 4 posts above yours.

lordsaturn

2009-04-05 20:46:01

SVN - http://code.google.com/p/srlkara/

Just made the first commit.

If you want to be added to the project, post your email.

Mjordan

2009-04-05 20:47:05

Wow I thought MSI was dead.

noidea

2009-04-05 21:04:52

[email]smiley.puma@gmail.com[/email]

mormonman

2009-04-05 21:38:37

[email]the_dog_hunter@hotmail.com[/email]

Special Ed

2009-04-05 21:59:33

[email]retributioncomm@gmail.com[/email]

Blumblebee

2009-04-05 22:09:04

[email]smiley_wisecracker@hotmail.com[/email]

(my old one dont wanna give out my current, dont judge me :p)

lordsaturn

2009-04-05 22:17:23

Blumblebee and mormonman, you have to sign up for an account at code.google.com before I can add you to the project member list.

mormonman

2009-04-05 22:19:15

hmm… here is my gmail [email]tlsdude@gmail.com[/email]

Blumblebee

2009-04-05 22:19:30

hmmm i cant remeber but I'm pretty sure Tniffoc made me one a while back, I'll ask him.

Iron Man

2009-04-05 23:01:24

[email]quinn.l.white@gmail.com[/email]

I'll start helping once I'm finished this script I'm working on, which hopefully won't take too much longer…

Special Ed

2009-04-05 23:36:54

So what is there to be done, who's working on what?

noidea

2009-04-05 23:38:33

From: Special Ed
So what is there to be done, who's working on what?


Yea, we need a checklist.

Karamja Island walking is finished ;)

lordsaturn

2009-04-06 00:06:30

[x] Walking - noidea/Tniffoc
[ ] Fishing
[ ] Antiban
[ ] Counting
[ ] Responder
[ ] Main Loop

Anything else?
Btw I will keep all info current on the google code project page.

mormonman

2009-04-06 00:18:44

I'm doing walking to Sailor from Bank, and to Bank from Sailor…

noidea

2009-04-06 00:21:23

We could elaborate on MK's responder. Its great OMHO.
Procedure SetupResponds;
begin
HowManyResponds := 2;
SetArrayLength(TheQuestion, HowManyResponds); SetArrayLength(TheRespond, HowManyResponds);
TheQuestion[0] := ['noob'];
TheRespond[0] := ['Im not a noob!', 'your the noob', 'look in the mirror', 'noob noob', 'no way noob', 'your more noob', 'whoes noob?'];

TheQuestion[1] := ['respond'];
TheRespond[1] := ['what to say?', 'i dont have anything to say', 'no im bussy'];
end;


{*******************************************************************************
function GetBlackText(ChatLine: Integer): string;
By: ZephyrsFury based on the works of Wizzup?
Description: Gets the black message text on ChatLine (1 to 8).
*******************************************************************************}

function GetBlackText(ChatLine: Integer): string;
var
TP: TPoint;
begin
TP := TextCoords(ChatLine);
Result := Trim(GetTextAtEx(TP.x - 2, TP.y - 2, 0, SmallChars, False, False, 0,
1, 0, 80, False, tr_AllChars));
end;

Function AutoRespond : Boolean; //Ty MK for the Responder
var
Text, Name, MakeRespond, LastRespond : String;
x, y, I, II, Rand, CurTime, SetTime : Integer;
Awnser : TStringArray;
TextP : TPoint;

begin
if not loggedin then exit;
CurTime := GetSystemTime;
If (CurTime - SetTime < 20000) Then Exit;
For I := 8 DownTo 4 Do
Begin
TextP := TextCoords(I);
If findcolor(x, y, 16711680, TextP.x, TextP.y, TextP.x + 200, TextP.y + 14) Then
Begin
Text := LowerCase(Trim(GetTextAtEx(x - 3, textp.y - 2, 0, SmallChars, False, False, -1, 1, 16711680, 60, False, tr_allChars)));
If (Text = LastRespond) Then
Exit;
LastRespond := Text;
Name := GetBlackText(I);
If (Pos(Players[CurrentPlayer].nick, Name) <> 0) then Exit;
Break;
End;
If (I = 4) Then Exit;
End;
If (Pos(Players[CurrentPlayer].Nick, Text) <> 0) Then
Begin
If (Pos('nice', Text) <> 0) Or (Pos('cool', Text) <> 0) Then
Begin
Awnser := ['thanks', ':)', 'tnx', 'ur cool to'];
I := random(High(Awnser));
MakeRespond := Awnser[I];
End Else
If (Pos('friends', Text) <> 0) Then
Begin
Awnser := ['no', 'no way', 'sorry my list is full', 'no sorry'];
I := random(High(Awnser));
MakeRespond := Awnser[I];
End Else
If (Pos('macro', Text) <> 0) Or (Pos('bot', Text) <> 0) Or (Pos('auto', Text) <> 0) Then
Begin
Awnser := ['lol im not!', 'why?', 'no way', 'not me', 'dream on', 'nah', 'there gone afaik'];
I := random(High(Awnser));
MakeRespond := Awnser[I];
End Else
Begin
Awnser := ['no, im bussy', 'go away plz', 'leave me alone', 'im bussy'];
I := random(High(Awnser));
MakeRespond := Awnser[I];
End;
WriteLn('Respond:');
WriteLn('/ ' + Name + ' ' + Text);
TypeSend(MakeRespond);
WriteLn('/ ' + Players[CurrentPlayer].Name + ': ' + MakeRespond);
Responds := Responds + 1;
Result := True;
SetTime := GetSystemTime;
exit;
End;
If (Pos('fishing', Text) <> 0) Then
Begin
If (Pos('my fishing level is', Text) <> 0) Or (Pos('m fishing', Text) <> 0) Then
Begin
Awnser := ['gratz', ':)', 'kewl', 'cool'];
I := random(High(Awnser));
MakeRespond := Awnser[I];
End Else
If (Pos('what is your level in fishing', Text) <> 0) Then
Begin
Awnser := [IntToStr(GetSkillLevel('fishing')), 'me ' + IntToStr(GetSkillLevel('fishing')), 'My Mining level is '+ IntToStr(GetSkillLevel('fishing')) + '.'];
I := random(High(Awnser));
MakeRespond := Awnser[I];
End Else
If (Pos('what are you fishing', Text) <> 0) Then
Begin
if Players[CurrentPlayer].strings[0] = 'rod' then
Awnser := ['Sards', 'sardines', 'Herrs', 'herrings']
else
Awnser := ['Shrimp', 'Anchs', 'Anchovies', 'Shhhhhrrrimps!'];
I := random(High(Awnser));
MakeRespond := Awnser[I];
End Else
If (Pos('s a good place for me', Text) <> 0) Then
Begin
Awnser := ['here', 'what about here', 'here i guess', 'here?'];
I := random(High(Awnser));
MakeRespond := Awnser[I];
End Else
Begin
Awnser := [IntToStr(GetSkillLevel('Fishing')), 'me ' + IntToStr(GetSkillLevel('Fishing')), 'My Fishing level is '+ IntToStr(GetSkillLevel('Fishing')) + '.'];
I := random(High(Awnser));
MakeRespond := Awnser[I];
End;
WriteLn('Respond:');
WriteLn('/ ' + Name + ' ' + Text);
TypeSend(MakeRespond);
WriteLn('/ ' + Players[CurrentPlayer].Name + ': ' + MakeRespond);
Responds := Responds + 1;
Result := True;
SetTime := GetSystemTime;
exit;
End;
For I := 0 To HowManyResponds - 1 Do
begin
For II := 0 To High(TheQuestion[I]) Do
Begin
If (Pos(TheQuestion[I][II], Text) <> 0) then
begin
WriteLn('Respond:');
WriteLn('/ ' + Name + ' ' + Text);
Rand := Random(High(TheRespond[I]));
TypeSend(TheRespond[I][Rand]);
WriteLn('/ ' + Players[CurrentPlayer].Name + ': ' + TheRespond[I][Rand]);
Result := True;
SetTime := GetSystemTime;
exit;
end;
end;
end;
end;

Special Ed

2009-04-06 13:00:55

I'll start working on some fishing, is it going to be strictly one fish? Or should we have it adjust to fish any type of fish?

noidea

2009-04-06 13:20:30

From: Special Ed
I'll start working on some fishing, is it going to be strictly one fish? Or should we have it adjust to fish any type of fish?


I think mainly Lobster, and Harpooning.
Does any one know how to detect of you're lobster fishing?

Special Ed

2009-04-06 13:51:57

It's just a matter of checking to see if the lobster cage is in the "Fishing Area", personally I have more trouble with harpooning cause it's smaller and can only be seen from certain angles.

noidea

2009-04-06 14:07:29

From: Special Ed
It's just a matter of checking to see if the lobster cage is in the "Fishing Area", personally I have more trouble with harpooning cause it's smaller and can only be seen from certain angles.


Sorry that was a typo :p
I meant Harpooning.
But does any one know how?

Maybe we could getColor the characters head, then check the distance of the head from the fishing spot, and see if its right over the spot?

Special Ed

2009-04-06 14:39:36

Ya, that's an idea, but defendant on the camera angle the head could always be in the fishing spot. I think if we made something to rotate the camera so that the fishing spot is always below the character we could do something like that.

Blumblebee

2009-04-06 17:30:07

does counting honestly need its own grouping, it could be easily done with something like

Function CountDTMs(DTM :integer) :integer;
var n, m, g: integer; slot: tbox;
begin
for n := 1 to 28 do
begin
if existsitem(n) then
begin
slot:= invbox(n);
if FindDTM(DTM,m,g,slot.x1,slot.y1,slot.x2,slot.y2) then inc(result);
end;
end;
end;

then
IncEx(Players[CurrentPlayer].Integers[0], CountDTM(dtm));

also, Id love to do some walking or something, I could also do fishing or work on a responder lol. Whatever needs tending to let me know.

Home

2009-04-06 18:16:12

Excuse me, is this project still open for more people, No i'm not that super famous scripter as most of you =) But still i can script (:

Count me in if possible and at least i can do some little stuff (:

Tniffoc

2009-04-06 22:23:09

From: Home
Excuse me, is this project still open for more people, No i'm not that super famous scripter as most of you =) But still i can script (:

Count me in if possible and at least i can do some little stuff (:


Of course you're welcome. The IRC is where I've been managing it the most so come drop by!

Bonfield

2009-04-15 11:50:37

how is this all going

am i still able to contribute?

mormonman

2009-04-15 20:07:33

Yes you are… I have been unable to work on this, I had some life issues. This weekend I will make the walk!

Tniffoc

2009-04-16 08:04:25

Ok! All the info for the project is now being kept at this svn. Pm me if you would like to be added to the project.

The jobs which have strike-through have been completed. Jobs without names need people to sign up.

mormonman

2009-04-16 09:00:53

So all of the walking is done?… I guess I will try to do counting.

Blumblebee

2009-04-16 09:12:41

meh i havent really done anything, I feel kinda useless. and Mormonman what needs to be done with counting really? A page or two before I posted my count dtm which counts all of a certain dtm in the inv then increases it with the result. For swordies/tuna, cal it one to find tuna then subtract Swordies := 28-(Tuna+1) (plus one because of the cape/harpoon). pretty simple

mormonman

2009-04-16 09:15:19

From: Blumblebee
meh i havent really done anything, I feel kinda useless. and Mormonman what needs to be done with counting really? A page or two before I posted my count dtm which counts all of a certain dtm in the inv then increases it with the result. For swordies/tuna, cal it one to find tuna then subtract Swordies := 28-(Tuna+1) (plus one because of the cape/harpoon). pretty simple


idk… that is just what is said at svn. nobody had done it… man i am too lazy right now!

noidea

2009-04-16 09:51:01

Tniffoc, Fishing IS NOT Done. We still need to detect when fishing ect.

Special Ed was working on it. (I think) If he need help I can help.

Blumblebee

2009-04-16 19:22:13

From: mormonman
idk… that is just what is said at svn. nobody had done it… man i am too lazy right now!


Function CountDTMs(DTM :integer) :integer;
var n, r, m, g: integer; slot: tbox;
begin
for n := 1 to 28 do
begin
if existsitem(n) then
begin
slot:= invbox(n);
if FindDTM(DTM,m,g,slot.x1,slot.y1,slot.x2,slot.y2) then inc(r);
end;
end;
Result := r;
end;

Function CountFish: Integer;
begin
GameTab(4);
Wait(100 + random(200));
if FindDtm(TunaDTM,x,y,MIx1,MIy1,MIx2,MIY2) then
begin
Result := CountDTMs(TunaDTM);
IncEx(Players[CurrentPlayer]{Tuna}.Integers[1], Result);
IncEx(Players[CurrentPlayer]{Sword}.Integers[2], (28-(Result+1)));
end else
begin
Result := CountDTMs(LobDTM);
IncEx(Players[CurrentPlayer]{Lob}.Integers[3], Result);
end;
end;

I'm too lazy to add to svn, I did this in like 2 minutes haha so Mormonman adjust it accordingly, or dont use it at all I dont really care. I didnt add the dtms to this I figured someone could make them lol.

Special Ed

2009-04-17 00:03:59

Ya I had done the fishing stuff a bit, but It's not that great since I'm still a bit rusty. I uploaded it to the SVN but i'll post it below for you lazy people. It should find the fishing spot (courtesy of noidea) and it will skip over it if it's the wrong type of fishing spot. If we could get some testers to add / change it that would be great.


program New;
{.include SRL/SRL.scar}
var
fSpot: TPoint;
sBox: TBoxArray;

procedure AddBox(aBox: TBox; var BoxArr: TBoxArray);
begin
Writeln('BoxArr Length a: ' + inttostr(GetArrayLength(BoxArr)));
SetArrayLength(BoxArr, GetArrayLength(BoxArr) + 1);
BoxArr[High(BoxArr)]:= aBox;
Writeln('BoxArr Length b: ' + inttostr(GetArrayLength(BoxArr)));
end;


procedure RemovePointsBox(var TPA: TPointArray; Box: TBoxArray);
var
i, a: Byte;
Lng, bLng, tTime: Integer;
begin
MarkTime(tTime);
Lng:= High(TPA);
bLng:= High(Box);
if(Lng = -1)or(bLng = -1)then Exit;
for i:= 0 to Lng do
for a:= 0 to bLng do
if PointInBox(TPA[i], Box[a])then
begin
TPA[i]:= TPA[Lng];
SetArrayLength(TPA, Lng);
Lng:= High(TPA);
a:= bLng;
end;
Writeln('RemovePointsBox: ' + inttostr(TimeFromMark(tTime)));
end;

Function FindFish(var Spot: TPoint; x1, y1, x2, y2: Integer; SkipBox: TBoxArray) : Boolean;
Var
CTS, I: Integer;
Spott: TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.10, 0.24);
FindColorsSpiralTolerance(MSCX, MSCY, Spott, 11972264 , x1, y1, x2, y2, 13);
RemovePointsBox(Spott, SkipBox);
//DebugTPA(Spott, 'lll');
If Length(Spott) < 1 then
begin
Writeln('Error, couldn''t find fishing spot!');
Result := False;
exit;
end;
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(Spott, 6, 6);
For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], Spot.x, Spot.y);
If not (distance(Spot.x, Spot.y, MSCX, MSCY) > 200)then
begin
Result := True;
Break;
end;
end;
end;

begin
SetupSRL;
AddBox(IntToBox(0, 0, 0, 0), sBox);
repeat
if FindFish(fSpot, MSX1, MSY1, MSX2, MSY2, sBox)then
begin
MMouse(fSpot.x, fSpot.y, 3, 3);
if IsUpText('age')then
begin
GetMousePos(fSpot.x, fSpot.y);
Mouse(fSpot.x, fSpot.y, 0, 0, True);
Break;
end else
AddBox(IntToBox(fSpot.x - 30, fSpot.y - 30, fSpot.x + 30, fSpot.y + 30), sBox);
end;
until(IsFKeyDown(12));
end.

noidea

2009-04-17 06:28:55

Just updated my part. IDK how to put it in the SVN :(
program New;
{.include srl/srl.scar}


//Thank Wizzup? !
Function DebugTPA(Points: TPointArray; BmpName: String): Boolean;

Var
Width, Height, ClientBMP, I: Integer;
xs, ys, xe, ye: Integer;

Begin
Try
Begin
xe := xs xor xs;
ye := ys xor ys;
xs := 1 shl 20;
ys := 1 shl 20;

For I := 0 To High(Points) Do
Begin
xs := Min(xs, Points[i].X);
ys := Min(ys, Points[i].Y);

xe := Max(xe, Points[i].X);
ye := Max(ye, Points[i].Y);
End;

Width := xe - xs;
Height := ye - ys;

DisplayDebugImgWindow(0, 0);
DisplayDebugImgWindow(Width, Height);
ClientBMP := BitmapFromString(Width, Height, '');

CopyClientToBitmap(ClientBMP, xs, ys, xe, ye);
For I := 0 To High(Points) Do
FastSetPixel(ClientBMP, Points[i].X - xs, Points[i].Y - ys, 255);
If BmpName <> '' Then
SaveBitmap(ClientBMP, ScriptPath + BmpName + '.bmp');
SafeDrawBitmap(ClientBMP, GetDebugCanvas, 0, 0);
DisplayDebugImgWindow(Width, Height);

FreeBitmap(ClientBMP);
End
Except
FreeBitmap(ClientBMP);
End;
Result := True;
End;


Procedure KaraWrite( Mess : String );
begin
writeln('Karamja Island : '+mess+'.');
end;



//took it out of one of Home's scripts...
procedure AlignMM(Direction: Char);
var DTM, x, y, i: integer;
acc: extended;
begin
MakeCompass(Direction)
DTM := DTMFromString('78DA634C676260086240016F9F7C641001D28' +
'C40FC1F0818416AFC71AB0101B09A7022D44413A1C60BBF1A009F' +
'1015DF');
wait(50)
if FindDtmRotated(DTM, x, y, MMX1, MMY1, MMX2, MMY2, radians(-40), radians(40), 0.01, acc) then
begin
if (acc < 0.1) and (acc > -0.1) then
exit
else
begin
repeat
if FindDtmRotated(DTM, x, y, MMX1, MMY1, MMX2, MMY2, radians(-40), radians(40), 0.01, acc) then
begin
if acc < 0 then
begin
KeyDown(VK_RIGHT)
Wait(20 + random(10))
KeyUp(VK_RIGHT)
end;
if acc > 0 then
begin
KeyDown(VK_LEFT)
Wait(20 + random(10))
KeyUp(VK_LEFT)
end;
if acc = 0 then break;
end else
exit;
wait(20)
Inc(i)
until (((acc < 0.1) and (acc > -0.1)) or (i > 25))
end;
end else MakeCompass(Direction);
freeDtm(DTM)
end;





{********************************************
Function : function FindKaramjaRoadColor: Integer;
Author : noidea
Description : Finds the Karamja Road Color.
*********************************************}
function FindKaramjaRoadColor: Integer;
var
R, G, B, GC, TestColor, i: Integer;
H, S, L, X, Y, Z: Extended;
Colors: TPointArray;
begin
GC := 1276824;
FindColorsSpiralTolerance(MSCX, MSCY, Colors, GC, MMX1, MMY1, MMX2, MMY2, 60);
if Length(Colors) = 0 then
begin
Writeln('Couldnt find Karajma Road Color!');
Result := 0;
exit;
end;
for i := 0 to high(Colors)-1 do
begin
if RS_OnMinimap(Colors[i].X, Colors[i].Y) then
begin
TestColor := GetColor(Colors[i].X, Colors[i].Y);
if SimilarColors(TestColor, GC, 60) then
begin
ColorToRGB(TestColor, R, G, B);
ColorToHSL(TestColor, H, S, L);
ColorToXYZ(TestColor, X, Y, Z);
if InRange(R - G, 9, 52) then
if InRange(R - B, 113, 153) then
if InRange(G - B, 70, 134) then
if InRange(Round(S) - Round(H), 50, 80) then
if InRange(Round(L) - Round(H), 6, 36) then
if InRange(Round(S) - Round(L), 27, 57) then
if InRange(Round(X) - Round(Y), - 8, 6) then
if InRange(Round(Y) - Round(Z), 10, 24) then
if GetColor(Colors[i].X + 2, Colors[i].Y + 2) = TestColor then
if GetColor(Colors[i].X + 1, Colors[i].Y + 1) = TestColor then
begin
Writeln('Karajma Road Color = ' + Inttostr(TestColor));
Result := TestColor;
Exit;
end;
end;
end;
end;
Writeln('Couldnt find Karajma Road Color!');
Result := 0;
end;


{********************************************
Function : Function FindBridgeColor2: Integer;
Author : noidea
Description : Made this since the old one is
broken. It find the bridge color.
April 16 2009 - Fixed it.
*********************************************}
Function FindBridgeColor2: Integer;
var
p: Array of TPoint;
GC, i, testColour1, c, x, y: Integer;
begin
If WaterColor = 0 then
WaterColor := FindWaterColor;
If FindWaterColor = 0 then
begin
Writeln('There was no water nearby!');
Result := 0;
exit;
end;
GC := 10803;
FindColorsSpiralTolerance(MMCX, MMCY, P, GC, MMX1, MMY1, MMX2, MMY2, 65);
debugtpa(p, '');
wait(1000);
If length(p) = 0 then
begin
writeln('Unable to find Bridge Color!');
result := 0;
exit;
end;
c := GetArrayLength(P);
For i := 0 to c - 1 do
begin
if rs_OnMinimap(P[i].x,P[i].y) then
begin
TestColour1 := GetColor(P[i].x, P[i].y);
if GetColor(P[i].x - 2, P[i].y) = TestColour1 then
if getcolor(P[i].x + 4 , P[i].y - 3) = testcolour1 then
if getcolor(P[i].x + 2 , P[i].y) = testcolour1 then
if FindColor(x, y, WaterColor, P[i].x - 3, P[i].y - 3, P[i].x + 3, P[i].y + 3) then
begin
Result := TestColour1;
Writeln('Bridge color = '+inttostr(Result));
exit;
end;
end;
end;
Writeln('Could not find Bridge Color!');
Result := 0;
end;


{********************************************
Function : Function FindStoreFloorColor: Integer;
Author : noidea
Description : Find the colour of the Shops floor
on the MM.
*********************************************}
Function FindStoreFloorColor: Integer;
var
testColor, i, c, GC : Integer;
TPA : TPointArray;
begin
GC := 3953001;
FindColorsSpiralTolerance(mmcx, mmcy, TPA, GC, mmx1, mmy1, mmx2, mmy2, 60);
if Length(TPA) = 0 then
begin
writeln('Couldnt find Store Floor Color!');
Result := 0;
exit;
end;
c := Getarraylength(TPA);
for i := 0 to c - 1 do
begin
if rs_OnMinimap(TPA[i].x, TPA[i].y) then
begin
TestColor := GetColor(TPA[i].x, TPA[i].y);
If SimilarColors(GC, TestColor, 30) then
begin
if GetColor(TPA[i].x - 8, TPA[i].y - 6) = TestColor then
if GetColor(TPA[i].x + 3, TPA[i].y + 4) = TestColor then
if GetColor(TPA[i].x - 5, TPA[i].y + 2) = TestColor then
begin
result := TestColor;
writeln('Store Floor Color = '+inttostr(result));
exit;
end;
end;
end;
end;
writeln('Couldnt find Store Floor Color!');
Result := 0;
end;

{********************************************
Function : Function GSW(Colour, Toler, SR, ER, Rad, xOffSet, yOffSet: Integer): Boolean;
Author : noidea
Description : Just like RadialWalking but,
user defines how many pixels up or down,
left or right, it clicks
*********************************************}
Function GSW(Colour, Toler, SR, ER, Rad, xOffSet, yOffSet: Integer): Boolean;
var
orly: TPointArray;
I: Integer;
begin
if RadialWalkEx(orly, MMCX, MMCY, Colour, Toler, SR, ER, Rad) then
for I := 0 to High(orly) do
begin
repeat
mouse(orly[I].x + xOffSet, orly[I].y + yOffset, 3, 3, true);
wait(400+random(200));
until flagPresent;
wait(200+random(200));
Result := FlagPresent;
Flag;
wait(100);
break;
end;
end;

//Small edit until CountFlag() is fixed.
function _RadialRoadWalk(TheColor: Integer; StartRadial, EndRadial: Integer; Radius: Integer; Xmod, Ymod: Integer): Boolean;
var
tpa: TPointArray;
i: Integer;
begin
Result := False;
if (not LoggedIn) then Exit;
if (RoadColorChecker) then
if (DebugRadialRoad) then
WriteLn(' THROUGH _RadialRoadWalk= ---> ' + IntToStr(RoadColor));
if RadialWalkEx(tpa, MMCX, MMCY, TheColor, 0, StartRadial, EndRadial, Radius) then
for i := 0 to High(tpa) do
if MFNF(tpa[i].x, tpa[i].y, Xmod, Ymod) then
begin
Flag;//Flagg;//CountFlag(10);
Result := True;
Break;
end;
end;



Function DockToTPoint(var Black : TPoint) : Boolean;
var
i, c, col : Integer;
dc: Array of TPoint;
begin
FindColorsSpiralTolerance(mmcx, mmcy, dc, 65536, mmx1, mmy1, mmx2, mmy2, 0);
col := FindBridgeColor2;
if Length(dc) = 0 then exit;
c := GetArrayLength(dc);
for i := 0 to c - 1 do
begin
if not getcolor(dc[i].x, dc[i].y - 2) = 195836 then
if GetColor(dc[i].x, dc[i].y - 2) = col then
if GetColor(dc[i].x, dc[i].y + 6) = FindWaterColor then
begin
Black.x := dc[i].x;
Black.y := dc[i].y;
Result := true;
exit;
end;
end;
KaraWrite('Didnt find with DockToTPoint!');
black.x := 0;
black.y := 0;
end;


Function IsNearAbsoluteBridge: Boolean;
var
cc : Array of TPoint;
i, c, kc, bc : Integer;
begin
kc := FindKaramjaRoadColor;
bc := FindBridgecolor2;
FindColorsTolerance(cc, FindBridgeColor2, mmx1, mmy1, mmx2, mmy2, 0)
if Length(cc) = 0 then
begin
KaraWrite('Couldnt find bridge color! -Near bridge-');
result := false;
exit;
end;
c := GetArrayLength(cc);
for i := 0 to c - 1 do
begin
if getcolor(cc[i].x, cc[i].y + 3) = kc then
if Getcolor(cc[i].x, cc[i].y - 3) {= FindBridgeColor2} or
getColor(cc[i].x - 1, cc[i].y - 3) = bc then
begin
Result := (Distance(mmcx, mmcy, cc[i].x, cc[i].y) > 89);
KaraWrite('Near bridge '+booltostr(result));
exit;
end;
end;
Result := false;
KaraWrite('Near bridge '+booltostr(result));
end;





Procedure KaraDockToFishies;
var
bc, kc, i, x, y, ii, ki : INteger;
one: Boolean;
begin
AlignMM('n');
setrun(false);
SetAngle(true);
kc := FindKaramjaRoadColor;
WaterColor := FindWaterColor;
bc := FindBridgeColor2;
for i := 0 to 7 do
begin
One := True;
case i of
0 : If not _RadialRoadWalk(kc, 255, 315, 60, 2, 2) then
If not GSW(bc, 0, 275 - 10, 275 + 10, 40, 30, 0) then
one := False;
1 : If not _RadialRoadWalk(kc, 265, 325, 60, 2, 2) then
if not GSW(FindStoreFloorColor, 0, 275 - 20, 275, 62, - 10, - 15)then
one := False;
2 : If not _RadialRoadWalk(kc, 255, 315, 60, 2, 2) then
if FindSymbol(x, y, 'water') then
begin
mouse(x, y - 50, 3, 3, true);
KaraWrite('Used water symbol');
wait(100);
flag;
end else One := False;
3 : If not _RadialRoadWalk(kc, 260, 325, 60, 2, 2) then
if not GSW(FindStoreFloorColor, 0, 270, 280, 60, - 0, -20) then
One := False;
4 : If not _RadialRoadWalk(kc, 300, 380, 50, 2, 2) then
begin
mouse(613+4, 31 + 3, 3, 3, true);
KaraWrite('Bind clicked -step 4-');
flag;
end;
5 : begin
if IsNearAbsoluteBridge then
if not _RadialRoadWalk(kc, 355, 365, 20, 2, 2)then
begin
mouse(mmcx, mmcy - 8, 3, 4, true);
flag;
end;
end;
6 : begin
one := false;
bc := FindBridgeColor2;
for ii := 0 to 30 do
begin
If GSW(bc, 0, 0, 55, 40 + ii, 35, 40)then
begin
flag;
KaraWrite('Found bridge at '+inttostr(ii)+' try');
one := true;
break;
end;
end;
if not One then
If not GSW(kc, 0, 5, 60, 50, 20, 15) then
One := False;
end;

7 : begin
one := false;
ii := 0;
for ii := 0 to 15 do
begin
If RadialWalk(bc, 35, 95, 55, 0, 2)then
begin
flag;
KaraWrite('Found fishing bridge at '+inttostr(ii)+' try');
one := true;
break;
end;
end;
if not one then
if FindSymbol(x, y, 'Fishing spot') then
begin
mouse(x + 3, y, 3, 3, true);
KaraWrite('Used fishing symbol! -Onto fishing bridge-');
flag;
one := true;
end else One := False;
end;
end;
KaraWrite('Step : '+inttostr(i)+'; Made it there : '+BoolToStr(One));
wait(500+random(200));
If One then
ki := 0;
if not One then
begin
dec(i);
inc(ki);
if ki > 4 then
begin
KaraWrite('Player was lost while walking! Setting Player false');
logout;
Players[CurrentPlayer].active := false;
exit;
end;
end;
end;
end;




Procedure FishiesToKaraDock;
var
bc, kc, i, x, y, ki : INteger;
one: Boolean;
n : TPoint;
CC: array of TPoint;
begin
AlignMM('n');
setrun(false);
SetAngle(true);
kc := FindKaramjaRoadColor;
WaterColor := FindWaterColor;
bc := FindBridgeColor2;
x := MMCX; y := MMCY;
FindColorsSpiralTolerance(x, y, CC, BC, mmx1, mmy1, mmx2, mmy2, 0)
For i := 0 to GetArrayLength(CC) - 1 do
begin
if (Distance(mmcx, mmcy, CC[i].x, CC[i].y) > 0) then
begin
mouse(cc[i].x, cc[i].y, 3, 3, true);
Flag;
Break;
end;
end;
for i := 0 to 7 do
begin
one := true;
case i of
0 : begin
one := false;
if GSW(WaterColor, 0, 275, 295, 50, 0, + 20)then
begin
one := true;
KaraWrite('Used gsw to water');
flag;
end;
if not One then
if Findsymbol(x, y, 'fishing spot') then
begin
mouse(x - 40, y + 20, 3, 3, true);
KaraWrite('used symbol to get off fishing bridge');
flag;
one := true;
end else one := false;
end;

1 : if not _RadialRoadWalk(FindKaramjaRoadColor, 260, 280, 65, 2, 2) then
if not GSW(FindBridgeColor2, 0, 280, 360, 55, -10, 20)then
one := false;

2 : If IsNearAbsoluteBridge then
begin
mouse(mmcx, mmcy + 15, 4, 4, true);
KaraWrite('We were to close to the bridge on the way back');
flag;
end;

3 : if not _RadialRoadWalk(FindKaramjaRoadColor, 215, 160, 57, 2, 2) then
if not GSW(WaterColor, 0, 240, 180, 60, + 20, 0) then
one := false;

4 : if not _RadialRoadWalk(FindKaramjaRoadColor, 80, 160, 60, 2, 2) then
if not GSW(FindStoreFloorColor, 0, 180, 160, 50, 15, - 5)then
if findsymbol(x, y, 'store') then
begin
KaraWrite('Used store symbol, fail safe');
mouse(x + 20, y, 3, 3, true);
flag;
end else one := false;

5 : If not GSW(FindKaramjaRoadColor, 0, 70, 110, 60, 0, 5) then
if not GSW(FindStoreFloorColor, 0, 160, 90, 64, 0, -20) then
if findsymbol(x, y, 'water') then
begin
mouse(x + 15, y - 30, 3, 3, true);
KaraWrite('Used water symbol, fail safe ');
flag;
end else one := false;
6 : if not _RadialRoadWalk(FindKaramjaRoadColor, 10, 130, 65, 2, 2) then
begin
mouse(686, 99, 3, 3, true);
KaraWrite('Used blind click on step 6');
flag;
end;

7 : begin
If DockToTPoint( n ) then
begin
mouse(n.x, n.y - 4, 3, 3, true);
KaraWrite('Used docktotpoint');
flag;
end else one := false;
if not one then
begin
if not GSW(FindBridgeColor2, 0, 80, 110, 50, 0, 6) then
begin
mouse(mmcx + 20, mmcy, 3, 3, true);
KaraWrite('Used mouse to bridge 7th step');
flag;
end else
begin
if Findsymbolin(x, y, 'transportation', 553, 62, mmx2, mmy2)then
begin
if Distance(mmcx, mmcy, x, y) < 13 then
begin
KaraWrite('We have successfully made it to the dock');
exit;
end;
end;
end;
if DockToTPoint(n) then
begin
mouse(n.x, n.y - 4, 3, 3, true);
KaraWrite('Used DockToTPoint try 2');
KaraWrite('We have successfully made it to the dock');
flag;
exit;
end else
if Findsymbolin(x, y, 'transportation', 553, 62, mmx2, mmy2) then
begin
mouse(x, y, 3, 3, true);
flag;
KaraWrite('Used symbol trans on bridge');
KaraWrite('We have successfully made it to the dock');
exit;
end else One := false;
end;
end;
end;
KaraWrite('Step : '+inttostr(i)+'; Made it there : '+booltostr(one));
wait(500+random(200));
If One then
ki := 0;
if not One then
begin
dec(i);
inc(ki);
if ki > 4 then
begin
KaraWrite('Player was lost while walking!');
logout;
Players[CurrentPlayer].active := false;
exit;
end;
end;
end;
end;


Function InKaramja: Boolean;
var x, y: Integer;
begin
If FindColor(x, y, FindKaramjaRoadColor, mmx1, mmy1, mmx2, mmy2) then
If FindColor(x, y, FindWaterColor, mmx1, mmy1, mmx2, mmy2) then
If FindColor(x, y, FindBridgeColor2, mmx1, mmy1, mmx2, mmy2) then
result := true;
end;


Function SetupKaramjaWalking: Boolean;
begin
if FindKaramjaRoadColor = 0 then
begin
KaraWrite('We were unable to find the Karamja Road Color');
KaraWrite('This is a massive problem');
KaraWrite('Please let the authors of the script know, and post on the thread');
Players[CurrentPlayer].Active := False;
logout;
result := false;
exit;
end;
Result := InKaramja;
end;



var c: Array of TPoint;
cc: TPoint;
ii : Integer;
begin
setupsrl;
//symbolaccuracy := 0.45;
//DockToTPoint(cc);
//mmouse(cc.x, cc.y, 0, 0);
//writeln(Booltostr(SetupKaramjaWalking));
//FindColor(cc.x, cc.y, FindBridgeColor2, mmx1, mmy1, mmx2, mmy2)
//mmouse(cc.x, cc.y, 0, 0);

repeat
KaraDockToFishies;
FishiesToKaraDock;
until false

//FindColorsTolerance(c, FindBridgeColor2, MMX1, MMY1, MMX2, MMY2, 0);
//Writeln(inttostr(mms/1000));
//DebugTPA(c, '');
end.

//KaraDockToFishies;
//FindStoreFloorColor
//FindKaramjaRoadColor
//Findbirdgecolor2
//IsNearAbsoluteBridge;
//FindColorsTolerance(c, Findbridgecolor2, MMX1, MMY1, MMX2, MMY2, 0);
//DebugTPA(c, '');
//DockToTPoint(dc);
//mmouse(dc.x, dc.y, 1, 1);


noidea

2009-04-23 05:13:00

Bump, so some of you will remeber your duties…

lordsaturn

2009-04-23 07:15:08

noidea, paste it into the file, right click on the folder, and hit commit. Then follow the simple gui.

Tniffoc

2009-04-24 23:13:16

I'm back from the dark depths of real life and will now have more time for the project. Once again, see the svn for the current jobs. BTW, looks good people.

Special Ed

2009-04-25 01:09:00

Question, in KaraDockToFishies. Is it supposed to set run to false? Why not have it run there?

Also Any chance we could try making it walk through the banana patch? I've got a few idea so ill give em a try.

EDIT: Hey could someone work on KaraDock to Seaman, Falador Bank to Port, and Port to Falador Bank?

Tniffoc

2009-04-25 02:16:16

I'll take a look at some of those walking procedures.

Yes. It was supposed to set run to false because of some color finding errors, also, normal players don't run during teleportation sequences because most of the time is spent clicking instead of waiting while your character walked/ran.


Special Ed, for future reference, please keep everything in that one file, it keeps the script all in one piece so I don't have to keep putting it together. Not criticism, just for future reference.

Special Ed

2009-04-25 09:55:07

I had it all put together. I just put those files in there separately so if someone wanted to look at specifically what was being added to the script they could without searching through the entire thing. I do understand what you're saying though.

The running / walking I was talking about was from the KaraDocks to the Fishies, most people run that distance don't they?

Nava2

2009-04-26 18:19:39

Just use countitems?

Special Ed

2009-04-26 21:57:41

From: Nava2
Just use countitems?


What? Use countitems for what?

EDIT: Anyone still working on this, we're so close to being finished. We just need a procedure for going from karadocks to portsarim, and port sarim to falador and falador to port sarim. Then polishing!

NCDS

2009-04-27 19:05:17

From: Special Ed
What? Use countitems for what?

EDIT: Anyone still working on this, we're so close to being finished. We just need a procedure for going from karadocks to portsarim, and port sarim to falador and falador to port sarim. Then polishing!


I would'nt mind doing some of that stuff.

I've been looking for something new to make so perhaps I will just get involved in this instead.

I guess I'll look around a bit and maybe try and find someone in IRC to talk to about it.

Special Ed

2009-04-28 00:34:40

Ya, you're welcome to lend a hand, just check out the SVN and follow the instructions here.

I'll add you to the SVN and you can help out! =)

noidea

2009-04-28 01:04:26

From: NCDS
I guess I'll look around a bit and maybe try and find someone in IRC to talk to about it.


Srl:karaProject or srl-msi
(Channel wise)

Special Ed

2009-04-29 02:30:51

Alrighty, so I made up a list of what needs to be done to finish this project. If you're working on it that's great, or If it's already done or something that needs to be done isn't on there let me know.

  1. Walking from Falador Bank to Port Sarim Sailors
  2. Walking from Port Sarim Sailors to Falador Bank
  3. Banking all the Fish and withdrawing new harpoons / cages ect if needed.
  4. Function for boarding the boat from Karamja to Port Sarim.
  5. IsFishing Function
  6. Anti-ban
  7. SRL-Stats / Player Form / Ect

Cazax

2009-04-29 03:34:57

I've just commit IsFishing, though it doesn't work properly with harpoon :(

noidea

2009-04-29 03:55:18

It would be uber sexy if some one could make a form like the one in that MultiMiner in the SRL Members only mining section.

Sir R. M8gic1an

2009-04-29 15:47:53

From: Special Ed

  1. Walking from Falador Bank to Port Sarim Sailors
  2. Walking from Port Sarim Sailors to Falador Bank
  3. Banking all the Fish
  4. Procedure for boarding the boat from Karamja to Port Sarim.
  5. IsFishing Procedure
  6. Anti-ban


I suggest you trim the list down to that first, so that you have a script that works. then add the nice features.

Also, where you wrote Procedures, you might want to make them into functions ;)

~RM

Special Ed

2009-04-30 07:14:19

From: Rasta Magician
I suggest you trim the list down to that first, so that you have a script that works. then add the nice features.

Also, where you wrote Procedures, you might want to make them into functions ;)

~RM


*Glare…* Ya, ya… it's not like people wouldn't understand anyways! :p
We're getting so close to finishing! We can do it! (all night long?)

footballjds

2009-04-30 07:22:55

no idea if any of this works… but if it does use any/all(credit course…)

its attached as .rar or .zip ;)

Tniffoc

2009-05-07 10:32:16

Ugh.. Life keeps catching up to me. Hopefully I'll get around to doing some more work.