Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

[Pomoc]Xenobot LUA .


slawek112

Rekomendowane odpowiedzi

Opublikowano

Witam,

Mógłby ktoś poprawić żeby nie zapierdzielał po każdej kolejne do depo mimo że ma capa i poty? i przy okazji podać poradnik do tworzenia skryptów ? :)


------------------------------------------------------
---------INFORMATION---------
-- BP SETUP
-- [BP 1] -- Main
-- [BP 2] -- Loot
-- [BP 3] -- Gold

--DP SETUP
-- [BP 1] -- Stackables
------------------------------------------------------
---------SETTINGS---------
-- BP ID
local goldBP = 8860                     -- ID of your Gold BP

-- Cap
local minCap = 30                         --Cap to leave spawn

-- MP
local manasToLeave = 40                 --Manas to leave spawn
local wantedMPS = 100                     --Wanted amount of manapotions
local manaPotID = 268                     --Manapotion ID
local manaCost = 50                     --Manapotion price

-- HP
local wantedHPS = 30                    --Wanted amount of strong health potions
local hPotID = 266                         --Healthpotion ID
local hPotCost = 45                     --Healthpotion price

-- Other
local safeCheckID = 5880                 -- Set an item which is looted regurlary. The script will, after depositting, check for this item to ensure it has depositted -- and if not it will try depositting again.

------------------------------------------------------
displayInformationMessage("Carlin: Dwarfs \n -- Brought to you by TibiaNeant.com -- \n\n\n\n(Remember to post your feedback in my thread!)")
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(labelName)
   if (labelName == "checker") then
        if (Self.Cap() < minCap) or ((Self.ItemCount(manaPotID) < manasToLeave)) then
            gotoLabel("leaveSpawn")
        else
            gotoLabel("keepHunting")
        end        
        
    elseif (labelName == "skip") then
    gotoLabel("checker")    
        
    elseif (labelName == "posCheck1") then
        if (Self.Position().x == 32798 and Self.Position().y == 32155 and Self.Position().z == 8) then
               gotoLabel("AfterPosCheck1")
        else
            gotoLabel("checkShovel1")
            end

    elseif (labelName == "floor1") then
        if not (floor1) then
            gotoLabel("contFloor1")
            end

    elseif (labelName == "checkShovel2") then
    delayWalker(4000)
    sleep(math.random(1000, 2000))    
    local item = Map.GetTopUseItem(32489, 31965, 7)
        if (item.id == 593) then  
        gotoLabel("shovel2")
    else
        gotoLabel("cont2")
        end

    elseif (labelName == "shovel2") then
    delayWalker(4000)
    setWalkerEnabled(false)
    Self.UseItemWithGround(shovelID, 32489, 31965, 7)
    sleep(math.random(500, 1000))
    local item = Map.GetTopUseItem(32489, 31965, 7)
        if (item.id == 593) then  
        gotoLabel("checkShovel2")
    else
        gotoLabel("cont2")
        setWalkerEnabled(true)
        end
            
    elseif (labelName == "checkShovel1") then
    delayWalker(4000)
    sleep(math.random(1000, 2000))    
    local item = Map.GetTopUseItem(32466, 31874, 7)
        if (item.id == 593) then  
        gotoLabel("shovel1")
    else
        gotoLabel("cont1")
        end

    elseif (labelName == "shovel1") then
    delayWalker(4000)
    setWalkerEnabled(false)
    Self.UseItemWithGround(shovelID, 32466, 31874, 7)
    sleep(math.random(500, 1000))
    local item = Map.GetTopUseItem(32466, 31874, 7)
        if (item.id == 593) then  
        gotoLabel("checkShovel1")
    else
        gotoLabel("cont1")
        setWalkerEnabled(true)
        end
        
    elseif (labelName == "cut1") then
    setWalkerEnabled(false)
    Self.UseItemWithGround(macheteID, 32855, 32109, 7)
    sleep(math.random(1100, 3000))
    setWalkerEnabled(true)

    elseif (labelName == "looterOff1") then
        setLooterEnabled(false)

    elseif (labelName == "looterOn1") then
        setLooterEnabled(true)

    elseif (labelName == "backpackReset") then        
    delayWalker(2000)
    setWalkerEnabled(false)
    Container.Close(goldBP)    
    sleep(math.random(500, 1000))
    Container.GetFirst():OpenChildren(goldBP)    
    sleep(math.random(500, 1000))
    setWalkerEnabled(true)

    elseif (labelName == "bank") then
        setWalkerEnabled(false)
        delayWalker(5000)
        Self.Say("hi")
        sleep(math.random(700, 1400))
        Self.SayToNpc("deposit all")
        sleep(math.random(300, 1000))
        Self.SayToNpc("yes")
        sleep(math.random(300, 1000))
    Self.WithdrawMoney((manaCost*(wantedMPS-Self.ItemCount(manaPotID)))+200)
        sleep(math.random(300, 1000))
    Self.SayToNpc("yes")
        sleep(math.random(300, 1000))
    Self.WithdrawMoney((hPotCost*(wantedHPS-Self.ItemCount(hPotID))))
         sleep(math.random(700, 1400)) --f
    Self.SayToNpc("yes")
        sleep(math.random(300, 1000))
    Self.SayToNpc("balance")
        setWalkerEnabled(true)
    elseif (labelName == "reachDepot") then        
        Self.ReachDepot()

    elseif (labelName == "deposit") then
        Self.DepositItems(
        {11485, 0},
        {5897, 0},
        {9692, 0},
        {5880, 0},
        {5896, 0},
        {5902, 0},
        {7401, 0}
        )
        sleep(math.random(500, 1000))                      
        
    elseif (labelName == "buyManas") then
        local healthCount = (wantedHPS-Self.ItemCount(hPotID))
        setWalkerEnabled(false)
        delayWalker(7000)
        Self.Say("hi")
        sleep(math.random(500, 1000))
        Self.SayToNpc("vials")
        sleep(math.random(500, 1000))
        Self.SayToNpc("yes")
        sleep(math.random(500, 1000))
        Self.SayToNpc("yes")
        sleep(math.random(500, 1000))
        Self.SayToNpc("yes")
        sleep(math.random(500, 1000))
        Self.SayToNpc("yes")
        sleep(math.random(500, 1000))
        Self.SayToNpc("trade")
        sleep(math.random(500, 1000))
        buyManas(manaPotID, (wantedMPS-Self.ItemCount(manaPotID)))
        sleep(math.random(500, 1000))
            while (Self.ItemCount(hPotID) < wantedHPS) do
            Self.ShopBuyItem(hPotID, healthCount)
            sleep(math.random(500, 1000))
        end
        Self.SayToNpc("bye")
        setWalkerEnabled(true)
    
    elseif (labelName == "checkManas2") then
            if (Self.ItemCount(manaPotID) < wantedMPS) then
                gotoLabel("goBank")
            else
                gotoLabel("goHunt")
            end
        
    elseif (labelName == "checkDepo") then
        if (Self.ItemCount(safeCheckID) > 1) then
            gotoLabel("goDeposit")
            end

     elseif (labelName == "gate2")then
        Self.UseItemFromGround(32729, 31199, 5)    
        end
    end

