PDA

View Full Version : [Resolved] sps_getMyPos fix [resolves spam clickNorth]



DaWu
11-30-2011, 07:07 PM
rs_GetCompassAngleDegrees works fine. Click here (http://villavu.com/forum/showpost.php?p=852322&postcount=16)for my explanation. Changing line 227 in Simba/Includes/SPS/SPS.simba to this should resolve the issue.

if (inRange(round(rs_GetCompassAngleDegrees), 10, 350)) then


The final solution ^^




-----------------------------------------------------------------------------------------------------------




Fix I posted earlier had a flaw, a huge flaw, in it and it took some measures that weren't really needed.

This one appears to work just fine for me. Please test and report back if you find it to not work as supposed.

It uses the blue and red colors on the compass to tell if its north.



function SPS_GetMyPos: TPoint;
var
Minimap: T3DIntegerArray;
t, map: integer;
begin
Result := Point(-1, -1);

if not LoggedIn then
Exit;

if not SPS_Loaded then
SPS_Load;

// we should just rotate the minimap according to the minimap angle.
if not(GetColor(544, 17)= 7699891) and not (GetColor(543, 29)= 3227717) then
ClickNorth(True);

t := getSystemTime;
Minimap := SPS_GatherMinimap;
if (High(Minimap) < 0) then
begin
if (SPS_Debug) then
WriteLn('[SPS] Did not gather Minimap.');

Exit;
end;

try
map := SPS_FindMapInMapEx(
Result.X, Result.Y, SPS_Worldmap, Minimap, SPS_Surface.Tolerance
);

if ((Result.X > 0) and (Result.Y > 0)) then
begin
Result := SPS_LocalToGlobal(SPS_Areas[map], Result.X, Result.Y);
end;

if (SPS_Debug) then
writeln(format('[SPS] GetMyPos: Finished in %d ms. Location = %s',
[getSystemTime - t, toStr(result)]));

except
Writeln('[SPS] ERROR in SPS_GetMyPos: ' + ExceptionToString(ExceptionType, ExceptionParam));
SPS_WarnUser('SPS_GetMyPos', ExceptionToString(ExceptionType, ExceptionParam));
end;
end;

Edit: Navigate to Includes/SPS/ and open sps.simba, find function called sps_getMyPos, replace it with ^^ and save it to apply this fix.

kingarabian
11-30-2011, 07:32 PM
Looking good. But we need a fix for the ChooseOption...

Sir R. M8gic1an
11-30-2011, 08:30 PM
if not(GetColor(544, 17)= 7699891) and not (GetColor(543, 29)= 3227717) then


Should it not be or? I guess and might work too..

-RM

DaWu
11-30-2011, 08:34 PM
If those aren't there, the compass "Pointer" isnt in correct direction, aka red pointer up and blue blob bottom end down
thats why I used and instead of or, so it checks both of those points, up and down to avoid false activations. I think it should be more reliable this way.
But yeah you most likely could just use OR there.


Either way I've been having no problems with this one for now in my test runs, worked like a charm.

Tyrosus
12-01-2011, 12:13 AM
This may sound like a stupid question, but where can I plug this into Simba? Appreciate the quick ghetto fix, btw! I love this community. Keep the pressure on Jagex :D

DaWu
12-01-2011, 12:33 AM
This may sound like a stupid question, but where can I plug this into Simba? Appreciate the quick ghetto fix, btw! I love this community. Keep the pressure on Jagex :D

Navigate to Includes/SPS/ and open sps.simba, find function called sps_getMyPos, replace and save it.

Tyrosus
12-01-2011, 01:31 AM
Navigate to Includes/SPS/ and open sps.simba, find function called sps_getMyPos, replace and save it.

You rule, thank you for the speedy response. Still trying to learn how to script myself so I can contribute as well :) I'd love to join the fight for the bots, lol.

YoHoJo
12-01-2011, 02:31 AM
Anyone test and confirm this to work well?
Should it be committed?

tls
12-01-2011, 02:36 AM
Anyone test and confirm this to work well?
Should it be committed?

