Log in

View Full Version : Need help with bonfire script



akash22
06-28-2012, 06:58 AM
Hello people! I'm making a bonfire script and it can find the banker but i want it to open the bank also.Here is the function that ACA made for me.
function FindObject(var fx, fy: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.39, 0.14);

if not(FindColorsTolerance(arP, 4342341, MSX1, MSY1, MSX2, MSY2, 4)) then
begin
Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 4.12) and (X <= 6.83) and (Y >= 4.27) and (Y <= 7.12) and (Z >= 4.59) and (Z <= 7.51) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;

SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 10, 10);
arL := High(ararP);

for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if (IsUpText('Take')) then
begin;
Result := True;
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
begin
Writeln('FindObject could not find object.');
Exit;
end;

GetMousePos(fx, fy);
end;

How can i make it open the bank?

CephaXz
06-28-2012, 07:03 AM
I think there's a function called OpenBankNPC. It opens the bank by banker.

(s)okkr7
06-28-2012, 07:06 AM
You might try using a TPA instead.. Just my thoughts though.

akash22
06-28-2012, 07:10 AM
When you guys suggest me stuff could you please link me to a tut. IM A BIG NOOB and was a leecher

I found a way to open bank. Thanks for helping even tho i used something else!

YoHoJo
06-28-2012, 07:12 AM
Hey dude!
My name is also Aakash! < Spelled like that though!
Good luck!

akash22
06-28-2012, 07:16 AM
Yohojo im the guy who needed help with that range guilding script. after figuring it out i was inspired to make scripts!

__________________________________________________ ___________________________________________
Edit

I can now open my bank and i have my pin entered in Procedure declareplayer and i have a function called function OpenBankNPCEx :Boolean; and when it opens the bank, it gets stuck and won't enter the pin and it highlites the 59th line and says
Error: Out Of Range at line 59
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]

this is the code

program Bonfire;
{.include SRL\SRL.simba}
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Active := True;
Players[0].Member := True;
Players[0].Pin := '1999';
end;// declare players


function OpenBankNPCEx :Boolean;
var
NPCBox :TBox;
Colors, NPCArray :TPointArray;
ATPA: T2DPointArray;
MSNPC, NPCPoint :TPoint;
TempCTS, C, HiNPC, II, I :Integer;
begin
Result := False;
Result := (BankScreen) or (PinScreen);
If Result then Exit;

NPCArray := GetMinimapDots('NPC');
HiNPC := High(NPCArray);

If Length(NPCArray) = 0 then Exit;
SortTPAFrom(NPCArray, Point(MMCX, MMCY));
for I := 0 to HiNPC do
begin
NPCPoint := MMToMS(NPCArray[I])
If NPCPoint = Point(-1, -1) then Continue;
NPCBox := IntToBox(NPCPoint.X - 40, NPCPoint.Y - 40, NPCPoint.X + 40, NPCPoint.Y + 40)
If PixelShift(NPCBox, 200) > 500 then Continue;

TempCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.13, 1.52);
FindColorsTolerance(Colors, 6067652, NPCBox.X1, NPCBox.Y1, NPCBox.X2, NPCBox.Y2, 13);
ATPA := TPAToATPAEx(Colors, 15, 20);
SortATPASize(ATPA, True);

for II := 0 to High(ATPA) do
begin
MSNPC := MiddleTPA(ATPA[II]);
MMouse(MSNPC.X, MSNPC.Y, 3, 3);
If WaitUpTextMulti(['ooth', 'anker'], 200) then
begin
Mouse(MSNPC.X, MSNPC.Y, 1, 1, False);
If WaitOptionMulti(['ank B', 'quick'], 300) then
MarkTime(c);
Repeat
Wait(RandomRange(50, 100));
Until (BankScreen) or (PinScreen) or (TimeFromMark(C) > 4500);
if (Players[CurrentPlayer].Pin <> '') then // Here is the error!!!! am i suppose to fill the '' with the pin?
InPin(Players[CurrentPlayer].Pin);
Result := (BankScreen) or (PinScreen);
If Result then
begin
ColorToleranceSpeed(TempCTS);
Exit;
end
else
ColorToleranceSpeed(TempCTS);
end;
end;
end;
end;
begin
SetupSRL;
OpenBankNPCEx;
end.