SRL Archive - Jr. Member General Help and Discussion

couple questions


chief herb

2021-11-21 00:43:47

1. how come on my rsps script findcolorspiral tolerance seems to still search top left to bottom right for color
2. is there a way i can make it click the center of the closest/farthest/middle color found instead of the outside edge so it is inside hit boxes better?
2.b it likes to click the same npc i just clicked when i take out delay. would the best way be to look for the hitsplats/healthbar/or pixelshift or how can i make it not spam click the monster i just killed cause they have a death animation also.
3. also is remote input available for rsps scripts? if so how?
4. looking for a way to slow mouse speed down as my old method throws a error… this server im playing has somekind of flag system and i think i got flagged because mouse moved real fast
sorry for many questions. going to do some digging and if i find answers will edit.
thanks to any help/info provided. much love:stirthepot:

Flight

2021-11-23 08:53:05

From: chief herb
1. how come on my rsps script findcolorspiral tolerance seems to still search top left to bottom right for color
2. is there a way i can make it click the center of the closest/farthest/middle color found instead of the outside edge so it is inside hit boxes better?
2.b it likes to click the same npc i just clicked when i take out delay. would the best way be to look for the hitsplats/healthbar/or pixelshift or how can i make it not spam click the monster i just killed cause they have a death animation also.
3. also is remote input available for rsps scripts? if so how?
4. looking for a way to slow mouse speed down as my old method throws a error… this server im playing has somekind of flag system and i think i got flagged because mouse moved real fast
sorry for many questions. going to do some digging and if i find answers will edit.
thanks to any help/info provided. much love:stirthepot:


1) I couldn't really tell you about that one. If you'd like to provide an example of how you're utilizing this function I could probably give better advice.

2) Yes. If you've run a color-finding function and have gathered a TPA of the found colors, you can then split those into clusters based on a distance of your choosing. From there you can run through each cluster of found colors and define the center or even the mean of each cluster. Here's a quick and dirty example utilizing only built-in Simba functions:

var
i: Int32;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if (not FindColorsSpiralTolerance(CenterScreenX, CenterScreenY, TPA, NPCColor, ScreenX1, ScreenY1,
ScreenX2, ScreenY2, 15)) then Exit; // No colors found, exit

ATPA := ClusterTPA(TPA, 7);
if length(ATPA) < 1 then Exit; // Just in case

SortATPAFrom(ATPA, Point(CenterScreenX, CenterScreenY)); // Sort all TPAs from the center screen
for i:=0 to high(ATPA) do // Starting from the most center cluster to the furthest, do....
writeln('The middle of cluster #',i,' is ',MiddleTPA(ATPA[i]));
end.

3) That I'm unsure of. Possibly? My recommendation: take a look at how remoteinput is handled within the SRL-OSR include, use that as a template and apply that to your RSPS client instead. I've not played around much with it so it may not be, but it's worth a shot.

4) If you're using SRL-OSR in conjunction with your RSPS script, you could simply set the mouse speed with Mouse.Speed := …. 16 is default IIRC.

chief herb

2021-11-25 00:00:46

From: Flight
1) I couldn't really tell you about that one. If you'd like to provide an example of how you're utilizing this function I could probably give better advice.

2) Yes. If you've run a color-finding function and have gathered a TPA of the found colors, you can then split those into clusters based on a distance of your choosing. From there you can run through each cluster of found colors and define the center or even the mean of each cluster. Here's a quick and dirty example utilizing only built-in Simba functions:

var
i: Int32;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if (not FindColorsSpiralTolerance(CenterScreenX, CenterScreenY, TPA, NPCColor, ScreenX1, ScreenY1,
ScreenX2, ScreenY2, 15)) then Exit; // No colors found, exit

ATPA := ClusterTPA(TPA, 7);
if length(ATPA) < 1 then Exit; // Just in case

SortATPAFrom(ATPA, Point(CenterScreenX, CenterScreenY)); // Sort all TPAs from the center screen
for i:=0 to high(ATPA) do // Starting from the most center cluster to the furthest, do....
writeln('The middle of cluster #',i,' is ',MiddleTPA(ATPA[i]));
end.

3) That I'm unsure of. Possibly? My recommendation: take a look at how remoteinput is handled within the SRL-OSR include, use that as a template and apply that to your RSPS client instead. I've not played around much with it so it may not be, but it's worth a shot.

4) If you're using SRL-OSR in conjunction with your RSPS script, you could simply set the mouse speed with Mouse.Speed := …. 16 is default IIRC.


thanks for replying. much love <3


1.USING SLACKYS TPA SCRIPT NOW. code is very basic but works for what i needed when i started. would like to get more advanced now. ignore the lines i blanked out… i dont really use those but might use them in future scripts i make so i dont delete x]
  procedure ClickNPC;     //clicks npc
var
x, y : integer;
t, p : integer;
c, d : integer;
begin
if FindColorSpiralTolerance(x, y, NPCCOLOR, 7, 59, 506, 323, 3) then //npc color
begin
writeLn('clicking npc');
MoveMouse(x, y);
// if FindColorspiralTolerance(t, p, 65535, 58, 31, 277, 47, 0) then //finds yellow color in attack options top left
//writeLn('1');
begin
// if FindColorspiralTolerance(c, d, 255, 58, 31, 277, 47, 0) then //white attack color
//writeLn('2');
begin
wait(50);
ClickMouse(x, y, MOUSE_LEFT);
wait (2000 + Random(500));
writeLn('clicked');
end
//end
end else;
end;

