Simba script help plz!
Code:
program ROTMGAutoGrabber;
Type
ROTMGItem = record
Autograb, Image, Tier : Integer;
Name: string;
end;
Type
ROTMGSlot = record
Image, Slot: Integer;
end;
Type
ROTMGItemList = record
List : Array[0..500] of ROTMGItem;
Length : Integer;
end;
Type
ROTMGSlotList = record
List : Array[0..7] of ROTMGSlot;
end;
var
ItemList : ROTMGItemList;
SlotList : ROTMGSlotList;
itemsGrabbed : Integer;
itemsMissed : Integer;
ii : Integer;
procedure LoadSlots;
var
i : integer;
begin
for i := 1 to 8 do
begin
SlotList.List[i-1].Slot := i;
SlotList.List[i-1].Image := LoadBitmap(IncludePath + 'ROTMG\Slots\' + 'slot' + inttostr(i) + '.png');
end;
end;
procedure EnableMasks(image : Integer);
var
a, b, w, h : Integer;
begin
GetBitmapSize(image, w, h);
for a := 0 to h-1 do
begin
if (a < 2) or (h - a - 1 < 2) then
begin
for b := 0 to w-1 do
begin
FastSetPixel(image,b,a, RGBtoColor(0,0,0));
end;
end else
begin
FastSetPixel(image,0,a,RGBtoColor(0,0,0));
FastSetPixel(image,1,a,RGBtoColor(0,0,0));
FastSetPixel(image,w-1,a,RGBtoColor(0,0,0));
FastSetPixel(image,w-2,a,RGBtoColor(0,0,0));
end;
end;
end;
function LoadItem(fileName : string) : boolean;
begin
line 65 -----> if Strtoint(ReadIni(fileName,'Autograb',IncludePath + 'ROTMG\Config.ini')) > 0 then
begin
ItemList.List[ItemList.Length].Image := LoadBitmap(IncludePath + 'ROTMG\Equipment\' + fileName);
ItemList.List[ItemList.Length].Name := Readini(fileName,'Name',IncludePath + 'ROTMG\Config.ini');
ItemList.List[ItemList.Length].Autograb := strtoint(Readini(fileName,'Autograb',IncludePath + 'ROTMG\Config.ini'));
ItemList.List[ItemList.Length].Tier := strtoint(Readini(fileName,'Tier',IncludePath + 'ROTMG\Config.ini'));
EnableMasks(ItemList.List[ItemList.Length].Image);
Writeln('Loaded item "' + ItemList.List[ItemList.Length].Name + '"');
result := true;
exit;
end;
result := false;
end;
function LoadItems() : Integer;
var
x, itemCount, loaded : Integer;
fileNames : TStringArray;
begin
fileNames:= GetFiles(IncludePath + 'ROTMG\Equipment\','png');
itemCount:= length(fileNames);
for x:= 0 to itemCount-1 do
begin
if LoadItem(fileNames[x]) then
begin
inc(loaded);
inc(ItemList.Length);
end;
end;
result := loaded;
end;
procedure GrabItem(item : ROTMGItem; x, y : Integer);
var
i,a,b,w,h,c,d,n,m : Integer;
begin
for i := 0 to 7 do
begin
if FindBitmapToleranceIn(SlotList.List[i].Image,a,b,610,400,785,495,25) then
begin
GetBitmapSize(SlotList.List[i].Image,c,d);
GetBitmapSize(item.Image,w,h);
GetMousePos(n,m);
MoveMouse(x + w / 2, y + h / 2);
HoldMouse(x + w / 2,y + h / 2,mouse_Left);
MoveMouse(a + c / 2,b + d / 2);
ReleaseMouse(a + c / 2,b + d / 2,mouse_left);
MoveMouse(n,m);
inc(itemsGrabbed);
Writeln('Items grabbed: (' + inttostr(itemsGrabbed) + ') Items Missed: (' + inttostr(itemsMissed) + ')');
Writeln('Grabbed item "' + item.Name + '"');
Wait(10);
exit;
end;
end;
inc(itemsMissed);
Writeln('Items grabbed: (' + inttostr(itemsGrabbed) + ') Items Missed: (' + inttostr(itemsMissed) + ')');
Writeln('Missed item "' + item.Name + '" (INVENTORY FULL)');
end;
procedure ScanItem (item : ROTMGItem);
var
x,y : integer;
begin
if FindBitmapToleranceIn(item.Image,x,y,610,500,785,595,25) then
begin
GrabItem(item,x,y);
end;
end;
procedure Initialize;
begin
ItemList.Length := 0;
itemsGrabbed := 0;
itemsMissed := 0;
Writeln('Initializing autograbber');
Writeln('Loading Items...');
Writeln('Loaded ' + inttostr(LoadItems()) + ' items');
Writeln('Loading slots...');
LoadSlots();
Writeln('Slots loaded');
Writeln('Entering main loop...');
end;
begin
Initialize();
while true do
begin
for ii := 0 to ItemList.Length do
begin
ScanItem(ItemList.List[ii]);
end;
end;
end.
Error: Exception: "" is an invalid integer at line 65
The following bitmaps were not freed: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70]
and
Code:
program AutoTele;
const c = 5526612;
var t: Boolean;
var TimesPlayed: Integer;
var x, y: Integer;
procedure CheckHealth;
begin
if (c = GetColor(x,y)) then
t := true;
end;
procedure TeleNexus;
begin
PressKey(116);
end;
procedure Runner;
begin
Writeln('Number of times run: ' + IntToStr(TimesPlayed) + '.');
while not(t) do
begin
CheckHealth;
end;
TeleNexus;
Writeln('You have been Teleported to safety. After healing up, press control!');
While (IsKeyDown(17) = false) do
wait(10);
t := false;
TimesPlayed := TimesPlayed + 1;
Runner;
end;
procedure GetCoords;
begin
Writeln('Please place your mouse on your health bar where you would like');
Writeln('your minimum health for AutoNexus to activate, then click Control!');
While (IsKeyDown(17) = false) do
begin
wait(10);
end;
getMousePos(x,y);
ClearDebug;
Writeln('Your Health Coordinates are at (' + IntToStr(x) + ', ' + IntToStr(y) + ')!');
end;
begin
if (IsTargetValid) then
begin
ClearDebug;
GetCoords;
sleep(1000);
TimesPlayed := 1;
t := false;
Writeln('Your auto Nexus is now running!');
sleep(1000);
Runner;
end;
Writeln('No window targetted');
end.
your minimum health for AutoNexus to activate, then click Control!
