Scripting Resources & Utilities > Stealth Client
Pascal problem with procedures
(1/1)
blackbeard:
I made a easyuo mining macro and i'm trying to convert the code i made in easyuo to pascal for stealth. But i dont know how to simulate the subs of easyuo in pascal. i'm trying to use procedures, but i'm getting error of unknown identifier on line 94, it is commented.
--- Code: ---program Mining;
const
pickaxe1 = $0E85;
pickaxe2 = $0E86;
runebook =$22C5;
runebook_color =$0461;
runa_casa = 9;
limiteinativo = 1000;
var
cntalvo, cntinativo, contadorrunas : integer;
procedure save();
begin
end;
procedure guardar();
begin
end;
procedure recall(runa : integer) ;
begin
findtypeex(runebook, runebook_color,backpack,false);
useobject(finditem);
waitgump(inttostr(runa));
wait(300)
numgumpbutton(getgumpscount()-1,runa+100);
wait(9000);
end;
procedure verifica_marreta();
begin
FindType (pickaxe2 , Backpack);
UseObject(FindItem);
UseObject(FindItem);
end;
procedure verifica_peso();
begin
if weight > maxweight - 2 then
begin
recall(runa_casa);
guardar();
end;
end;
procedure detecta();
begin
end;
procedure hiding();
begin
end;
procedure inicio();
begin
verifica_peso();
recall(contadorrunas);
end;
procedure mining();
begin
verifica_peso();
save();
hiding();
verifica_marreta();
useobject(finditem);
alvo(); // getting error: Unknown Identifier
jornal();
end;
procedure jornal();
begin
end;
procedure alvo();
begin
if targetpresent then
begin
if cntalvo = 1 then targettotile(0,getx(self)-1,gety(self),getz(self));
end;
end;
procedure inativo();
begin
cntinativo := cntinativo + 1;
if cntinativo > limiteinativo then
begin
cntinativo := 1;
inicio();
end;
end;
procedure andar();
var
i, x, randomx, randomx2, y, randomy, randomy2 : integer;
tileinfo : tstaticcell;
begin
randomx := random(10);
randomx2 := random(10);
randomy := random(10);
randomy2 := random(10);
x := getx(self) + randomx - randomx2;
y := gety(self) + randomy - randomy2;
tileinfo := ReadStaticsXY(x, y, WorldNum);
if tileinfo.staticcount > 0 then
begin
//addtosystemjournal('length'+inttostr(length(tileinfo.statics)));
for i := Low(TileInfo.Statics)to high(TileInfo.Statics) do
begin
if (TileInfo.Statics[i].Tile >= 1339) and (TileInfo.Statics[i].Tile <= 1359) and (TileInfo.Statics[i].z = GetZ(self)) then
begin
newmovexy(x,y,true,0,false);
end
else
begin
inativo();
andar();
end;
end;
end
else
begin
inativo();
andar();
end;
end;
begin
contadorrunas := 1;
cntalvo := 1;
recall(contadorrunas);
andar();
mining();
end.
--- End code ---
What is wrong, in procedure mining, i'm getting an error, unknown identifier when try to call andar() procedure.
What i'm doing wrong?
Post Merge: September 21, 2015, 11:49:54 AMSry, i found the solution.
camotbik:
You are calling alvo, before its defined. Check the fixed code.
--- Code: ---program Mining;
const
pickaxe1 = $0E85;
pickaxe2 = $0E86;
runebook =$22C5;
runebook_color =$0461;
runa_casa = 9;
limiteinativo = 1000;
var
cntalvo, cntinativo, contadorrunas : integer;
procedure save();
begin
end;
procedure guardar();
begin
end;
procedure recall(runa : integer) ;
begin
findtypeex(runebook, runebook_color,backpack,false);
useobject(finditem);
waitgump(inttostr(runa));
wait(300)
numgumpbutton(getgumpscount()-1,runa+100);
wait(9000);
end;
procedure verifica_marreta();
begin
FindType (pickaxe2 , Backpack);
UseObject(FindItem);
UseObject(FindItem);
end;
procedure verifica_peso();
begin
if weight > maxweight - 2 then
begin
recall(runa_casa);
guardar();
end;
end;
procedure detecta();
begin
end;
procedure hiding();
begin
end;
procedure inicio();
begin
verifica_peso();
recall(contadorrunas);
end;
procedure alvo();
begin
if targetpresent then
begin
if cntalvo = 1 then targettotile(0,getx(self)-1,gety(self),getz(self));
end;
end;
procedure inativo();
begin
cntinativo := cntinativo + 1;
if cntinativo > limiteinativo then
begin
cntinativo := 1;
inicio();
end;
end;
procedure andar();
var
i, x, randomx, randomx2, y, randomy, randomy2 : integer;
tileinfo : tstaticcell;
begin
randomx := random(10);
randomx2 := random(10);
randomy := random(10);
randomy2 := random(10);
x := getx(self) + randomx - randomx2;
y := gety(self) + randomy - randomy2;
tileinfo := ReadStaticsXY(x, y, WorldNum);
if tileinfo.staticcount > 0 then
begin
//addtosystemjournal('length'+inttostr(length(tileinfo.statics)));
for i := Low(TileInfo.Statics)to high(TileInfo.Statics) do
begin
if (TileInfo.Statics[i].Tile >= 1339) and (TileInfo.Statics[i].Tile <= 1359) and (TileInfo.Statics[i].z = GetZ(self)) then
begin
newmovexy(x,y,true,0,false);
end
else
begin
inativo();
andar();
end;
end;
end
else
begin
inativo();
andar();
end;
end;
procedure jornal();
begin
end;
procedure mining();
begin
verifica_peso();
save();
hiding();
verifica_marreta();
useobject(finditem);
alvo(); // getting error: Unknown Identifier
jornal();
end;
begin
contadorrunas := 1;
cntalvo := 1;
recall(contadorrunas);
andar();
mining();
end.
--- End code ---
Navigation
[0] Message Index
Go to full version