2. DONE okay so how do i go about turning my found colors to tpa's? can link a guide or show me a basic example for my script above please? also would like to make it not click the same tpa it just clicked until a short time has passed to circumvent the death animation if possible somehow?

3. thats a little out of my league but will take a peak and try to learn how they made it and see if i can somehow replicate it and make necessary changes.

4. DONE higher number is slower, right? whats considered more human-like and how could i make it have more of a random range? also not sure how to use it in script i tried to do set mouse.speed:= 30. and it didnt work. in my main loop.

thanks again…

*rant* im really new to scripting and am proud i even figured out how to do some of the scripts ive made and had them work half ass decent. took me awhile before i applied myself and really tried to make something but enjoyed it alot and is cool seeing what you make work. *end rant*

Flight

2021-11-25 08:00:55

Is this private server OSR-based? If so I'd highly recommend SRL-OSR. A nicely visually constructed tutorial on color-finding and clustering can be found here. And for your mouse speed, it's the opposite I believe; higher mouse speed = faster mouse movement.

chief herb

2021-11-26 00:24:19

From: Flight
Is this private server OSR-based? If so I'd highly recommend SRL-OSR. A nicely visually constructed tutorial on color-finding and clustering can be found here. And for your mouse speed, it's the opposite I believe; higher mouse speed = faster mouse movement.


no its a custom server not sure on revision. will check it out thanks

chief herb

2021-11-26 06:32:18

From: Flight
Is this private server OSR-based? If so I'd highly recommend SRL-OSR. A nicely visually constructed tutorial on color-finding and clustering can be found here. And for your mouse speed, it's the opposite I believe; higher mouse speed = faster mouse movement.


got TPA'S working any way i can make it move to next points if it finds a red hp bar above the npc? and to also just clicking the 1st closest index without red hp bar without looping the points it has found? or what would be a decent way of doing this? <3

its for a rsps npc clicker it like to keep clicking the monster im fighting sometimes also moves to random locations on screen after where usually the first thing it goes to is correct

 procedure ClickNPC;     //clicks npc
var
TPA,Group: TPointArray; //the list in which we store the points
ATPA: T2DPointArray; //the groups we found
i: Int32;
begin
if srl.FindColors(TPA, CTS2(9520708, 5), Mainscreen.GetBounds) > 0 then
begin
WriteLn('I found ',Length(TPA),' points');
ATPA := TPA.Cluster(4);
WriteLn('I split the points into ',Length(ATPA),' groups');

// remove none-interesting outliers so we don't have to mouse over them
ATPA.FilterSize(50, 500);

// Make the first group in the list of groups `ATPA` closest to us.
ATPA.SortByIndex(mainscreen.GetMiddle);

// loop through every group, nearest to furthest away
for Group in ATPA do
begin
// move mouse to a random point in the group
// We access a random individual point in that group by indexing
//
// Breaking it down:
// Length(Group) returns the number of points in the group
// Random( .. ) generates a random value in the range 0..Length(Group)-1
// Group[ .. ] accesses the item at that random index.
Mouse.Move( Group[Random(Length(Group))] );

// check if the uptext matches our expectations
//if MainScreen.IsUpText('Attack Rare Warrior') then
begin
// click this object!!
Mouse.Click(ctRed);

// stop the loop, we found what we were looking for!
Break;
wait (2000 + Random(500));
end;
// we end up here if the group didn't match our expectations
// so we will move to the next group and see if that's any better.
end;
end;
end;

tehYosh

2021-11-28 07:30:05

I can't give you a coded example, but I can give you an attempted logical breakdown of what you want to do, perhaps someone with a bit more skill can advise how to achieve it:

>Find TPA in ATPA
>Expand TPA by an amount to include where health bar would be.
>Look for health bar in new bounds
>> If found health bar then go next TPA, else you've found a suitable target

Sounds easy in principle, but TPAs are not my strongest suit I'm afraid! I've made a very flimsy combat script using health bars to detect if in combat but it doesn't do very well with other people around for this exact reason. Hopefully someone might be able to shed the light you need on how to achieve it, or with enough time you might figure it out yourself :)

chief herb

2021-11-28 22:57:22

From: tehYosh
I can't give you a coded example, but I can give you an attempted logical breakdown of what you want to do, perhaps someone with a bit more skill can advise how to achieve it:

>Find TPA in ATPA
>Expand TPA by an amount to include where health bar would be.
>Look for health bar in new bounds
>> If found health bar then go next TPA, else you've found a suitable target

Sounds easy in principle, but TPAs are not my strongest suit I'm afraid! I've made a very flimsy combat script using health bars to detect if in combat but it doesn't do very well with other people around for this exact reason. Hopefully someone might be able to shed the light you need on how to achieve it, or with enough time you might figure it out yourself :)


thanks for your input. im thinking of trying to if not find hp bar then click the red possibly. but how do i move to the next tpa in the group. so i click&kill
Mouse.Click(ctRed);
but then i want to move mouse to the second closest point. i tried
Mouse.Click(ctBlue);
but it didnt work? cause that should solve my problems as i usually fight npcs where nobody else is. so after 2,3 different tpa clicks the
Mouse.Click(ctRed);
should be gone by then. thx for any info