Posts: 85
Threads: 19
Joined: Nov 2020
Reputation:
0
Not sure how hard or easy it is (but i assume easy considering the bot already does it)
im chasing an action script that closes all backpacks then reopens main backpack and backpacks visible in main backpack.
Thaanks
Posts: 2,948
Threads: 492
Joined: Jul 2018
Reputation:
84
12-15-2020, 02:13 PM
(This post was last modified: 12-30-2020, 08:00 PM by Arkilys.)
Hello.
Reopening backpacks is easy, you only need to use two functions: closewindow() and openitem(), but that depends on your backpack organization.
closewindow(string windowname) [void]: Close a specific container window.
closewindows() [void]: Close all open containers windows.
openitem(string/number item, string location, bool newWindow, number Index) [void]: Open an item located inside your containers, inventory or ground, depends of your location choice.
|Only Registered members can see download links. | Click here to buy subscription or here to register.
Try this code:
closewindows()
wait(500, 800)
local bp_item = back()
if bp_item.id > 0 then
local WIN_COUNT = windowcount()
while WIN_COUNT == 0 and bp_item.id > 0 do
openitem(bp_item.id, 'back')
wait(1000, 1500)
bp_item = back()
WIN_COUNT = windowcount()
end
if WIN_COUNT > 0 then
resizewindows(1)
wait(200, 500)
local containers = getcontainers()
for _, cont in ipairs(containers) do
for __, item in ipairs(cont.items) do
if itemhasflags(item.id, 4) then
for i = 1, 3 do
if windowcount() == WIN_COUNT then
openitemslot(item.index, cont.index, true)
wait(500, 1000)
resizewindows(1)
resizewindows(1)
wait(200, 500)
else
break
end
end
WIN_COUNT = windowcount()
end
end
end
end
end
Posts: 85
Threads: 19
Joined: Nov 2020
Reputation:
0
12-30-2020, 03:02 AM
(This post was last modified: 12-30-2020, 03:02 AM by pillows.)
fyi, this backpack reopen function doesnt work as a persistant
14:00:26 - Core:Lua:ExecuteScript |Only Registered members can see download links. | Click here to buy subscription or here to register.|Only Registered members can see download links. | Click here to buy subscription or here to register.alt="Big Grin" title="Big Grin" class="smilie smilie_4" />oString:BP Open: 23: 'then' expected near 'do'
Posts: 2,948
Threads: 492
Joined: Jul 2018
Reputation:
84
Posts: 85
Threads: 19
Joined: Nov 2020
Reputation:
0
thanks, not sure what you fixed. it kept closing and opening backpacks and ignoring everything inside the backpack :S
Posts: 2,948
Threads: 492
Joined: Jul 2018
Reputation:
84
12-30-2020, 08:03 PM
(This post was last modified: 12-30-2020, 08:04 PM by Arkilys.)
Hello.
I just fixed a small type error and it works just fine.
Notice this script will close all your bps and then open main bp and all containers (parcels, bags, bps, etc.) inside the main bp.
So if you use it on Persistents, it will just keep closing and opening everything.
If you wanna use on Persistents to just reopen bps if all bps are closed then use this code.
if windowcount() == 0 then
local bp_item = back()
if bp_item.id > 0 then
local WIN_COUNT = windowcount()
while WIN_COUNT == 0 and bp_item.id > 0 do
openitem(bp_item.id, 'back')
wait(1000, 1500)
bp_item = back()
WIN_COUNT = windowcount()
end
if WIN_COUNT > 0 then
resizewindows(1)
wait(200, 500)
local containers = getcontainers()
for _, cont in ipairs(containers) do
for __, item in ipairs(cont.items) do
if itemhasflags(item.id, 4) then
for i = 1, 3 do
if windowcount() == WIN_COUNT then
openitemslot(item.index, cont.index, true)
wait(500, 1000)
resizewindows(1)
resizewindows(1)
wait(200, 500)
else
break
end
end
WIN_COUNT = windowcount()
end
end
end
end
end
end
Posts: 85
Threads: 19
Joined: Nov 2020
Reputation:
0
01-01-2021, 05:33 AM
(This post was last modified: 01-01-2021, 05:50 AM by pillows.)
Hey mate, thanks for all your help.
I have been playing with the BP reopen script but cant get the last piece of the puzzle working. Any chance you can give us some advice?
I have edited your above, to if bps less than 4 then disable cavebot, disable looting, open backpacks then enable cavebot and enable looting.
So far it does everything except re enable caveboot and looting.
EDIT: i figured out why the settings weren't getting re enabled and fixed that, Can you explain why it is re enabling them after opening 3 backpacks not 4? it makes the last backpack a bit confusing for the bot as its looting monsters at the same time.
Thanks
if windowcount() < 4 then
setsettings('Looter/Enabled', status == false)
setsettings('Cavebot/Enabled', status == false)
closewindows()
wait(500, 800)
local bp_item = back()
if bp_item.id > 0 then
local WIN_COUNT = windowcount()
while WIN_COUNT == 0 and bp_item.id > 0 do
openitem(bp_item.id, 'back')
wait(1000, 1500)
bp_item = back()
WIN_COUNT = windowcount()
end
if WIN_COUNT > 0 then
resizewindows(1)
wait(200, 500)
local containers = getcontainers()
for _, cont in ipairs(containers) do
for __, item in ipairs(cont.items) do
if itemhasflags(item.id, 4) then
for i = 1, 3 do
if windowcount() == WIN_COUNT then
openitemslot(item.index, cont.index, true)
wait(500, 1000)
resizewindows(1)
resizewindows(1)
wait(200, 500)
setsettings('Looter/Enabled', status == true)
setsettings('Cavebot/Enabled', status == true)
else
break
end
end
WIN_COUNT = windowcount()
end
end
end
end
end
end
Cancel that, i moved it further down the script and fixed the issue |Only Registered members can see download links. | Click here to buy subscription or here to register.|Only Registered members can see download links. | Click here to buy subscription or here to register.alt="Big Grin" title="Big Grin" class="smilie smilie_4" />
thanks
Posts: 2,948
Threads: 492
Joined: Jul 2018
Reputation:
84
Hello.
For further references, you are calling setsettings() using "status" variable, but it doesn't exists.
So this is your code fixed.
if windowcount() < 4 then
setsettings('Looter/Enabled', false)
setsettings('Cavebot/Enabled', false)
closewindows()
wait(500, 800)
local bp_item = back()
if bp_item.id > 0 then
local WIN_COUNT = windowcount()
while WIN_COUNT == 0 and bp_item.id > 0 do
openitem(bp_item.id, 'back')
wait(1000, 1500)
bp_item = back()
WIN_COUNT = windowcount()
end
if WIN_COUNT > 0 then
resizewindows(1)
wait(200, 500)
local containers = getcontainers()
for _, cont in ipairs(containers) do
for __, item in ipairs(cont.items) do
if itemhasflags(item.id, 4) then
for i = 1, 3 do
if windowcount() == WIN_COUNT then
openitemslot(item.index, cont.index, true)
wait(500, 1000)
resizewindows(1)
resizewindows(1)
wait(200, 500)
else
break
end
end
WIN_COUNT = windowcount()
end
end
end
setsettings('Looter/Enabled', true)
setsettings('Cavebot/Enabled', true)
end
end
end
Posts: 85
Threads: 19
Joined: Nov 2020
Reputation:
0
That’s how I fixed it not working, but it works with the turning it off.
Because I’m difficult, and I died, because the bot ran for too long and I ran out of supplies, I’m wondering how I would go about a check of my rune bp to check if their is either another bp or 5+ Runes. If no backpack or less than 5 runes go to wpt leave hunt.
I can do the rune bit easy enough, but adding the check just to my bp to check if there is another green bp is hard
Posts: 2,948
Threads: 492
Joined: Jul 2018
Reputation:
84
Hello.
I didn’t understood what you said. The code you posted doesn’t disables Targeting.
This script works almost as you need, excerpt it will open next bp and also will play sound instead leaving hunt.
|Only Registered members can see download links. | Click here to buy subscription or here to register.
|