SRL Archive - OSR Help

Detect Poison/Poison gas


PattyCakes

2013-05-10 19:21:16

I'm working on a nat chest stealer, and i have everything working just fine, except the poison gas random. How would I got about detecting when this happens? I plan to detect it, then run south or whatever direction is away from the chest, then wait 20 seconds or however long it lasts. Please help (: Thanks

samerdl

2013-05-10 19:31:42

Does ACA color finding work? or does the Gas have a color that is similar to everything else in the environment?
You could try to use AutoColorAid, create a function that detects the Gas and a procedure that will perform the running once it does.

something simple like this, would it work?


Function Gas:Boolean;
Var
TPA:TpointArray;
tmpcts:integer;
begin

if Not loggedin then exit;

tmpcts := GetColorToleranceSpeed;

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(hMoD, SMoD);

result := FindColorsTolerance(TPA,Color,MSX1, MSY1, MSX2, MSY2,Tol);

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

procedure Gased;
begin
if not loggedin then exit;

writeln('Got gas');
mousebox(...Coordinates to where you want to run.);
Wait(randomrange(10000,15000));
end;
end;

And it goes to main loop..
repeat
thieve;
if gas then
gased;
until (not(loggedin));

Something like that doesn't work? (of course changing all the colors to real numbers)

PattyCakes

2013-05-10 19:37:40

I can try that. I originally was just using the SRL_IsPoisoned because the gas has the same animation as poison, but it wasnt working.

PattyCakes

2013-05-10 19:53:39

From: samerdl
Does ACA color finding work? or does the Gas have a color that is similar to everything else in the environment?
You could try to use AutoColorAid, create a function that detects the Gas and a procedure that will perform the running once it does.

something simple like this, would it work?


Function Gas:Boolean;
Var
TPA:TpointArray;
tmpcts:integer;
begin

if Not loggedin then exit;

tmpcts := GetColorToleranceSpeed;

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(hMoD, SMoD);

result := FindColorsTolerance(TPA,Color,MSX1, MSY1, MSX2, MSY2,Tol);

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

procedure Gased;
begin
if not loggedin then exit;

writeln('Got gas');
mousebox(...Coordinates to where you want to run.);
Wait(randomrange(10000,15000));
end;
end;

And it goes to main loop..
repeat
thieve;
if gas then
gased;
until (not(loggedin));

Something like that doesn't work? (of course changing all the colors to real numbers)


What does the SetColorSpeed2Modifiers do and how do I use it?

samerdl

2013-05-11 04:00:16

From: PattyCakes
What does the SetColorSpeed2Modifiers do and how do I use it?


The reason you MUST use ACA and you will.. Is simple - ACA is just powerful you know how colors change on RS everytime you reload the client? well with ACA you can find a color that will ALWAYS work regardless of client changing colors or not, jagex can't combat that - not without messing up their game.

There is really lots of guides that explain ACA and how it works, one below!


Ah this is Done in AutoColorAid, i'll give you a link to understand what that program does: here

http://villavu.com/forum/showthread.php?t=71074

What Setmodifiers does is that it changes the Modifier level to the level you desire by adding RGB/Hue sat. You should really check out the link and vid i put, ACA is a very powerful and useful tool!

So you can make it instead of looking all over mainscreen (MSX1, MSY1, MSX2, MSY2) you can make it look in a small box area around your character to detect the gas animation on screen and the poison on your characer's body.

Watch the vid and learn more about AutoColorAid :)

edit: just to further expand on this post, i found some screen shots of the gas from the random event solving thread (they won't be perfect but it should help you wrap it around)

So, once you use ACA - you want to load the Desktop window onto it, you do that by either pressing F4 or Going to Client > Client window and re size to desktop or find RS whatever fits you, get the RS screen inside it.




Next you pick the colors you want to detect - you set it to CTS2 (very accurate results)



As you go along detecting the green color you select mark best color and refresh till you get the red 'match' all in the screen or at least till your satisfied.



If you mess up and add colors that aren't green then just simply right click the color list on the right and select clear list to restart all over.



Once your done you'll see at the bottom right your best color + hue and sat, these are the detail you need!

So your end result will be something like:




function Gased: Boolean;
var
Gas: Tpointarray;
TmpCts: integer;
begin
if (not (loggedin)) then
exit;
tmpCTS := GetColorToleranceSpeed; // This will be used to reset our Color modifiers back to normal once it finds or doesn't find the gas.
ColorToleranceSpeed(2); // you can choose one two or three, i always go with Two.
SetColorSpeed2Modifiers(0.26, 0.97); // The hue/sat, same as from the pic
result := FindColorsTolerance(GAS, 5871252, MSX1, MSY1, MSX2, MSY2, 12); // this looks for it on the main screen with adding Hue/sat/CTS2 (good color detection)
ColorToleranceSpeed(TmpCTS); // then we reset it back to normal, so the script doesn't mess up
SetColorSpeed2Modifiers(0.2, 0.2); // this is the default hue/sat so the script doesn't mess up, once we find the color or we don't we reset the hue/sat/cts back to normal
end;



then you can do a basic thing to see if the color you picked ONLY detects gas, remember simba is a pascal based program that is most commonly used for the great SRL_Include that the SRL-community made, the include depends entirely on OCR - hence color.

so i would suggest you see if it detects only gas not player clothes/armor/grass etc..


{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}

procedure test1;
begin
if gased then
begin
writeln('we see the gas color!');
end
else
begin
writeln('we dont see the gas color');
end;
end;

begin
setupsrl;
repeat
test1
until (false);
end.

finally it will look like this:

{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}

function Gased: Boolean;
var
Gas: Tpointarray;
TmpCts: integer;
begin
if (not (loggedin)) then
exit;
tmpCTS := GetColorToleranceSpeed; // This will be used to reset our Color modifiers back to normal once it finds or doesn't find the gas.
ColorToleranceSpeed(2); // you can choose one two or three, i always go with Two.
SetColorSpeed2Modifiers(0.26, 0.97); // The hue/sat, same as from the pic
result := FindColorsTolerance(GAS, 5871252, MSX1, MSY1, MSX2, MSY2, 12); // this looks for it on the main screen with adding Hue/sat/CTS2 (good color detection)
ColorToleranceSpeed(TmpCTS); // then we reset it back to normal, so the script doesn't mess up
SetColorSpeed2Modifiers(0.2, 0.2); // this is the default hue/sat so the script doesn't mess up, once we find the color or we don't we reset the hue/sat/cts back to normal
end;

procedure test1;
begin
if gased then
begin
writeln('we see the gas color!');
end
else
begin
writeln('we dont see the gas color');
end;
end;

begin
setupsrl;
repeat
wait(400);
test1;
until (false);
end.


usually when i try to find a perfect color for a monster object, i add up a lot of pictures together of different things that might interfere then i pick the colors i want and keep selecting mark best color - till i find get a perfect color that can be seen on the object/monster alone.

For example when i was looking for monster colors i just add all of them together.


So i would advice to try out green outfits, if the color picks them up - then re-pick colors with ACA, try a few color samples and OF COURSE take screen shots of the gas FROM EVERY ANGLE/HIGHT/CAMERA/DISTANCE, you want a color that will ALWAYS find it, not just a color that finds it while you camera is east/west/north/south at one direction, but all directions.


Hope this helped!