SRL Archive - Research & Development Lounge

r0b0t1 get pick procedure.


R0b0t1

2007-08-15 21:47:53

Enjoy. Remember to credit if you use it.

Two part to this. The DDTM, and the Functions.



You MUST put the DDTM in your script, and above the functions. Do not change any of the DDTM code unless you know how.


Var MPHDTMTol, PHDTMTol, MPHDTMColor, PHDTMColor, PHDTMSize: Integer;
Var PickHeadMP: TDTMPointDef;
Var PickHeadSP: Array[0..4] of TDTMPointDef;
Var PickHeadSkele: TDTM;
Var r0bPickDTM: Integer;

Procedure MakePickHeadDDTM;
begin;
MPHDTMTol:= 255;
PHDTMTol:= 5;
MPHDTMColor:= 3680034;
PHDTMColor:= 65536;
PHDTMSize:= 1;

PickHeadMP.x:= 29;
PickHeadMP.y:= 16;
PickHeadMP.AreaSize:= 1;
PickHeadMP.AreaShape:= 0;
PickHeadMP.Color:= MPHDTMColor;
PickHeadMP.Tolerance:= MPHDTMTol;

PickHeadSP[0].x:= 14;
PickHeadSP[0].y:= 19;
PickHeadSP[0].AreaSize:= PHDTMSize;
PickHeadSP[0].AreShape:= 0;
PickHeadSP[0].Color:= PHDTMColor;
PickHeadSP[0].Tolerance:= PHDTMTol;

PickHeadSP[1].x:= 28;
PickHeadSP[1].y:= 14;
PickHeadSP[1].AreaSize:= PHDTMSize;
PickHeadSP[1].AreaShape:= 0;
PickHeadSP[1].Color:= PHDTMColor;
PickHeadSP[1].Tolerance:= PHDTMTol;

PickHeadSP[2].x:= 31;
PickHeadSP[2].y:= 14;
PickHeadSP[2].AreaSize:= PHDTMSize;
PickHeadSP[2].AreaShape:= 0;
PickHeadSP[2].Color:= PHDTMColor;
PickHeadSP[2].Tolerance:= PHDTMTol;

PickHeadSP[3].x:= 42;
PickHeadSP[3].y:= 25;
PickHeadSP[3].AreaSize:= PHDTMSize;
PickHeadSP[3].AreaShape:= 0;
PickHeadSP[3].Color:= PHDTMColor;
PickHeadSP[3].Tolerance:= PHDTMTol;

PickHeadSP[4].x:= 24;
PickHeadSP[4].y:= 20;
PickHeadSP[4].AreaSize:= PHDTMSize;
PickHeadSP[4].AreaShape:= 0;
PickHeadSP[4].Color:= PHDTMColor;
PickHeadSP[4].Tolerance:= PHDTMTol;

PickHeadSkele.MainPoint:= PickHeadMP;
PickHeadSkele.SubPoints:= PickHeadSP;
r0bPickDTM:= AddDTM(PickHeadSkele);
end;

This procedure will find the pick heads color. You must input a custom variable in the space. The boolean will change the DDTM's main color to that of the pick found. Returns true if it found it…


Function R0bGetPickColor(Var PickColHolder:Integer; SetDTMNewCol: Boolean): Boolean;
Var I, XDTM, YDTM: Integer;
begin;
If not (FindDTM(r0bPickDTM, XDTM, YDTM, MIX1, MIY1, MIX2, MIY2)) Then
begin;
For I:=0 to 6 do
begin;
MakePckHeadDDTM;
PHDTMSize:= PHDTMSize + 1;
PHDTMTol:= PHDTMTol + 5;
FindDTM(r0bPickDTM, XDTM, YDTM, MIX1, MIY1, MIX2, MIY2);
If (I = 6) Then
Result:= False;
end;
end;
PHDTMSize:= 1;
PHDTMTol:= 10;
PickColHolder:= GetColor(XDTM, YDTM);
Result:= True;
If (SetDTMNewCol) Then
begin;
PickHeadMP.Color:= PickColHolder;
PickHeadMP.Tolerance:= PHDTMTol;
end;
If not (Result) Then
WriteLn('Pick not found');
FreeDTM(r0bPickDTM);
end;

