SRL Archive - Help

Warning! You passed a wrong ys...


Justin

2011-12-26 19:08:45

Hey all.

I am currently having a problem with my fighting script.

I am unable to find out what is going wrong.

This is the error

Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.
the 'ys' can change to 'xs, ye, xe' but the negative numbers are different

I believe the code below is where the error is coming from


procedure Attack;
var Xi, Yi:integer;
begin
if InFight then
begin
repeat
FindNormalRandoms;
until (not (OthersInFight) or (not LoggedIn) or (not InFight))
end;
x := Random(8)
case x of
4: WalkToMen; //Failsafe if we get lured
end;
if FindObjCustom(Xi, Yi, ['ttack'], ManColours, Tolerance) then
begin
if not (IsFightAt(Xi, Yi) and not InFight) then
begin
GetMousePos(Xi, Yi);
Mouse(Xi, Yi, RandomRange(0,5), RandomRange(0,5), false);
WaitOptionMulti(['ttack M', 'attack Man'], 200);
end;
while IsMoving do
begin
Wait(250);
end;
end;
SetAngle(True);
end;

Anyone have any clue how to hide/fix the warnings?

Shuttleu

2011-12-26 19:11:06

looking at that, i dont see how it can be coming from there, i believe it must be coming from another place

care to post the script?

~shut

YoHoJo

2011-12-26 19:12:21

http://villavu.com/forum/showthread.php?t=70152&highlight=Warning!+passed+wrong+finder+function

Answer there. Bascailly it's something up with FindObj, and it's not even really a problem unless it makes your mouse act odd.

Also in your Mouse, why RandomRange(0,5) you can just put 5…?

Justin

2011-12-26 19:16:06


//EDGEVILLE MAN KILLER - MADE BY ~JUSTIN
program EdgeManKiller;
{.include SRL/SRL/Misc/Smart.scar}
{.include SRL/SRL.scar}
{.include SRL/SRL/Skill/Fighting.scar}
{$i sps/sps.simba}
{$DEFINE UseLaptopMouse}
var
ManColours : TIntegerArray;
x, y, i, StartAttack, StartStrength, StartDefence, StartHitpoints, CurrentAttack, CurrentStrength, CurrentDefence, CurrentHitpoints, LevelPopUp, NoThanks, xx,yy : integer;
WalkBank,WalkMen,MyTPA: TPointArray;
MyPoint : TPoint;
const
Tolerance = 2; //Make higher if it wont attack;
Version = '0.501'; //Please don't change.
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
With Players[0] do
begin
Name := '@gmail.com'; //Character Name
Pass := ''; //Character Pass
Pin := ''; //Pin for bank
Active := True;

end;

end;

function GetCustomXP(skill: variant): integer;
var
b: TBox;
p: TPoint;
tpa: TPointArray;
begin
result := -1;
if (not gameTab(TAB_STATS)) then
exit;
p := skillToCoords(skill);
if (p.x < 1) then
exit;
mmouse(p.x, p.y + 5, 12, 4);
Wait(150);
if (WaitFindColors(tpa, 921102, MIX1, MIY1, MIX2, MIY2, 0, 3000)) then
begin
b := getTPABounds(tpa);
Result := strToIntDef(getNumbers(getTextAt(b.x1 + 15, b.y1 + 15, 0, 1, 4, 4305653, 0, 75, smallChars)), -1);
end;
end;


function WalkToBank: Boolean;
begin
WalkBank := [Point(4224, 2633),Point(4208, 2649),Point(4210, 2667)]
SPS_WalkPath(WalkBank)
end;

function WalkToMen: Boolean;
begin
WalkMen := [Point(4208, 2649),Point(4232, 2608)]
SPS_WalkPath(WalkMen)
end;



procedure CheckRandoms;
begin
if not(LoggedIn) then
begin
WriteLn('I think we failed a random - I will just Check');
LoginPlayer;
FindNormalRandoms;
if not(LoggedIn) then
begin
WriteLn('Client has Logged Out So Probably Failed a Random - Terminating Script');
TerminateScript;
end ;
end;
if (FindBitMap(LevelPopUp,x,y)) then
begin
FreeBitmap(LevelPopUp);
FindBitMap(NoThanks,xx,yy)
Mouse(xx,yy,3,3,true);
FreeBitmap(NoThanks);
end;
FindNormalRandoms;

end;


procedure Attack;
var Xi, Yi:integer;
begin
if InFight then
begin
repeat
FindNormalRandoms;
until (not (OthersInFight) or (not LoggedIn) or (not InFight))
end;
x := Random(8)
case x of
4: WalkToMen; //Failsafe if we get lured
end;
if FindObjCustom(Xi, Yi, ['ttack'], ManColours, Tolerance) then
begin
if not (IsFightAt(Xi, Yi) and not InFight) then
begin
GetMousePos(Xi, Yi);
Mouse(Xi, Yi, RandomRange(0,5), RandomRange(0,5), false);
WaitOptionMulti(['ttack M', 'attack Man'], 200);
end;
while IsMoving do
begin
Wait(250);
end;
end;
SetAngle(True);
end;


