SRL Archive - Jr. Member General Help and Discussion

Pixel Shift or a better idea?


IROC-Z

2014-09-15 20:48:22

I am going to try and focus my attention on a Hunter Script for catching red chins and I would like some advice on this.

First off, would the script be wanted around here?

Secondly, I would need some identification knowledge on the traps. I can distinguish traps that have been sitting for a while and drop by their specific color. When a box trap catches a chin it shakes because there is an animal in there so would it be possible to combine a function that looks for the trap via color and then uses pixel shift to know it is moving and then a double check with the mouse over text?

Lastly, this leaves us with box traps that are waiting to be sprung and ones that have sprung but the critter got away. Using colors I can get more pixels with the waiting to be sprung one because you can see five sides versus three-ish with failed one. I am not sure what would be at my disposal to help distinguish these two.

I would like to try and take this script on and try and get it out to you guys so any help and advice would be appreciated! Thanks!

Sin

2014-09-15 21:08:01

Honestly a functional chin hunter isn't hard, it's more about detecting which traps are YOURS.

The Mayor

2014-09-15 21:14:33

You should post some images of the traps in each situation as I don't know what chins are :p

bg5

2014-09-15 21:45:07

I can't give you any advice, because I would do this in exactly same way you describe. Maybe additionally I would try to check if in any of those 3 forms any unique color appears ( it might be imperceptible with naked eye, but ACA sometimes reveals some secrets :) )

IROC-Z

2014-09-15 22:03:43

How do I insert a picture into the post without it linking out? I want the picture to be visible in the post so we don't have to click a link that takes us to view the picture?

The Mayor

2014-09-15 22:22:42

From: IROC-Z
How do I insert a picture into the post without it linking out? I want the picture to be visible in the post so we don't have to click a link that takes us to view the picture?


./IMG]">

IROC-Z

2014-09-15 22:31:16

Well, I couldn't figure it out. ha


[ATTACH=CONFIG]24016[/ATTACH]

The top two are unsprung box traps.

The middle is a sprung trap with no chin in it.

The bottom right is a sprung trap with a chin in it.

The bottom left is a trap that didn't get any action so it just laid down for a nap.

[ATTACH=CONFIG]24017[/ATTACH]

The image above is a chin. hahaha

The below image is a Red Chinchompa. Taken in to consideration you weren't messing with me before, is so the joke is on me :duh:

[ATTACH=CONFIG]24018[/ATTACH]

The Mayor

2014-09-16 04:19:14

From: IROC-Z
Well, I couldn't figure it out. ha


The top two are unsprung box traps.

The middle is a sprung trap with no chin in it.

The bottom right is a sprung trap with a chin in it.

The bottom left is a trap that didn't get any action so it just laid down for a nap.




The unsprung and sprung traps are the same colur, but since the unsprung traps are much larger, they could easily be differentiated based on width.

I'm assuming you know what TPAs and ATPAs are here. This will result true if it can see an unsprung trap by looping through each TPA in the ATPA and checking the width. If the width is less than 30 (you can adjust), then we can assume it is an unsprung trap.


function isUnsprungVisible(): boolean;
var
i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin

// Find color -> TPA -> Split into ATPA

for i := 0 to high(ATPA) do
if ATPA[i].getBounds().getWidth() > 30 then
begin
writeLn('ATPA[' + toStr(i) + '] has a width > 30');
result := true;
break;
end;

end;


Now to differentiate between set traps and caught traps. Above you said that caught traps move, so yes you could use pixel shift. Same idea as above snippet, except we check for a width of less than 30 (again, you can adjust). If the width of the TPA is less then 30, then it will check the pixel shift of that TPA.


function isCaughtTrapVisible(): boolean;
var
i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin

// Find color -> TPA -> Split into ATPA

for i := 0 to high(ATPA) do
if ATPA[i].getBounds().getWidth() < 30 then
begin
writeLn('ATPA[' + toStr(i) + '] width < 30 - checking pixel shift');

if getPixelShift(ATPA[i], 250) > 50 then
begin
writeLn('ATPA[' + toStr(i) + '] pixel shift > 50!');
result := true;
break;
end;
end;

end;

IROC-Z

2014-09-16 18:40:44

Thanks The Mayor!


From: Sin
Honestly a functional chin hunter isn't hard, it's more about detecting which traps are YOURS.


To detect which our mine I would have to either have someting that finds me an empty world or detects when a person arrives

or

Is there something that could record the spot the trap was laid with some sort of lettered and numbered grid kinda how SPS works by selecting spots on the mini map? and then correlating them to the main screen? or am I getting too complicated or fictional? ha

**EDIT**
Will the new Simba affect my making of a script right now? Should I wait til it is out?