From: The Mayor
Debugging is getting added to the include officially, just waiting on elfyyy to accept it
https://villavu.com/forum/showthread.php?t=112455&p=1336252#post1336252
Looks awesome :)
Anyways, I wrote a simple tin miner script and am having a few problems would anyone be able to to possibly point out what is going wrong?
Problems
1. When dropping it will drop an ore, than re-click the spot where it previously dropped the ore. I can't quite figure out why it does this. When adding a wait(500) time to drop, it made it so it will only have that problem every 5 or so ores it drops. However without a wait timer or a faster time it will do it almost every other time it drops. Am I doing something wrong with the dropping system?
2. When mining, it will click the ore after you finish mining it, I tried adding a wait timer, and looking for what would cause this problem I cannot find it :(.
I posted the entire script, since I'm not too sure what could be causing either problem. Hopefully someone can point out a simple fix. Also, if I am coding anything a weird way/incorrect please point it out, I'm not use to object oriented languages, I have only coded oop ones in the past.
[PHP]program tinMiner;
{$DEFINE SMART}
{$i AeroLib/AeroLib.Simba}
{$i Reflection/Reflection.Simba}
// Variables
var
ReflectPlayer : TReflectLocalPlayer;
Ore : TReflectObject;
tinOreID : integer;
tinRockID : integer;
// Got this setup format from a forum post
// Information about player/account
procedure declarePlayer();
begin
Me.Name := '';
Me.Pass := '';
Me.Pin := '';
Me.Nick := '';
Me.LampSkill := SKILL_MINING;
Me.Member := True;
Me.Active := True;
end;
// check if player is in mining animation
function checkIfMining : boolean;
begin
if (reflectplayer.GetAnimation = 626) then begin
// return result := true if doing animation
result := true;
end else begin
// return result := false if not doing animation
result := false;
end;
end;
// check if players inventory is full
function checkInventorySpace : boolean;
begin
// if it is result := true which will commence dropping
if (Reflect.Inv.IsFull) then begin
result := true;
end else begin
// if it is not result := false which will continue mining
result := false;
end;
end;
// Checks to make sure the bot has not wandered off etc, will log out as fail safe if true
// Will add this later
function checkPlayerLocation : boolean;
begin
end;
procedure clickOre(oreLocation : TPoint);
begin
reflect.Mouse.Move(oreLocation, 5, 5);
wait (100);
reflect.Mouse.Click(1);
end;
procedure dropOres();
var
tin : tstringarray;
begin
tin := ['Tin ore'];
// Drop ores
while (Reflect.Inv.Contains(tin) = true) do begin
reflect.Inv.Drop(438);
wait(500);
writeln('Dropping tin ores');
end;
end;
// Find the ore
procedure findOre();
var
oreLocation : TPoint;
begin
while (Me.Active = true) do begin
if (Ore.Find(objGame, 14863, 20)) then begin
oreLocation := ore.GetMSPoint;
// ore is found do the following
// Check if user is already mining/in animation
if (checkIfMining = false) then begin
if (checkInventorySpace = false) then begin
// contiune mining
clickOre(oreLocation);
wait(1000);
end else begin
// start dropping ores
dropOres();
end;
end;
end else begin
// Do a few things in-case there are not ores to mine
// Check player location, to see if rocks are just spawning
// If player is not in the correct location end the script
writeln('Cannot find the ore');
Me.Active := false;
end;
end;
end;
// Setup
begin
initAL;
Reflect.Setup;
declarePlayer();
LoginPlayer(False);
ReflectPlayer.Create;
Reflect.Login.LoginPlayer(Me.Name, Me.Pass);
findOre();
end. [/PHP]