So I'm having an issue with CoordsToItem in my alching script, I keep getting an error saying that the co-ordinates are out of bounds
Progress Report:
** Warning in InvBox: Incorrect index: 0 **
Warning! You passed a wrong xs to a finder function: -1. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong ys to a finder function: -1. That is below 0, thus out of bounds. Setting the value to 0 for now.
This is the procedure I am trying to use it in
Simba Code:
procedure ClickItem;
var
x,y,T: Integer;
begin
Status('ClickItem');
if not LoggedIn then
NextPlayer(False);
if GameTab(Tab_Inv) then
begin
if ExistsItem(CoordsToItem(x,y)) then
begin
ClickMouse2(mouse_Left);
Inc(Alch);
WriteLn('Successfully clicked the item');
MarkTime(T);
repeat
Wait(RandomRange(20,40));
if FindDTM(Alchemy,x,y,MIX1,MIY1,MIX2,MIY2) or LvlInc then
Break;
until(TimeFromMark(T) > 8000);
end else
begin
WriteLn('Item not found @ClickItem');
NextPlayer(False);
end;
end else
WriteLn('Not in inventory @ClickItem');
end;
Currently running Simba 991 and SMART v7.2
So I developed a procedure to have a look at the InvBoxes, it seems that the SMART_DrawBoxEx function is drawing a square immediately above the correct invslot, but InvMouse is working appropriately.
But CoordsToItem is returning 0 for every mouse position in the inventory.
Try running this script and you will see what I mean.
Simba Code:
program P1ngScript;
{$DEFINE SMART}
{$i SRL/SRL.Simba}
{$i SRL/SRL/Misc/SmartGraphics.Simba}
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := ''; // Username
Pass := ''; // Password
Active := True;
end;
end;
procedure SetupLogin;
begin
ClearDebug;
{$IFDEF SMART}
SRL_SixHourFix := True;
Smart_FixSpeed := True;
{$ENDIF}
SetupSRL;
DeclarePlayers;
ActivateClient;
if not LoggedIn then
LoginPlayer;
end;
procedure DrawTheBox;
var
x,y,i: Integer;
Color: Array of Integer;
begin
Color := [clWhite, clRed, clAqua, clYellow, clWhite, clRed, clAqua, clYellow, clWhite, clRed, clAqua, clYellow, clWhite, clRed, clAqua, clYellow, clWhite, clRed, clAqua, clYellow, clWhite, clRed, clAqua, clYellow, clWhite, clRed, clAqua, clYellow];
SMART_ClearCanvas;
for i := 0 to 27 do
begin
SMART_DrawBoxEx(False, False, InvBox(i + 1), Color[i]);
InvMouse(i + 1,mouse_Move);
Wait(RandomRange(800,1200));
WriteLn(CoordsToItem(x,y));
end;
end;
begin
SetupLogin;
DrawTheBox;
end.