Log in

View Full Version : Result := True



Im New Sry
05-26-2012, 04:35 PM
So I'm using ACA to find colors and the same code as in this thread (http://villavu.com/forum/showthread.php?t=80378). But something fails.

My Function for Finding Furnace.
Function FindFurnace(var x,y:Integer):boolean;
var
a:Integer;
TPA:TPointArray;
ATPA:T2DPointArray;
MP:TPoint;
tmpCTS:Integer;
Box,SearchArea:TBox;
begin
if not LoggedIn then Exit;
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.15,1.38);
SearchArea := IntToBox((MSCX - 200),(MSCY - 100),(MSCX),(MSCY + 150));
SMART_DrawBoxEx(True,SearchArea,clPurple);
FindColorsSpiralTolerance(MSCX,MSCY,TPA,3158066,MS CX -200,MSCY - 100 ,MSCX,MSCY + 150,9);
SortTPAFrom(TPA,point(MSCX,MSCY));
ATPA := TPAtoATPAEx(TPA,15,15);
for a := 0 to High(ATPA) do
begin
MP := MiddleTPA(ATPA[a]);
Box := IntToBox((MP.x - 20),(MP.y - 20),(MP.x + 20),(MP.y + 20));
SMART_DrawBoxEx(True,Box,clYellow);
MMouse(MP.x,MP.y,4,4);
if(WaitUpText('rnace',1000))then
begin
x := MP.x; y := MP.y;
Result := True
SMART_ClearCanvas;
Exit;
end;
end;

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

[Error] C:\Simba\Scripts\ProgressINSCrafter.simba(165:19): Unknown identifier 'x' at line 164
Compiling failed.

That is at my procedure for crafting ammys
Procedure CraftDemAmmys;
var
TheRoad:TPointArray;
begin
SPS_Setup(RUNESCAPE_SURFACE,['12_9']);
TheRoad := [Point(111, 396), Point(139, 383), Point(148, 345), Point(134, 320)];
SPS_WalkPath(TheRoad);
InvMouse(1,1);
if (FindFurnace(x,y)), then
begin
If WaitColor(137, 228, 3358280, 0, 5000); then
Mouse(32490324, 329034, 5, 5, True);
end;

Error is

if (FindFurnace(x,y)), then

wat do?

bg5
05-26-2012, 04:43 PM
Delete comma

if (FindFurnace(x,y)), then
also you didn't declare x,y.

Add

var x,y : integer;

Main
05-26-2012, 04:48 PM
var
X, Y: Integer;
TheRoad:TPointArray;
begin
SPS_Setup(RUNESCAPE_SURFACE,['12_9']);
TheRoad := [Point(111, 396), Point(139, 383), Point(148, 345), Point(134, 320)];
SPS_WalkPath(TheRoad);
InvMouse(1,1);
if (FindFurnace(x,y)), then
begin
If WaitColor(137, 228, 3358280, 0, 5000); then
Mouse(32490324, 329034, 5, 5, True);
end;

Im New Sry
05-26-2012, 05:02 PM
Thank you very much guys.
Now, I'm running into another problem which involves Progress Report

Procedure ProgressReport;
var
XpH, AmmyCount, AmmysH:integer;
begin
XpH := round((Crafting_XP) / (GetTimeRunning / 360000.0));
AmmyCount := round((Crafting_XP) / (30));
AmmysH := round((AmmyCount) / (GetTimeRunning / 360000.0));
ClearDebug;
WriteLn('+-+-+-+-+-+-+ INS Crafter +-+-+-+-+-+-+');
WriteLn('Time Running' +TimeRunning);
WriteLn('XP Gained' +IntToStr(Crafting_XP));
WriteLn('XP Per Hour' +IntToStr(XpH));
WriteLn('Gold Ammys Crafted' +IntToStr(AmmyCount));
WriteLn('Gold Ammys/h' +IntToStr(AmmysH));
WriteLn('+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+');
end;

[Error] C:\Simba\Scripts\ProgressINSCrafter.simba(172:1): Identifier expected at line 171
Compiling failed.

That's
Procedure ProgressReport;

wat do now?

