SRL Archive - OSR Help

Help with TPAs


Foundry

2013-07-29 22:57:53

So I found a tutorial on a more accurate way to target mobs and I decided to use TPAs to make a cow killing script. The script worked a few hours ago on a different computer, but now it is not working on the one I am using now, with the computers having the same specs and everything (Windows 7 64 bit etc.) The problem I am having with it is its not finding the cow to click on it. I tried picking new colors and tolerances for about 15 minutes to see if it would work but that was to no avail. Could someone take a look at it and tell me if there are any obvious errors?

Function KillCows: Boolean;

Var

TPAA: T2DPointArray;
TPA: TPointArray;
CTS, x, y, I, Retry: Integer;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
case Random(3) of // this is for the different color cows
0:
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 3822686, MSX1, MSY1, MSX2, MSY2, 15); // I tried changing all of the MSs here to 0, 0, 750, 450
1:
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 5726322, MSX1, MSY1, MSX2, MSY2, 15);
2:
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 8229540, MSX1, MSY1, MSX2, MSY2, 15);
end;
ColorToleranceSpeed(CTS);
TPAA := TPAToATPAEx(TPA, 3, 3); // I also messed with the width and height
SortATPASize(TPAA, True);
For I := 0 To High(TPAA) do
if GetArraylength(TPAA[i]) > 4 then // changed this several times
begin
repeat
inc(Retry);
MiddleTPAEx(TPAA[i], x, y);
MMouse(x, y, 3, 3);
if (IsMouseOverText('tta')) then
begin
Result := true;
GetMousePos(X, Y);
mouse(x,y,2,3, true);
wait(3500 + Random(1000));
Break;
end;
until (Retry = 2);
Break;
end;
end;

Sjoe

2013-07-29 23:01:08

Try autocoloring it mate, much more accurate.

Click here for video tutorial.

Le Jingle

2013-07-30 11:37:47

Using ACA is very helpful for Beginners and I would recommend it for accurately picking the cow colors you need (perhaps using a CTS of 2, for more accurate results too in ACA)

There's also many guides in the Intermediate Section and the Advanced Section that explain TPA's too :)

Also, you can find help often at #SRL in rizon server/network on IRC.

Cheers
Lj

Foundry

2013-07-30 17:36:53

For some reason I narrowed it down to simba (on this new computer, not the one I wrote the script on) isn't finding the colors right for me. I have my settings exactly the same as before and am playing in the same browser and everything. For example, I used the color picker to get the color of the top of a bankbox and tested if simba could even find that color AT ALL, and it couldn't find it anywhere on the screen. I also had the right client selected. I didn't log out in between so the color didn't change. I even double checked the color to be sure it was the same number. I have re-installed simba several times and it is still doing the same thing.

program new;
//{$DEFINE SMART}
{$I SRL/SRL.simba}
{$i sps/sps.simba}

procedure findthecolor;
var
x, y: Integer;
begin
if FindColorTolerance(x, y, 8881020, 0, 0, 750, 450, 3) then
begin
Mouse(x, y, 3, 3, True);
WriteLn('found it');
end;
end;
begin
SetupSRl;
dothecolor;
end.

I ran this several times and at 0 tolerance it didn't find the color (when it should have… it was right there in front of it.), but at around 10 or 15 it started clicking colors similar to the top of the bankbox, but not the one I specified.

Sjoe

2013-07-30 17:54:31

From: HardcorBoter
For some reason I narrowed it down to simba (on this new computer, not the one I wrote the script on) isn't finding the colors right for me. I have my settings exactly the same as before and am playing in the same browser and everything. For example, I used the color picker to get the color of the top of a bankbox and tested if simba could even find that color AT ALL, and it couldn't find it anywhere on the screen. I also had the right client selected. I didn't log out in between so the color didn't change. I even double checked the color to be sure it was the same number. I have re-installed simba several times and it is still doing the same thing.

program new;
//{$DEFINE SMART}
{$I SRL/SRL.simba}
{$i sps/sps.simba}

procedure findthecolor;
var
x, y: Integer;
begin
if FindColorTolerance(x, y, 8881020, 0, 0, 750, 450, 3) then
begin
Mouse(x, y, 3, 3, True);
WriteLn('found it');
end;
end;
begin
SetupSRl;
dothecolor;
end.

I ran this several times and at 0 tolerance it didn't find the color (when it should have… it was right there in front of it.), but at around 10 or 15 it started clicking colors similar to the top of the bankbox, but not the one I specified.


Give the tutorial I linked a go bud. U won't regret it

Foundry

2013-07-30 17:58:04

Thank you for the link, and I have already tried autocoloring to find npcs, and it works quite well. I guess I should post my problem in a different section, as I have figured out it doesn't have anything to do with the script apparently. My install of Simba is not identifying colors correctly.

Sjoe

2013-07-30 18:06:23

