cbrems
2015-02-07 18:32:29
Finally got tired of waiting for someone to do this, so I gave it a whirl. Great idea for use in conjunction with Mayor's west bank miner and ironmen. :)
Okay boys, attached below in Simba code will be my artisan smelter script.
All I was able to do is thanks to @The Mayor and his excellent beginner guide :)
The script is very sketchy in my opinion, and would probably be considered shotty work, I'm looking for ideas to improve it majorly before releasing it outside of this forum.
Current issues I'm aware of:
-Is 100% dependent on Tboxes/mouse boxes. Meaning if somehow I get off the path the script will fail.
-There is a lack of failsafe -Added in ability to close script if it fails a certain number of times to perform an action.
-No DTM for anvil due to lack of ability to distinguish color in this area … I'd really love to fix this if you have any ideas.
-Not able to relog after 6. I purposefully didn't put code in it because the script needs to be started with an empty inventory, odds are it wont be empty upon relog.
-Lag would potentially very easily break the script due to using wait functions to move on to the next steps.
-Camera angle needs to remain at the setting the script sets at default. –Adjust on start to ensure it can find bar colors
-Progress Report to be included eventually
Obviously this needs quite a lot of love, I'd be more than happy to give anyone credit who is able to help. :) The script will follow the main loop, I've tested multiple inventories with it.
-I'd really like for you guys to be able to give it a shot if you wish. Currently to start the script you can be either logged in or out, but your inventory needs to be completely empty, ore needs to be predeposited in the smelter and you must stand on the south side of the deposit chute, directly on the west side of the anvil. Check production screen to be on (it uses it for the wait procedure). It is set up only for Iron Ingot i, I have no intentions of making it capable of more at this point in time.
Let me know what you all think. :)
edit: fixing simba code
edit: don't believe antiban code is working. I will leave it in for now, but I don't think the "randomCameraAngle" movement is good to have because it may break the script.
Okay boys, attached below in Simba code will be my artisan smelter script.
All I was able to do is thanks to @The Mayor and his excellent beginner guide :)
The script is very sketchy in my opinion, and would probably be considered shotty work, I'm looking for ideas to improve it majorly before releasing it outside of this forum.
Current issues I'm aware of:
-No DTM for anvil due to lack of ability to distinguish color in this area … I'd really love to fix this if you have any ideas.
Obviously this needs quite a lot of love, I'd be more than happy to give anyone credit who is able to help. :) The script will follow the main loop, I've tested multiple inventories with it.
program ArtisanSmelter;
{$DEFINE SMART} // Always have this to load smart
{$I SRL-6/SRL.simba} // To load the SRL include files
procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := 'Username';
password := 'password';
isActive := true;
isMember := true;
world := -0; //Leave at -0 for random world.
end
currentPlayer := 0;
end;
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~//
////////////////////////////////////////////////////////////////////////////////
///////////////////Everything below here is Script Settings!////////////////////
///////////////////Only Edit if you know what you're doing!!////////////////////
////////////////////////////////////////////////////////////////////////////////
// //
////Credit to "The Mayor" and for his work in providing a great tutorial!!!!////
// //
// //
// Contributers: meep152 for removal of tboxes / adding in color recognition //
// Contributers: MasterXehanort - will use his script for future DTM addition//
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~//
var
loadsDone: integer; XP, XPH, startingExperience: extended;
timer: TTimeMarker;
procedure withdrawIngots();
var
x, y, i: integer;
count: integer;
begin
count = 0;
if not isLoggedIn() then
exit;
writeLn ('Finding "Withdraw-Ingots" Option')
repeat
mainscreen.findObject(x, y, 8162405, 11, colorSetting(2, 0.04, 0.23),mainscreen.playerPoint,20,30,7,['ithdraw-ingots'], MOUSE_LEFT); //Find purple-ish bar to click on to pull up production screen
wait(randomRange(1300, 2000));
inc(count);
if(count > 10) then
TerminateScript(); //If script fails to find withdraw option 10 times, it will terminate
until productionScreen.isOpen;
if productionScreen.isOpen then
productionScreen.clickStart();
end;
procedure findAnvil();
var
x, y, i: integer;
count: integer;
begin
count = 0;
if not isLoggedIn() then
exit;
writeLn ('Searching for Anvil')
repeat
mainscreen.findObject(x, y, 4742750, 10, colorSetting(2, 0.39, 0.09),mainscreen.playerPoint,20,30,7,['nvil'], MOUSE_LEFT); //looks for white outline on the western edge of North Anvil
wait(randomRange(3000, 4000));
inc(count);
if(count > 10) then
TerminateScript(); //If script fails to find an anvil 10 times, it will terminate
until productionScreen.isOpen;
if productionScreen.isOpen then
begin
repeat
productionScreen.clickStart();
wait(randomRange(3000, 4000));
until not (productionScreen.isOpen);
end;
end;
procedure waitToSmith();
begin
writeLn('Waiting for progress screen to close!');
repeat
wait(7000);
until (not progressScreen.isOpen()); //Repeats 7 second wait until progress screen closes
end;
procedure depositArmour();
var
x, y : integer;
count: integer;
begin
count = 0;
repeat
mainscreen.findObject(x, y, 1118482, 2, colorSetting(0, 0, 0), mainscreen.playerPoint, 25, 15, 30, ['eposit-armour'], MOUSE_LEFT);
wait(randomRange(2000,3000));
until tabBackpack.count() < 10;
inc(LoadsDone);
inc(count);
if(count > 10) then
TerminateScript(); //Terminates script if fail to find deposit chute 10 times
end;
//Ashaman Progress Report - modified from Taric's Cosher Script
procedure progressReport();
var
ingotsSmithed, xp, XPH: integer;
begin
ClearDebug;
ingotsSmithed := (LoadsDone * 28);
XP := (ChatBox.getXPBar - Round(StartingExperience));
XPH := Round(XP * (3600.0 / (GetTimeRunning / 1000.0)));
writeLn('=-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-=');
writeLn('==== Artisan Smelter Conglomeration ');
writeLn('=== Time Ran: ' + timeRunning );
writeLn('== Ingots Smithed: ' + intToStr(ingotsSmithed));
writeLn('== Loads Done: ' + intToStr(loadsDone));
writeLn('=== Smithing Experience Gained: ' + intToStr(xp));
writeLn('==== Smithing Experience Per Hour: ' + intToStr(XPH));
writeLn('=-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-=');
end;
begin //main loop
clearDebug(); // Clear the debug box
smartEnableDrawing := true; // So we can draw on SMART
setupSRL(); // Load the SRL include files
declarePlayers(); // Set up your username/pass
repeat
if not isLoggedIn() then // If player isn't logged in then
begin
players[currentPlayer].login(); // Log them in
exitTreasure(); // Exit treasure hunter
minimap.setAngle(MM_DIRECTION_NORTH); // Make compass north and angle high
mainScreen.setAngle(MS_ANGLE_HIGH);
end;
withdrawIngots();
findAnvil();
waitToSmith();
depositArmour();
progressReport();
until(false);
end
-I'd really like for you guys to be able to give it a shot if you wish. Currently to start the script you can be either logged in or out, but your inventory needs to be completely empty, ore needs to be predeposited in the smelter and you must stand on the south side of the deposit chute, directly on the west side of the anvil. Check production screen to be on (it uses it for the wait procedure). It is set up only for Iron Ingot i, I have no intentions of making it capable of more at this point in time.
Let me know what you all think. :)
edit: fixing simba code
edit: don't believe antiban code is working. I will leave it in for now, but I don't think the "randomCameraAngle" movement is good to have because it may break the script.