procedure AntiBan;
begin
x := Random(500)
case x of
0: HoverSkill('Attack', False);
1: HoverSkill('Strength', False);
2: HoverSkill('Defence', False);
3: HoverSkill('hitpoints', False);
12..15: PickUpMouse;
16..25: RandomMovement;
26..27: RandomRClick;
28..32: BoredHuman;
33: ExamineInv;
34: RandomAngle(True);
end;
end;
function DoBanking: Boolean;
var
FailSafe: Integer;
begin
if not (LoggedIn) then
Exit;
while (IsMoving) do
begin
Wait(RandomRange(900, 1200));
end;
FailSafe := 0;
repeat
Inc(FailSafe);
MakeCompass('w');
Wait(RandomRange(400, 1200));
OpenBankNPC;
until BankScreen or PinScreen or (FailSafe = 7);
if PinScreen then
begin
repeat
InPin(Players[0].Pin);
until BankScreen or not (LoggedIn);
end;
if BankScreen then
begin
Withdraw(0,0,RandomRange(17,28));
CloseBank;
WalkToMen;
end;
if (FailSafe = 7) then
begin
Writeln('We failed to find the bank 7 times. Terminating script.');
TerminateScript;
end;
end;

procedure Report;
begin
CurrentAttack := GetCustomXP(0);
CurrentStrength := GetCustomXP(2);
CurrentDefence := GetCustomXP(1)
CurrentHitpoints := GetCustomXP(3);
Writeln('||=====');
Writeln('||===== Attack EXP Gained : ' + IntToStr(CurrentAttack - StartAttack));
Writeln('||===== Strength EXP Gained : ' + IntToStr(CurrentStrength - StartStrength));
Writeln('||===== Defence EXP Gained : ' + IntToStr(CurrentDefence - StartDefence));
Writeln('||===== Hitpoints EXP Gained : ' + IntToStr(CurrentHitpoints - StartHitpoints));
Writeln('||=====');
exit;
end;


procedure HpCheck; //Credits to Narcle
var
c, T, i, x, y:Integer;
begin
if (HPPercent < RandomRange(45,65)) and LoggedIn then
begin
if not InvEmpty then
for c := 0 to 2 do
for i := 1 to 28 do
if ExistsItem(i) then
begin
MMouseItem(i);
GetMousePos(x, y);
if WaitUptext('Eat', 400) then
begin
Mouse(x,y,0,0,false);
if WaitOption('Eat', 400) then
begin
t := GetSystemTime;
while ExistsItem(i) and ((GetSystemTime-t) < 2000) do
wait(20);
end;
Exit;
end;
end;
if InvEmpty then
begin
WalkToBank;
If IsMoving then
repeat
Wait(500);
until not (IsMoving);
Report;
DoBanking;
WalkToMen;
Exit;
end;
end;
end;

procedure VersionCheck();
var
oVersion : string;
begin
oVersion := GetPage('http://web.aanet.com.au/SRLJustin/EdgevilleManKiller/edgeman_version.txt');
if(oVersion <> Version)then
begin
WriteLn('The version you''re using is outdated!');
WriteLn('Downloading new version...');
if(WriteFileString(RewriteFile(ScriptPath + 'EdgeManKiller ~Justin.simba', True), GetPage('http://web.aanet.com.au/SRLJustin/EdgevilleManKiller/edgeman_script.txt')))then
WriteLn('Successfully downloaded the script! Please close the script and re-open to see the changes, thank you!');
TerminateScript;
end
else
WriteLn('You have the current version, good to go!');
end;

begin
Cleardebug;
Writeln('Please wait while I check your script version...');
VersionCheck();
ManColours := [1977911,3099988,1781298,3556934,3033449,3100779,5277332,7774421,1518669,2696227,4279104];
Smart_Server := 97;
Smart_Members := False;
Smart_Signed := False;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;
LoginPlayer;
SPS_Areas := ['10_6'];
SPS_Setup(RUNESCAPE_SURFACE, SPS_Areas);
Writeln('Welcome to ~Justin''s Edgeville Man Killer! Verson: '+ Version);
Wait(800);
Writeln('Grabbing starting EXP...');
MouseSpeed := RandomRange(17,22);
StartAttack := GetCustomXP(0); //atk
StartStrength := GetCustomXP(2); //str
StartDefence := GetCustomXP(1) //def
StartHitpoints := GetCustomXP(3); //hp
Writeln('Grabbed and saved starting EXP!');
WalkToMen;
LevelPopUp := BitmapFromString(22, 42, 'meJytlVFIU2EUx0lpU+emu3fmYE' +
'7nNpzioIjZMiaYOlOn2Z2WuhRdZelSclpiI600ycKKsgyiguohCnz' +
'0ITJ86alegwp6Dnrtrbf+957xeXfvnQsM/hzOPff8f/d83+79Vmh1'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hV/2L' +
'/i6BeRfzqMvQX5OsJfg==');