CephaXz
05-26-2012, 05:07 PM
Maybe you missed an end or begin before that procedure.

Im New Sry
05-26-2012, 05:13 PM
Maybe you missed an end or begin before that procedure.

This. Thank you mate.

Procedure MainLoop;
var
x,y:integer;
begin
FindingBank(x,y);
Repeat
WalkToFurnace;
WalkToBank;
CraftDemAmmys;
end.

[Error] C:\Simba\Scripts\ProgressINSCrafter.simba(199:1): Identifier expected at line 198
Compiling failed.

line 198
end.

masterBB
05-26-2012, 05:15 PM
Procedure MainLoop;
var
x,y:integer;
begin
FindingBank(x,y);
Repeat // every repeat needs an until
WalkToFurnace;
WalkToBank;
CraftDemAmmys;
until(false); //maybe until(InvFull) ?
end.

Im New Sry
05-26-2012, 05:20 PM
Procedure MainLoop;
var
x,y:integer;
begin
FindingBank(x,y);
Repeat // every repeat needs an until
WalkToFurnace;
WalkToBank;
CraftDemAmmys;
until(false); //maybe until(InvFull) ?
end.

Thank you, mate!

Now I get this

Procedure MainLoop;
var
x,y:integer;
begin
FindingBank(x,y);
Repeat
WalkToFurnace;
WalkToBank;
CraftDemAmmys;
until(AllPlayersInactive);
end.

[Error] C:\Simba\Scripts\ProgressINSCrafter.simba(200:4): Semicolon (';') expected at line 199
Compiling failed.

line 199
end.

CephaXz
05-26-2012, 05:21 PM
The end should not end with a fullstop (.), should be a semicolon ( ; )

You put all your mainloop into a procedure. So at the end of your script, you should have


begin
Mainloop;
end.

Which is not a procedure.

Im New Sry
05-26-2012, 05:22 PM
The end should not end with a fullstop (.), should be a semicolon ( ; )

I know, but if I do it with a semicolon and then put end with a fullstop after, it says

[Error] C:\Simba\Scripts\ProgressINSCrafter.simba(201:1): 'BEGIN' expected at line 200
Compiling failed.

:SSS

bg5
05-26-2012, 05:23 PM
Procedure MainLoop; // this is procedure named MainLoop
var
x,y:integer;
begin
FindingBank(x,y);
Repeat
WalkToFurnace;
WalkToBank;
CraftDemAmmys;
until(AllPlayersInactive)
end; // on the end of procedure is ;

begin // this is "real" mainloop
MainLoop;
end. // on the end you put dot

CephaXz
05-26-2012, 05:24 PM
Sorry, just edited, read the post I edited.

EDIT: Ninja-ed.

Im New Sry
05-26-2012, 05:30 PM
Procedure MainLoop; // this is procedure named MainLoop
var
x,y:integer;
begin
FindingBank(x,y);
Repeat
WalkToFurnace;
WalkToBank;
CraftDemAmmys;
until(AllPlayersInactive)
end; // on the end of procedure is ;

begin // this is "real" mainloop
MainLoop;
end. // on the end you put dot

Thank you !

Holy hell, this programming stuff isn't that easy.
Everything seems fine now, but when I ran, it said "Succesfully executed" and closed the same second.

Okay, re-ran it.

There are more errors going on, but I will try to figure them out myself. I think I should try to fix something itself instead asking you guys to do it.

CephaXz
05-26-2012, 05:31 PM
Should post the whole script here, easier for us to spot whats wrong :p

bg5
05-26-2012, 05:38 PM
Should post the whole script here, easier for us to spot whats wrong :p

This.


Everything seems fine now, but when I ran, it said "Succesfully executed" and closed the same second.

Whole Simba closed?

Propably u have SMART defined , but you didn't call (run) it.
procedure start;
begin
Smart_Server := 10;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
end;

Im New Sry
05-26-2012, 05:44 PM
program INSCrafter;
{$DEFINE SMART}
{$i SRL/srl.simba}
{$i sps/SPS.simba}
{$i srl/srl/misc/paintsmart.simba}

var
GoldBarDTM, GoldAmmyDTM, AmmyCraftDTM, Crafting_XP:integer;

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0; // if you want to use the details which you enter below.