This finds the head, attaches it, and wields it if EquipPick is true… (It may drop an item to attach the head.


Function R0bFindPickHead(Var r0bPickCol: Integer): Boolean; //Input pick color.
Var I, B, C, PX, PY, x1, x2, y1, y2:Integer; //Same as used in above func.
Var LoopCount, r0bPickHeadColor, r0bPickHandle: Integer;
Var FoundHead, BreakLoop, Dropped: Boolean;
begin;
MakePickHeadDDTM;
r0bPickHandle:= DTMFromString('78DA63B461606038CE8002C4045918FE03694' +
'620FE0F048C0E40C61E0634C0C8C00A5503E6390189FD44A8D94B' +
'408D3990B84A408D2990B8885F0D00A6FC0B62');
r0bPickHead:= DTMFromString('78DA63CC63606038CA80028C8C5219FE03694' +
'620FE0F048C3940C6610634C0C8C00A5503E61503899304D49400' +
'893D04D42412360700DC550BDF');
For I:=0 to 6 do
begin;
Case I of
1: LoopCount:= 1;
2: LoopCount:= 2;
3: LoopCount:= 3;
4: LoopCount:= 4;
5: LoopCount:= 5;
end;
PX:= MSCX;
PY:= MSCY;
For B:=0 to 6 do
begin;
Case B of //Case by WT-Fakawi. I changed the letter :p
1: begin x1:= MSx1; y1 := MSy1 + 20; x2 := MSCx; y2:= MSCy; end;
2: begin x1:= MSCx; y1 := MSy1 + 20; x2 := MSx2; y2:= MSCy; end;
3: begin x1:= MSx1; y1 := MSCy; x2 := MSCx; y2:= MSy2; end;
4: begin x1:= MSCx; y1 := MSCy; x2 := MSx2; y2:= MSy2; end;
5: begin x1:= MSCx - 50; y1 := MSCy - 50; x2 := MSCx + 50; y2:= MSCy + 50; end;
6: begin x1:= MSx1; y1 := MSy1 + 20; x2 := MSx2; y2:= MSy2; end;
end;
For C:=0 to 10 do
begin;
BreakLoop:= FindColorSpiralTolerance(PX, PY, r0bPickCol, x1, y1, x2, y2, C);
If (BreakLoop) Then
Break;
end;
If not (BreakLoop) Then //If it doesn't find the pick color in the part
Continue; //of the MainScreen (above case) it goes to the
If BreakLoop Then //next loop.
begin;
Mouse(PX, PY, 1, 1, False);
Wait(500+Random(150));
If (ChooseOption(x, y, 'ake') Then
begin;
FFlag(0);
Wait(3000+Random(500));
FoundHead:= True;
Break;
end else
begin;
WriteLn('Did not find ''take'' option');
Result:= False;
Exit;
end;
end;
If (FoundHead) Then
Break;
end;
If (FoundHead) Then
Break;
end;
If (FoundHead) Then
begin;
WriteLn('Found Head, Attaching...');
If not (GameTab(4)) Then
GameTab(4);
Wait(300+Random(200));
If (InvFull) Then
begin;
MouseItem(10+Random(5), False);
Wait(500+Random(200));
ChooseOption(x, y, 'rop');
Dropped:= True;
end;
end;
If (FindDTM(r0bPickHandle, PX, PY, MIX1, MIY1, MIX2, MIY2) Then
begin;
Mouse(PX, PY, 1, 1, False);
ChooseOption(x, y, 'se');
If (FindDTM(r0bPickHead, PX, PY, MIX1, MIY1, MIX2, MIY2)) Then
Mouse(PX, PY, 2, 2, True);
end else
begin;
WriteLn('Pick head not found in inventory');
Exit;
end;
end else
begin;
WriteLn('Pick Handle not found in inventory');
Exit;
end;
If (Dropped) and (EquipPick) Then
begin;
If not (FindDTM(r0bPickDTM, PX, PY, MIX1, MIY1, MIX2, MIY2)) Then
begin;
WriteLn('Problem locating finished pick');
Exit;
end;
Mouse(PX, PY, 3, 3, True);
WriteLn('We have attached the head.');
WriteLn('But we have dropped an item.');
WriteLn('Sorry. :)');
end;
end;
FreeDTM(r0bPickHandle);
FreeDTM(r0bPickHead);
FreeDTM(r0bPickDTM);
end;



Try it :). And report bugs…


PS. No credit = report = bad thingz.

Sp0rky

2007-08-15 21:57:38

That looks very sexy. Good job. Now you just need a find pick head procedure to go with it and you will have handled all aspects of the pic in srl I believe.

R0b0t1

2007-08-15 21:59:57

I'm pretty sure Jagex got rid of that random… I just can't find the news.


If I'm right, its gone for WC too.

However, I am bored.

Sp0rky

2007-08-15 22:01:36

Really?! The head falling off?

That used to be one of the main reasons my players became de-activated in scripts. Wow. Jagex just continue to damage themselves, they don't need help from RSdemon.

Harry

2007-08-15 22:15:16

NO! The pick falls off for mining, but axe heads for WC DON'T fall off. Don't get them confused please! :o

R0b0t1

2007-08-15 22:15:43

I think they realized it was really hard for normal players to find it also.


Hey, just to check, how mahy picks have you gotten in the last month if you've been mining.

Pancakes

2007-08-15 22:17:02

From: hy71194
NO! The pick falls off for mining, but axe heads for WC DON'T fall off. Don't get them confused please! :o


Thought it was the other way around?

Oh well, you sounded very convinced :p

Harry

2007-08-15 22:17:26

None. :D I usually ess mine.

Harry

2007-08-15 22:18:55

Yes pancakes, it falls off in mining. WC doesn't fall off. I have no idea why Jagex did that, but read the random page on their website, it doesn't show wc axe fall off any more, just mining.

Sp0rky

2007-08-15 22:21:34

@r0b0t1: Make a pickup procedure based on your others xD

yay.

R0b0t1

2007-08-15 22:48:30

Sp0r-eh, whatya think I'm doing?

I'm putting it in my autominer I'm making.

Harry

2007-08-15 22:50:27

Oh, beat Wizzy's ;)

R0b0t1

2007-08-15 23:22:47

Meh… Is his in SRL?

I might beat it… But thats like beating hercules's son on muscle beach (huercules if Fakawi).

Santa_Clause

2007-08-16 07:49:33

Lmao!

Hercule's son!

Nice function r0bot.

R0b0t1

2007-08-16 16:25:17

W000000000000000000000t….



Added a function to find the pick head and attach it.

R0b0t1

2007-08-16 18:06:22

*R0b0t1 bumps the thread, because he calls special bump privileges. (And its his thread)

dvdcrayola

2007-08-16 18:14:12

is this to replace the SRL one?

because there is one in SRL right?

R0b0t1

2007-08-16 18:39:24

Ehh… not really, I just want some bug testers…


But it getting into SRL would be nice too.

dvdcrayola

2007-08-16 18:46:01

i would test it.. but its kinda tough to test because i would need to have a seperated head and shaft… sorry..

if it happens when im playing i would be glad to test though:)

R0b0t1

2007-08-16 19:19:51

No, you don't need to have it separated. You could just drop a pickaxe and see if it picks it up…

It uses colors, so it doesn't need to be just the "head" of it. Though it will give you an error about not finding the head… I hope you will be able to edit it out.

TIP: Just put a "//" before every


end else
Command;


end else
begin;
Commands;
end;

But make sure you put "//" before EVERYTHING.

dvdcrayola

2007-08-16 19:28:06

all right ill test it soon

i only found 1 end else… is there more that i missed?

you put PickHeadSP[0].AreShape:= 0; in stead of PickHeadSP[0].AreaShape:= 0; (no a in the first)

and im getting Line 82: [Error] (82:37): Type mismatch in script

line 82 is: PickColHolder:= GetColor(XDTM, YDTM);

R0b0t1

2007-08-16 19:42:09

I think there should be, just go through it.


I forgot to say, just edit out the "else", and leave the "end" but put a ";" after it.


end; //else
//begin;
//Commands
//end;

dvdcrayola

2007-08-16 19:49:35

i didnt find any others.. i even used ctrl+f… and did you see what else i posted?

R0b0t1

2007-08-16 19:53:34

Yeah… I'll fix those.

See? Bug testing.



Function R0bGetPickColor(Var PickColHolder:Integer; SetDTMNewCol: Boolean): Boolean;



+rep for actually helping me :D.

dvdcrayola

2007-08-17 01:51:06

what did you post that functions name for? haha

let me know when you fix those. (post here haha)

R0b0t1

2007-08-17 13:39:11

Yep, chech the main page, and replace the functions current name with that.

dvdcrayola

2007-08-17 13:42:38

simple fix.. the ddtm procedure still has this: PickHeadSP[0].AreShape:= 0;

needs to be AreaShape

in R0bGetPickColor; you put MakePckHeadDDTM; in stead of MakePickHeadDDTM;

R0bFindPickHead has a semicolon problem i cant quite figure out.. make it compile and ill test it i suppose

R0b0t1

2007-08-17 14:21:45

Thanks.

Lol.. lots of errors.

Its ok, you don't have to help.. I need to do some revising.

dvdcrayola

2007-08-17 14:23:28

i dont mind helping.. your probably much fater at solving errrors though:p

ill test once it compiles though.

HyperSecret

2007-08-17 14:42:22

ill give it a test also