From: HardcorBoter
Thank you for the link, and I have already tried autocoloring to find npcs, and it works quite well. I guess I should post my problem in a different section, as I have figured out it doesn't have anything to do with the script apparently. My install of Simba is not identifying colors correctly.


in your mainloop it says dothecolor; while the procedure's name should be findthecolor;

Is that one of the reasons?

masterBB

2013-07-30 18:07:49

From: HardcorBoter
Thank you for the link, and I have already tried autocoloring to find npcs, and it works quite well. I guess I should post my problem in a different section, as I have figured out it doesn't have anything to do with the script apparently. My install of Simba is not identifying colors correctly.


Could you run this:

program new;

var
w, h: Integer;
bmp: Integer;
begin
GetClientDimensions(w, h);

bmp := BitmapFromClient(0, 0, w - 1, h - 1);

ClearDebugImg();
DisplayDebugImgWindow(w, h);
DrawBitmapDebugImg(bmp);
end.

Wrote it in browser but should work.

Foundry

2013-07-30 18:12:42

I changed that when I was making the post, my bad. It is the same in the script.

Yes, that runs and everything and brings up a black window that eternally says loading.

EDIT: I was loading the game a few seconds before I ran that
EDIT 2: yeah whenever I run it it shows what was in that window prior to when I switched to the client

masterBB

2013-07-30 18:18:04

From: HardcorBoter
I changed that when I was making the post, my bad. It is the same in the script.

Yes, that runs and everything and brings up a black window that eternally says loading.

EDIT: I was loading the game a few seconds before I ran that


I wanted to know if the screen that pops up looks similar to whatever the client or target is at that moment.

e:
EDIT 2: yeah whenever I run it it shows what was in that window prior to when I switched to the client


Then your color recognition works fine ;)

Foundry

2013-07-30 18:19:58

From: masterBB
I wanted to know if the screen that pops up looks similar to whatever the client or target is at that moment.

It does not look at all similar

masterBB

2013-07-30 18:22:59

From: HardcorBoter
It does not look at all similar


Hmmm, well that is odd. That code gets whatever is the target as a bitmap. Are the colors different, the image itself, is black? What are you seeing?

Sjoe

2013-07-30 18:24:30

I can help u with the TPA's thru teamviewer if u want?

Foundry

2013-07-30 18:26:16

Is it ok if I upload a screenshot or a link to one?

Sjoe

2013-07-30 18:35:36

From: HardcorBoter
Is it ok if I upload a screenshot or a link to one?


go for it

Foundry

2013-07-30 18:36:29

http://i823.photobucket.com/albums/zz152/rcr083096/Helpme_zps7d385b86.png

Sjoe

2013-07-30 18:38:41

Do you see this green crosshair in simba?
DRAG that on the runescape client so that only your runescape client is covered in red
Then start the script.

Foundry

2013-07-30 18:39:12

I did that many times over

Sjoe

2013-07-30 18:42:24

From: HardcorBoter
I did that many times over


Well that's weird

@masterBB helps :p

masterBB

2013-07-30 18:46:26

From: Sjoe
Well that's weird

@masterBB helps :p


NANANANANANANANANA Bartman! To the rescue!

uhm, Are you sure openGL or directX mode aren't turned on by any change?

Foundry

2013-07-30 18:48:32

In the graphics settings, OpenGL is selected. But doesn't one or the other have to be chosen?

masterBB

2013-07-30 18:51:03

From: HardcorBoter
In the graphics settings, OpenGL is selected. But doesn't one or the other have to be chosen?


Well, there is your problem! There used to be some software mode. We can actually read openGL thanks to Brandon. But you need that plugin and the latest version of SMART. Or else you need to use software mode/safe mode.

Foundry

2013-07-30 18:54:03

From: masterBB
Well, there is your problem! There used to be some software mode. We can actually read openGL thanks to Brandon. But you need that plugin and the latest version of SMART. Or else you need to use software mode/safe mode.


So, do I have to use SMART, or do I just need to update it?

The Killer

2013-07-30 18:54:33

From: masterBB
Well, there is your problem! There used to be some software mode. We can actually read openGL thanks to Brandon. But you need that plugin and the latest version of SMART. Or else you need to use software mode/safe mode.

Software mode got removed :/ I don't know the current status on safety mode but I think it still works.

Foundry

2013-07-30 18:57:43

I tried switching to DirectX and it works. Thanks everyone and sorry for the trouble!

masterBB

2013-07-30 18:59:29

From: HardcorBoter
So, do I have to use SMART, or do I just need to update it?


Well, as you can see, RS3 broke some pretty important stuff in SRL. The SRL devs will take this down time to make sure they got an amazing include ready for you as fast as possible. Doing more then just fixes to get it working for now.

There were some fixes going around on this forum by people tweaking srl 5 themselves so they can bot now. I however don't play or bot runescape so I am not sure who or what.

e:
Good to hear you got it working ;)