SRL Archive - OSR Help

Need some help solving a (probaly relatively easy) problem


Athylus

2014-06-26 17:35:33

Hey all! I've made a script here before if someone remembers (must've been a year ago or so) and I decided to get back in the game. So I'm giving this all a go again and noticed that reflection is working pretty well right now. But the includes need to be updated or so it says in the debug bog, so I'm trying to make some color only scripts.

Right now I am making a wood chopper, and first it would move the mouse and click a lot. So I searched up for some animating stuff and after some hard work I got the pixelshift to work, so now it only chooses the chop down option when I am idle below 400 pixels in half a second. However after chopping it has to find a tree, but the tree stump is left after chopping one down which has the same color as the regular tree trunks. So it will often shoot from trunk to trunk till it finds a tree. How do I go about fixing this?

program new;
{$DEFINE SMART}
{$I SRL-OSR/SRL.Simba}
{$I SRL-OSR/SRL/Reflection/Reflection.simba}

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Nick := '';
Active := true;
end;
end;

function TreeColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.05, 0.44);

if not (FindColorsTolerance(arP, 5735072, MSX1, MSY1, MSX2, MSY2, 18)) then
begin
//Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
Result := arC[i];
//Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;

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

if (i = arL + 1) then
//Writeln('AutoColor failed in finding the color.');
end;

//Use this function to get average pixels
function AnimatingCheck: Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 295, 195);
WriteLn(IntToStr(AveragePixelShift(PBox, 250, 500)));
end;

function Chopping: Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 295, 195);
Result := (AveragePixelShift(PBox, 250, 500) > 400);
end;

procedure ChopTree;
var
x, y: Integer;

begin
if not Chopping then
begin
if FindObj(x, y, 'hop do', TreeColor, 5) then
begin
WriteLn('Tree found');
Mouse(x, y, 5, 5, false);
ChooseOption('Chop down');
Wait(1200 + random(450));
end;
end else
WriteLn('Chopping...');
Wait(1000);
end;

begin
SetupSRL;
//SetupReflection;
DeclarePlayers;
LoginPlayer;
(*repeat
AnimatingCheck;
until(False);*)
repeat
ChopTree;
until(false);
end.

Awkwardsaw

2014-06-26 17:56:59

have the script look for the green leaves instead, use ACA to help find a unique color that will only find the trees(It's really easy :))

Athylus

2014-06-28 06:56:13

I see, I haven't thought of that… Well I have, but I dismissed it because the tiles around it are green you know? I'll give that a shot, thanks matey.

Also what exactly is a TBox?

Edit: It's working much better now, thank you awkward saw! Now I will try to add banking and then release it, because by then I'll have no use for it anyway. :p Oh I also need to make ent detection, but that shouldn't be too hard. FindNormalRandoms doesn't work so well as I would like it to unfortunately! Perhaps I'll have it released by the end of this evening. Super cool.

KeepBotting

2014-06-28 09:23:05

From: Athylus
I see, I haven't thought of that… Well I have, but I dismissed it because the tiles around it are green you know? I'll give that a shot, thanks matey.

Also what exactly is a TBox?

Edit: It's working much better now, thank you awkward saw! Now I will try to add banking and then release it, because by then I'll have no use for it anyway. :p Oh I also need to make ent detection, but that shouldn't be too hard. FindNormalRandoms doesn't work so well as I would like it to unfortunately! Perhaps I'll have it released by the end of this evening. Super cool.
A TBox is a box on the screen, made up of two points (top-left and bottom-right)

Athylus

2014-06-28 16:14:44

Thanks you KB. :)

Wire

2014-06-28 17:00:54

From: Athylus
Thanks you KB. :)
If you're anything like me i would require a example, but if you aren't ingore this post. I just recently myself learned about TBoxs and have implemented into my script. This is a an example of findcolorspiraltolerance with a tbox that will search for the color only in the box. I almost made a quick little picture to illustrate it better if you perfer visual over written examples. Standard (x,y) in picture blue X green Y.
FindColorSpiralTolerance(x, y, 14480069, 584, 278, 603, 294, 14);
[ATTACH=CONFIG]23452[/ATTACH]