No, rs_GetCompassAngleDegrees should be fixed instead. This is just a quickfix.

DaWu
12-01-2011, 02:43 AM
No, rs_GetCompassAngleDegrees should be fixed instead. This is just a quickfix.

Tho, sps_getMyPos only needs north for now.

YoHoJo
12-01-2011, 02:44 AM
No, rs_GetCompassAngleDegrees should be fixed instead. This is just a quickfix.

Ah yes okay. Someone should start tweaking that then, thanks.

DaWu
12-01-2011, 02:54 AM
Im curious if anyone else even is having the same problem I made this fix for, hah.

piper101
12-01-2011, 03:06 AM
yeah, im cutting yews and its right clicking compass set to north like crazy, ill add this in a bit. thanks.

Edit: Just to clarify, do we add yours, DaWu, and his (Coh3n)? Bit nooby still.

YoHoJo
12-01-2011, 03:07 AM
Yea lots of people are DaWu, I was using Lumby West Miner/Banker and it was clicknorthing like crazy.

Coh3n
12-01-2011, 03:15 AM
rs_GetCompassAngleDegrees works fine. Click here (http://villavu.com/forum/showpost.php?p=852322&postcount=16)for my explanation. Changing line 227 in Simba/Includes/SPS/SPS.simba to this should resolve the issue.

if (inRange(round(rs_GetCompassAngleDegrees), 10, 350)) then

DaWu
12-01-2011, 03:30 AM
^Appears to work just fine too, so I guess this was purely SPS targetted miniupdate by jagex, as it only started to happen to me today.

YoHoJo
12-01-2011, 03:35 AM
Thanks Cohen! Will give that a whirl!

snowneo
12-01-2011, 06:43 AM
rs_GetCompassAngleDegrees works fine. Click here (http://villavu.com/forum/showpost.php?p=852322&postcount=16)for my explanation. Changing line 227 in Simba/Includes/SPS/SPS.simba to this should resolve the issue.

if (inRange(round(rs_GetCompassAngleDegrees), 10, 350)) then


Thank you, that worked like a charm :). It's amazing how such a small change in numbers can have a huge impact on scripts.

iamorange12
12-01-2011, 08:45 AM
rs_GetCompassAngleDegrees works fine. Click here (http://villavu.com/forum/showpost.php?p=852322&postcount=16)for my explanation. Changing line 227 in Simba/Includes/SPS/SPS.simba to this should resolve the issue.

if (inRange(round(rs_GetCompassAngleDegrees), 10, 350)) then


Thanks, it worked, I shoulda :google:

YoHoJo
12-01-2011, 08:46 AM
Cohen's fix works just fine!

truxo
12-01-2011, 01:24 PM
Works Flawless with Thanks!

Coh3n
12-01-2011, 06:32 PM
SPS has been updated, so everything should be working when your SPS updates (if you haven't updated manually already).

kingarabian
12-02-2011, 06:52 AM
Still spamming it.It's still clicking it at random pointless times. It sometimes clicks north 3 times in a row.

I used Coh3n's fix.

Sorry I forgot to change the 5 to 10.

icez123
12-04-2011, 12:51 AM
thanks alot

YoHoJo
12-04-2011, 01:08 AM
Mine is still clicking compass pretty often.
How would I need to edit the angles to make the range even more 'extreme' so it's clicked less?

if (inRange(ang, 10, 350)) then


Because before it was 5, 355
The first one was increased to 10, yet second decreased to 350, I dun get it.
If I set it to like 5, 355 would it be a super bigger range and thus click less often?

YoHoJo
12-04-2011, 10:24 AM
bumb, answer please ^!

legoace
12-04-2011, 11:38 PM
If the angle is between 5 degrees and 355 degrees, it will think that the compass is not north enough. Therefore it will click the compass. Narrowing this range to 10 < angle < 350 means that it is more likely SRL will see the compass as being acceptably North.

Gurkis
12-25-2011, 08:39 PM
My B. Wrong thread <,>