Players[0].Name := ''; // your player's name
Players[0].Pass := ''; // your player's password
Players[0].Pin := ''; // your player's bank pin
Players[0].BoxRewards := ['amp', 'owledg'];
Players[0].Active := True; // set to false if you don't want to use player 0
Players[0].LampSkill := SKILL_CRAFTING; // edit to any skill you want
end;

Procedure Start;
begin
ClearDebug;
Smart_Server := 0;
Smart_Members := False
Smart_Signed := True
Smart_SuperDetail := False
SetupSRL;
DeclarePlayers;
LoginPlayer;
end;

Procedure LoadDTMs;
begin
GoldBarDTM := DTMFromString('mbQAAAHicY2VgYFBnYWDQBmIzINYAYnkgns PEwLAciGcD8WQgXgLE0R48QNVMDNdWyTEsbBBjsDXgYMAGGLFg MAAAJz4ICA==');
GoldAmmyDTM := DTMFromString('mbQAAAHicY2VgYAhiYWDwA+JwIA4DYl8gns XEwDAPiqcD8TQgrqwXZDh+VIYhMoKHITaGl2HmdFEGbIARCwYD AMdSCj8=');
AmmyCraftDTM := DTMFromString('mggAAAHicY2NgYOBgYWDgBWJuIGYBYmYgZg fiDUwMDGuBeCsQb4KyVwPx9oPSDAvmiTFsXC/B8Oq5AsODu/IMO7dLMeACjDgwBAAALYUOMQ==');
end;

Procedure FreeDaDTMs;
begin
FreeDTM(GoldBarDTM);
FreeDTM(GoldAmmyDTM);
FreeDTM(AmmyCraftDTM);
end;

Procedure WalkToBank;
var
myPath:TPointArray;
begin
SPS_Setup(RUNESCAPE_SURFACE,['12_9']);
myPath := [Point(132, 318), Point(159, 330), Point(141, 367), Point(114, 397)];
SPS_WalkPath(myPath);
repeat
wait(300);
until(Not IsMoving);
end;

Procedure WalkToFurnace;
var
myPath:TPointArray;
begin
SPS_Setup(RUNESCAPE_SURFACE,['12_9']);
myPath := [Point(111, 396), Point(139, 383), Point(148, 345), Point(134, 320)];
SPS_WalkPath(myPath);
repeat
wait(300);
until(Not IsMoving);
end;

Function FindingBank(var x,y:Integer):boolean;
var
a:Integer;
TPA:TPointArray;
ATPA:T2DPointArray;
MP:TPoint;
tmpCTS:Integer;
Box,SearchArea:TBox;
begin
if not LoggedIn then Exit;
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03,3.82);
SearchArea := IntToBox((MSCX - 200),(MSCY - 100),(MSCX),(MSCY + 150));
SMART_DrawBoxEx(True,SearchArea,clPurple);
FindColorsSpiralTolerance(MSCX,MSCY,TPA,10143726,M SCX -200,MSCY - 100 ,MSCX,MSCY + 150,9);
SortTPAFrom(TPA,point(MSCX,MSCY));
ATPA := TPAtoATPAEx(TPA,15,15);
for a := 0 to High(ATPA) do
begin
MP := MiddleTPA(ATPA[a]);
Box := IntToBox((MP.x - 20),(MP.y - 20),(MP.x + 20),(MP.y + 20));
SMART_DrawBoxEx(True,Box,clYellow);
MMouse(MP.x,MP.y,4,4);
if(WaitUpText('ooth',1000))then
begin
x := MP.x; y := MP.y;
Result := True
Mouse(x,y,1,1,1);
if(WaitFunc(@BankScreen,10,4000)) then
begin
DepositAll;
MouseBankSlot(1, mouse_Right);
WaitOption('ithdraw-All', 500)
SMART_ClearCanvas;
Exit;
end;
end;
end;

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

