Posts: 22
Threads: 5
Joined: Jul 2022
Reputation:
0
As the topic says, i havent tried this out yet but if i have understood you can either have "cap check" that if cap lower go deposit to depot and "supplies check" go refill at depot. My question is there a way to combine these 2 scripts that every time you go back to deposit your looted items the bot also makes a check for supplies and refill all in one?
Posts: 2,812
Threads: 453
Joined: Jul 2018
Reputation:
78
09-11-2022, 01:34 PM
(This post was last modified: 09-11-2022, 01:35 PM by Arkilys.)
Hello.
Combining two scripts is possible, but it can be complicated because you have to transfer variables, etc. as well as having to move the code to the exact moment when the second script should be executed.
But you don't need to combine it in a single script, just use the depositer code in an Action wpt and then create another Action waypoint to perform the verification and refill. So you just need to develop your code to only refill if under the conditions you like.
Posts: 22
Threads: 5
Joined: Jul 2022
Reputation:
0
Okay thanks!
But im having trouble to know how to put out the actions in right order this is an example on how i have done so far but not rly working as i hoped
1.stand (label) exp
2. stand
3. stand
4. stand
5. action (cap check go to deposit)
On my way to depot and once im there, is there action and direction to where locker is?
6. stand (moving 2-3 sqm from depot and make a supply check)
7. back to depot and refill then head back to label exp.
Is this the right way to do it or am i all out in the blue?
Posts: 2,812
Threads: 453
Joined: Jul 2018
Reputation:
78
There's no right way, you can accomplish that in many different ways. That depends only on you and what you wanna accomplish.
reachgrounditem('locker') it will TRY to reach an available locker.
openitem('locker') will open locker.
So using like:
reachgrounditem('locker')
wait(500, 800)
openitem('locker')
wait(800, 1200)
if windowcount('locker') > 0 then
-- do something on locker.
end
You can create two actions in a row:
1st Action to reach and open locker then deposit.
2nd Action to check for supplies and refill.
Posts: 22
Threads: 5
Joined: Jul 2022
Reputation:
0
09-11-2022, 07:57 PM
(This post was last modified: 09-12-2022, 07:41 PM by ormkaka.)
Depositer works, but still the refilling part is jamming for me. I want the bot to refill up so i got 100 uhs when heading back but it only refills another stack of 100.
This is what kind of actions i've made and im constantly changing them to work but only refilling 100 uhs is working and nothing else.
SUPPLY_NAME = 'ultimate healing rune'
SUPPLY_BP = 'Blue backpack'
SUPPLY_MIN = 100
---
CAP_MIN = 100
if cap() < CAP_MIN or itemcount(SUPPLY_NAME, SUPPLY_BP) < 100 then
gotolabel('refill')
return
end
---
local RUNE_ID = 3160
--character
CHARACTER_RUNES_BP=2869
--depot
DEPOT_RUNES_MAIN='camouflage backpack'
reachgrounditem('locker')
wait(500)
openitem('locker')
wait(1000)
openitem(DEPOT_RUNES_MAIN, 'locker')
wait(200,400)
openitem(DEPOT_RUNES_BP, DEPOT_RUNES_MAIN)
wait(200,400)
while itemcount(RUNE_ID, CHARACTER_RUNES_BP) < 100 do
if itemcount(RUNE_ID) > 1 then
moveitems(RUNE_ID, CHARACTER_RUNES_BP, DEPOT_RUNES_BP)
wait(500, 800)
local characterRunesBp = getcontainer(CHARACTER_RUNES_BP)
if characterRunesBp.open and characterRunesBp.usedslots == 20 then
openitem(CHARACTER_RUNES_BP, CHARACTER_RUNES_BP)
wait(500, 800)
end
else
higherwindow(DEPOT_RUNES_BP)
wait(800, 1200)
moveitems(DEPOT_RUNES_BP, ground(posx(), posy(), posz()), DEPOT_RUNES_MAIN, 1)
wait(800, 1200)
openitem(DEPOT_RUNES_BP, DEPOT_RUNES_MAIN)
wait(800, 1200)
end
end
Posts: 2,812
Threads: 453
Joined: Jul 2018
Reputation:
78
09-12-2022, 08:16 PM
(This post was last modified: 09-12-2022, 08:17 PM by Arkilys.)
Hello.
I believe you should fix:
1. "if itemcount(RUNE_ID) > 1 then" with "if itemcount(RUNE_ID, DEPOT_RUNES_BP) > 1 then", because you just wanna check for rune count on DEPOT_RUNES_BP instead of all open containers.
if itemcount(RUNE_ID) > 1 then
with
if itemcount(RUNE_ID, DEPOT_RUNES_BP) > 1 then
2. "moveitems(RUNE_ID, CHARACTER_RUNES_BP, DEPOT_RUNES_BP)" using that way, it will pickup a stack, doesn't matter its count. So you must use the last parameter (count) to move the exactly you need (if less than 100).
Example: local moveCount = 100 - itemcount(RUNE_ID, CHARACTER_RUNES_BP)
if moveCount > 0 then
moveitems(RUNE_ID, CHARACTER_RUNES_BP, DEPOT_RUNES_BP, moveCount)
wait(500, 800)
end
Posts: 22
Threads: 5
Joined: Jul 2022
Reputation:
0
09-12-2022, 08:34 PM
(This post was last modified: 09-12-2022, 08:35 PM by ormkaka.)
|Only Registered members can see download links. | Click here to buy subscription or here to register.
Posts: 2,812
Threads: 453
Joined: Jul 2018
Reputation:
78
09-12-2022, 09:07 PM
(This post was last modified: 09-13-2022, 06:36 PM by Arkilys.)
Hello.
No problem mate, i'm glad to help you because you are actually trying to do it yourself. |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="Smile" title="Smile" class="smilie smilie_1" />
btw.. I could not find the variable "DEPOT_RUNES_BP", so i've created it below "DEPOT_RUNES_MAIN".
--rune
local RUNE_ID = 3160
local MAX_RUNES_COUNT = 100 -- Max. amount to carry on your character
--character
CHARACTER_RUNES_BP = 2869
--depot
DEPOT_RUNES_MAIN = 'camouflage backpack'
DEPOT_RUNES_BP = 'blue backpack'
reachgrounditem('locker')
wait(500)
openitem('locker')
wait(800, 1200)
openitem(DEPOT_RUNES_MAIN, 'locker')
wait(800, 1200)
local flag = false
if itemcount(DEPOT_RUNES_BP, DEPOT_RUNES_MAIN) > 0 then
flag = true
openitem(DEPOT_RUNES_BP, DEPOT_RUNES_MAIN)
wait(800, 1200)
local remainingCount = MAX_RUNES_COUNT - itemcount(RUNE_ID, CHARACTER_RUNES_BP)
while remainingCount > 0 do
if itemcount(RUNE_ID, DEPOT_RUNES_BP) >= 1 then
moveitems(RUNE_ID, CHARACTER_RUNES_BP, DEPOT_RUNES_BP, remainingCount)
wait(500, 800)
remainingCount = MAX_RUNES_COUNT - itemcount(RUNE_ID, CHARACTER_RUNES_BP)
else
higherwindow(DEPOT_RUNES_BP)
wait(800, 1200)
moveitems(DEPOT_RUNES_BP, ground(posx(), posy(), posz()), DEPOT_RUNES_MAIN, 1)
wait(800, 1200)
if itemcount(DEPOT_RUNES_BP, DEPOT_RUNES_MAIN) > 0 then
openitem(DEPOT_RUNES_BP, DEPOT_RUNES_MAIN)
wait(800, 1200)
else
flag = false
break
end
end
end
end
if flag == false then
printerror('Could not find more rune bps (DEPOT_RUNES_BP) on DEPOT_RUNES_MAIN.')
playsound('default')
flashclient()
setsettings('Cavebot/Enabled', false)
end
Posts: 22
Threads: 5
Joined: Jul 2022
Reputation:
0
09-13-2022, 05:45 PM
(This post was last modified: 09-13-2022, 06:27 PM by ormkaka.)
I've tried a few times and changed few stuff in the script (wich didnt work ofc) but once its open my bp with supplies it plays a window sound and this comes up in the console "19:43:25 - Could not find more rune bps (DEPOT_RUNES_BP) on DEPOT_RUNES_MAIN."
I have also tried to put few scripts in different order and in "Node but same result to see if that was the problem but same reseult
Is it based on oldschool backpacks and not stacked runes like i got becouse i've even tried to remove the part "_BP" to see if the outcome would be any different but sadly not
Posts: 2,812
Threads: 453
Joined: Jul 2018
Reputation:
78
09-13-2022, 06:38 PM
(This post was last modified: 09-13-2022, 06:38 PM by Arkilys.)
Hello.
I'm not sure what you mean, bot works fine with stackable items... Error is saying that Bot could not find "DEPOT_RUNES_BP" on "DEPOT_RUNES_MAIN".
The way i've posted it:
DEPOT_RUNES_MAIN = 'camouflage backpack'
DEPOT_RUNES_BP = 'blue backpack'
That means Bot could not find a blue backpack on a camouflage backpack.
|