NoThanks := BitmapFromString(75, 14, 'meJztks1qAkEQhN8hBy9CEJSAIu' +
'IhSH4ugiB4UBD0oMccPOUNfDUfJve8REYGyqJ6undXEBECH8t0b1V' +
'Nz+5svo+bW/Kx2t83Z7E/MCknIR3RxLA+rU8/v00TiplX58y2XyDn' +
'5CjuoKxE9E3tNWMb8bncAT4gd7gEbJQECLi0rmIfRu7bMeIQ5m2+B' +
'sjJT+5gDXLT2lnAgeIqpnn6q0dK9CdTIAfkjv0X0BQT2M5Gdtk0T2' +
'8Xshd2jAkC7WzxAWuW3kG8eby3wem6o3cAC69lC6v0EuJSble8C/9' +
'Zu13xFXjuvwIE8lq2tkovISi9C1+pt5tKgsyTaL+MAWRcxiOxnRPy' +
'q2JgnQMGehHE85zpDcFFRiU6cqkgE4qfxebHV1T01sj3Np6n1RkwS' +
'SYld/iLidFz2cBiWqVejPXneWr3/nlo/gDohg86');
repeat
Attack;
AntiBan;
HpCheck;
CheckRandoms;
until(false)
end.


From: YoHoJo
http://villavu.com/forum/showthread.php?t=70152&highlight=Warning!+passed+wrong+finder+function

Answer there. Bascailly it's something up with FindObj, and it's not even really a problem unless it makes your mouse act odd.

Also in your Mouse, why RandomRange(0,5) you can just put 5…?


Had a look at that post, didn't seem to solve my issue.

Okay i'll make that change

YoHoJo

2011-12-26 19:22:35

Loike I said, it happens, but what exactly is the problem (besides the error coming up)?
Does the mouse move oddly or anything? If not, then it's fine! Roit?

Justin

2011-12-26 19:24:53

From: YoHoJo
Loike I said, it happens, but what exactly is the problem (besides the error coming up)?
Does the mouse move oddly or anything? If not, then it's fine! Roit?


Nothing odd happens, It is just annoying and it doesn't look good in a released script when users are posting about the error.
The mouse moves to the top left of the screen, that is about it

YoHoJo

2011-12-26 19:26:55

Oh that's lame.

CurY := Round((ys + ye) div 2) - Step;
   1: CurX := CurX + Step;
2: CurY := CurY - Step;
3: CurX := CurX - Step;
4: CurY := CurY + Step;

Those exists in FindObjEx. (Used by all/most other FindObj Functions).

Sometimes the '- step' must make the X or Y negative, which makes the error pop up.
Is my guess.
Not much you can do, except maybe someone should tweak function to ignore those values and continue on.

Justin

2011-12-26 19:29:01

From: YoHoJo
Oh that's lame.

CurY := Round((ys + ye) div 2) - Step;
   1: CurX := CurX + Step;
2: CurY := CurY - Step;
3: CurX := CurX - Step;
4: CurY := CurY + Step;

Those exists in FindObjEx. (Used by all/most other FindObj Functions).

Sometimes the '- step' must make the X or Y negative, which makes the error pop up.
Is my guess.
Not much you can do, except maybe someone should tweak function to ignore those values and continue on.


Humm ok, is there anyway I am able to set a switch to turn off/ignore warnings?

Shuttleu

2011-12-26 19:30:49

nope, but as YoHoJo said, someone could edit the function to stop it from coming up though

~shut

Jhangir

2011-12-26 19:36:32

yeah i really hate that I get it all the time. It messes up the debug box and it looks unprofessional.

danny2010

2011-12-26 19:38:50

I had the same problem with FindDTM i fixed it using GetClientDimensions(W, H);


FindDTM(TheDTM, X, Y, 0, 0, W-1, H-1));

Hope it helps

Justin

2011-12-26 19:50:24

From: danny2010
I had the same problem with FindDTM i fixed it using GetClientDimensions(W, H);


FindDTM(TheDTM, X, Y, 0, 0, W-1, H-1));

Hope it helps


That seemed to fix the issue, thanks danny2010!

Edit: Nope, Didn't fix it. happened when it was unable to find the colors on the screen I believe

Kyle Undefined

2011-12-26 21:54:29


b := getTPABounds(tpa);
Result := strToIntDef(getNumbers(getTextAt(b.x1 + 15, b.y1 + 15, 0, 1, 4, 4305653, 0, 75, smallChars)), -1);

Are you sure this is working correctly?