Function FindFurnace(var x,y:Integer):boolean;
var
a:Integer;
TPA:TPointArray;
ATPA:T2DPointArray;
MP:TPoint;
tmpCTS:Integer;
Box,SearchArea:TBox;
begin
if not LoggedIn then Exit;
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.15,1.38);
SearchArea := IntToBox((MSCX - 200),(MSCY - 100),(MSCX),(MSCY + 150));
SMART_DrawBoxEx(True,SearchArea,clPurple);
FindColorsSpiralTolerance(MSCX,MSCY,TPA,3158066,MS CX -200,MSCY - 100 ,MSCX,MSCY + 150,9);
SortTPAFrom(TPA,point(MSCX,MSCY));
ATPA := TPAtoATPAEx(TPA,15,15);
for a := 0 to High(ATPA) do
begin
MP := MiddleTPA(ATPA[a]);
Box := IntToBox((MP.x - 20),(MP.y - 20),(MP.x + 20),(MP.y + 20));
SMART_DrawBoxEx(True,Box,clYellow);
MMouse(MP.x,MP.y,4,4);
if(WaitUpText('rnace',1000))then
begin
x := MP.x; y := MP.y;
Result := True
SMART_ClearCanvas;
Exit;
end;
end;

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

Procedure CraftDemAmmys;
var
x,y:integer;
TheRoad:TPointArray;
begin
SPS_Setup(RUNESCAPE_SURFACE,['12_8','12_9','12_10']);
TheRoad := [Point(111, 396), Point(139, 383), Point(148, 345), Point(134, 320)];
SPS_WalkPath(TheRoad);
InvMouse(1,1);
if (FindFurnace(x,y)) then
begin
If WaitColor(137, 228, 3358280, 0, 5000) then
Mouse(32490324, 329034, 5, 5, True);
end;
end;

Procedure ProgressReport;
var
XpH, AmmyCount, AmmysH:integer;
begin
XpH := round((Crafting_XP) / (GetTimeRunning / 360000.0));
AmmyCount := round((Crafting_XP) / (30));
AmmysH := round((AmmyCount) / (GetTimeRunning / 360000.0));
ClearDebug;
WriteLn('+-+-+-+-+-+-+ INS Crafter +-+-+-+-+-+-+');
WriteLn('Time Running' +TimeRunning);
WriteLn('XP Gained' +IntToStr(Crafting_XP));
WriteLn('XP Per Hour' +IntToStr(XpH));
WriteLn('Gold Ammys Crafted' +IntToStr(AmmyCount));
WriteLn('Gold Ammys/h' +IntToStr(AmmysH));
WriteLn('+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+');
end;

Procedure MainLoop;
var
x,y:integer;
begin
FindingBank(x,y);
Repeat
WalkToFurnace;
WalkToBank;
CraftDemAmmys;
until(AllPlayersInactive);
end;
begin
MainLoop;
end.

Error: Exception: Access violation at line 101

function IsRealMouseInBox(B : TBox): Boolean;
var
P : TPoint;
begin
GetRealMousePos(P.X, P.Y);
Result := PointInBox(P, B);
end;

problem with end;

sorry for dumb questions, I'm really pretty new to all of this and I really want to start scripting.

CephaXz
05-26-2012, 05:50 PM
Procedure MainLoop;
var
x,y:integer;
begin
FindingBank(x,y);
Repeat
WalkToFurnace;
WalkToBank;
CraftDemAmmys;
ProgressReport; //Up to you where you want to put it, I put it here since you didnt include in your procedure
until(AllPlayersInactive);
end;

begin
Start;
LoadDTMs;
AddOnTerminate('FreeDaDTMs');
Mainloop;
end.


Not sure if there are anything else I missed. But for access violation 101 error, it always means you have problem with your java. Uninstall your java if you had java 7, and install java 6u32

Im New Sry
05-26-2012, 05:55 PM
It works!!! No freakin way! It launched... Holy hell... Thank you all very much! Although it will have so much bugs that... But anyway, thank you all, very much.

CephaXz
05-26-2012, 05:55 PM
Glad you had it working :D

Im New Sry
05-26-2012, 06:03 PM
Yeah, it just doesn't detect colors... Oh well, some more ACAing for me then! :)

Abu
05-26-2012, 06:41 PM
If you need more help you can check this link:
http://villavu.com/forum/showthread.php?t=82793

A lot of errors you came across are on that list :)