function buyManas(item, count)
    count = tonumber(count) or 1
    repeat
        local amnt = math.min(count, 100)
        if(Self.ShopBuyItem(item, amnt) == 0)then
            return printf("ERROR", tostring(item))
        end
        wait(200,500)
        count = (count - amnt)
    until count <= 0
end

Self.ReachDepot = function (tries)
    local tries = tries or 3
    setWalkerEnabled(false)
    local DepotIDs = {3497, 3498, 3499, 3500}
    local DepotPos = {}
    for i = 1, #DepotIDs do
        local dps = Map.GetUseItems(DepotIDs[i])
        for j = 1, #dps do
            table.insert(DepotPos, dps[j])
        end
    end
    local function gotoDepot()
        local pos = Self.Position()
        print("Depots found: " .. tostring(#DepotPos))
        for i = 1, #DepotPos do
            location = DepotPos[i]
            Self.UseItemFromGround(location.x, location.y, location.z)
            wait(1000, 2000)
            if Self.DistanceFromPosition(pos.x, pos.y, pos.z) >= 1 then
                wait(5000, 6000)
                if Self.DistanceFromPosition(location.x, location.y, location.z) == 1 then
                    setWalkerEnabled(true)
                    return true
                end
            else
                print("Something is blocking the path. Trying next depot.")
            end
        end
        return false
    end
    
    repeat
        reachedDP = gotoDepot()
        if reachedDP then
            return true
        end
        tries = tries - 1
        sleep(100)
        print("Attempt to reach depot was unsuccessfull. " .. tries .. " tries left.")
    until tries <= 0

    return false
end

Map.GetUseItems = function (id)
    if type(id) == "string" then
        id = Item.GetID(id)
    end
    local pos = Self.Position()
    local store = {}
    for x = -7, 7 do
        for y = -5, 5 do
            if Map.GetTopUseItem(pos.x + x, pos.y + y, pos.z).id == id then
                itemPos = {x = pos.x + x, y = pos.y + y, z = pos.z}
                table.insert(store, itemPos)
            end
        end
    end
    return store
end

notoacta250.png


Opublikowano

Z tego co widzę wszystko ok

 

ile masz manasów i potów jak wychodzi bo pisze

 

local manasToLeave = 40

local minCap = 30

I hpków 30

Jak może byc ok jak nie dziala, jak masz cos pisac to pisz juz sensownie, a nie udajesz ze sie znasz

 

if (Self.Cap() < minCap) or ((Self.ItemCount(manaPotID) < manasToLeave))

 

 

Tu gdzie pogrubiłem wpisz id pota i powinno działać ;)

Znajdziesz to na samym poczatku kodu

Opublikowano

Dziękuje :)

 

Mimo, że kid koderatorka się pomyliła leci i tak like :).

 

Może ktoś podać poradnik do tworzenia skryptów do xenobota ? :)

Jestem ,,On'' ale wybaczam xD Poradników jako tako sam nigdy nie mogłem znaleźć dlatego najlepiej zrób tak jak ja Jeśli chodzi o Lua pobrałem gotowy z Forum i przerobiłem po prostu pod siebie a Wpt robiłem sabo to to łatwizna

xmMfHrm.png

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...