Slight hickup and fix. If you die while trying to go through gate, which is pretty much only time you will die. It just sits there waiting for the distance to change. I added in a check for HP
Code: Select all
function gate()
repeat
player:update()
dist = distance(player.X, player.Z, 4081, 3335)
keyboardHold( settings.hotkeys.MOVE_FORWARD.key );
yrest(700)
keyboardRelease(settings.hotkeys.MOVE_FORWARD.key);
until 100 > dist or 10 > player.HP
printf("Distance checked and continuing.\n")
currentshells = inventory:getItemCount(240181)
end
--=== note the currentshells aswell ===--
So bot should now realise the character is dead as it won't be stuck in loop anymore. Reason I did this is because I use a specific profile for CoT and it has code in ondeath event.
Code: Select all
RoMScript("BrithRevive();");
waitForLoadingScreen()
local filename = getExecutionPath() .. "/logs/shells.log";
local file, err = io.open(filename, "a+");
if file then
file:write(" Character name: " ..player.Name.. " \tDate: " .. os.date() .. " \tShells gained: "..currentshells - numshells..
"\tTotal shells: "..currentshells.. "\n")
file:close();
end
sendMacro("}LoginNextToon=true;a={")
sendMacro("Logout();");
waitForLoadingScreen();
loadPaths("cot_tele");
I also changed the log file, just for me so it will work with the on death event to still record number of shells.
and for log file part I did this to use currentshells
Code: Select all
if file then
file:write(" Character name: " ..player.Name.. " \tDate: " .. os.date() .. " \tShells gained: "..currentshells - numshells..
"\tTotal shells: "..currentshells.. "\n")
file:close();
end
So basically even if I die I log shells and also log into next character and keep doing cot.