Athylus

2014-06-28 19:34:01

Oh hey that's pretty smart Wire, what a great tip! Thank you friend. How did you define the variables? Like x, y: TBox and then later you declare x := 123, 123 and y := 333, 333 (I know coords dont make sense but u get it).

Also I am trying this reflection walking thing and don't really want to make a new thread for it. Someone posted this:

const
{how randy do you like it?}
randy = 1;

{current revision corresponds to elfyys include. get new hooks there or somewhere else.}
{updated ones should be at http://osrreflection.googlecode.com/git/Core/Hooks.simba}
ReflectionRevision = '52';
HookLocalPlayer = 'g.ho';
HookGetBaseX = 'm'; //
HookGetBaseY = 'v'; //
HookCharacterX = 'k';
HookCharacterY = 'p';
HookGetBaseXMultiplier = 640915389; //
HookGetBaseYMultiplier = -2112689689; //
HookCharacterXMultiplier = -657252599;
HookCharacterYMultiplier = -1947713529;
So first thing I did was try to take a look in the reflection include at hooks and I found reflection vision, but the others all have names that aren't in there and can't quite figure them out. Can someone help me out?

Wire

2014-06-29 23:33:34

From: Athylus
Oh hey that's pretty smart Wire, what a great tip! Thank you friend. How did you define the variables? Like x, y: TBox and then later you declare x := 123, 123 and y := 333, 333 (I know coords dont make sense but u get it).

Also I am trying this reflection walking thing and don't really want to make a new thread for it. Someone posted this:

const
{how randy do you like it?}
randy = 1;

{current revision corresponds to elfyys include. get new hooks there or somewhere else.}
{updated ones should be at http://osrreflection.googlecode.com/git/Core/Hooks.simba}
ReflectionRevision = '52';
HookLocalPlayer = 'g.ho';
HookGetBaseX = 'm'; //
HookGetBaseY = 'v'; //
HookCharacterX = 'k';
HookCharacterY = 'p';
HookGetBaseXMultiplier = 640915389; //
HookGetBaseYMultiplier = -2112689689; //
HookCharacterXMultiplier = -657252599;
HookCharacterYMultiplier = -1947713529;
So first thing I did was try to take a look in the reflection include at hooks and I found reflection vision, but the others all have names that aren't in there and can't quite figure them out. Can someone help me out?

No idea about the hooks honestly, but function FindColorSpiralTolerance(var x, y, Color#, Tbox Coord's, Tolerance); so in my case i declared globally x, y, because they are used in a lot of things. FindColorSpiralTolerance(x, y(my declared globally variables if the color is found coordinates for later functions), 14480069(Color# from ACA), (584, 278, 603, 294 tbox coordinates), 14(ColorTolerance also from ACA));

Also sorry for the late reply i do not receive a notification if my comment isn't replied to, if you want pm for faster response, Wire.

Edit- I seen you want to use reflection for walking, i use R_WalkPath(). Go into your reflection folder and into tools and open the script named PathMaker. Read the intro and find the point print and past into the R_WalkPath(). This is an example from my script, uses points i made to place "flags" on the minimap in a human like fashion.
R_WalkPath([Point(3254, 3424), Point(3263, 3428), Point(3277, 3430), Point(3283, 3438), Point(3286, 3450), Point(3294, 3460), Point(3296, 3473), Point(3303, 3483), Point(3302, 3490)]);

Athylus

2014-06-30 08:09:01

Ah I get it now, I was overthinking again. Thanks!

No problem man, don't sweat it. As long as someone replies I'm happy lol

Yeah it was a bit tough but I got working already, but still thanks! I used the pathmaker V2 and it's working great. However it only executes the next action only after the walking is down, it slows down my bot quite a bit.

Does anyone else have problems with the reflection include? It suddenly says 'Uknown identifier R_InteractingNPC' at line 440. This shit breaks my head sometimes man lol… color > reflection I guess.

Edit: Reinstalled the reflection include and it's working now! weird lol

Also, my first completed script ran for a good 90 minutes yesterday without being interrupted so cheers for that!

Is it possible to make an area out of tiles? And then check if the player is in that area.