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

Otwieranie drzwi XENOBOT


HUBETUS

Rekomendowane odpowiedzi

Opublikowano

Mam panowie taki problem, potrzebuje skryptu na otwieranie drzwi. Chodzi konkretnie o drzwi na darashi na dragi. Jak już ktoś wklei skrypt, to niech wytłumaczy jakoś, jak umieścić go w pliku .lua i w którym miejscu powinien być. 

 

---------------------------------
--------Twoj Waypoint------------
-------Created ----------
---------------------------------

----------- BP SETUP ------------
--~ [bP 1] ~-- Main
--~ [bP 2] ~-- Produkty
--~ [bP 3] ~-- Gold

----------- DP SETUP ------------
--~ [DP 1] ~-- Rare
--~ [DP 2] ~-- Produkty

------------ Settings -----------

-- Mana Potions --

local ManasToLeave = 15    -- Z iloma manasami wracać
local WantedManas = 150        -- Ile Manasow kupić
local ManaPotID = 268         -- Mana Potion ID
local ManaCost = 50         -- Mana Potion koszt

-- Health Potions --

local HealthToLeave = 0        -- Z iloma healtami wracać
local WantedHealth = 0        -- Ile Healtow Kupić
local HealthPotID = 0        -- Health Potion ID
local HealthCost = 0        -- Koszt HP Potka

-- Other Options --

local MainBP = 2867         -- ID plecaka glownego   (Czerwony)
local ItemBP = 5949         -- ID plecaka na itemy     (Pomaranczowy)
local GoldBP = 2871         -- ID plecaka na kase     (Camouflage)
local MinCap = 10             -- Od ilu Capa wracać
local HideEquipment = true     -- Zminimalizować EQ

-- Floor Settings --

local SecondFloor = true     -- Tego nie zmieniajcie


Targeting.Start()
Looter.Start()

--------------------------------------------------------------------
--------------------------------------------------------------------
--------------------------------------------------------------------
--------------------------------------------------------------------
--------------------------------------------------------------------

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

local info = [[]]
    wait(5000)
    
    print([[
    --<Waypoint 100% Afk>--]])
    wait(5000)
    
--------------------------------------------------------------------------------------

---------------------------------------------------
function onWalkerSelectLabel(labelName)

if (labelName == "Checker") then
        if (Self.ItemCount(ManaPotID) <= ManasToLeave) or (Self.ItemCount

(HealthPotID) <= HealthToLeave) or (Self.Cap() < MinCap) then
            gotoLabel("Leave")
        else
            gotoLabel("Start Hunt")
    end    

elseif (labelName == "TravelGo") then
        setWalkerEnabled(false)
            delayWalker(5000)
               Self.Say("hi")
            sleep(math.random(700, 1400))
            Self.SayToNpc("wyspa na ktora chcesz plynanc")  -- Tutaj wpisz wyspe

na ktora sie udajesz.
            sleep(math.random(300, 1000))
            Self.SayToNpc("yes")
        setWalkerEnabled(true)

elseif (labelName == "TravelBack") then
        setWalkerEnabled(false)
            delayWalker(5000)
            Self.Say("hi")
            sleep(math.random(700, 1400))
            Self.SayToNpc("Wyspa powrotna")                    --

Tutaj wpisz wyspe powrotna
            sleep(math.random(300, 1000))
            Self.SayToNpc("yes")
        setWalkerEnabled(true)

elseif (labelName == "Deposit") then
        setWalkerEnabled(false)
        Self.ReachDepot()
        Self.DepositItems({5877, 0}, {11457, 0}, {3071, 0}, {3297, 0})        

        -- Tutaj dodajesz ID itemkow ktore ma odkładać do Depo a po przecinku

backpack w kolejności od lewej strony 0 oznacza miejsce pierwsze a 1 miejsce 2, 2 to

miejsce trzecie i tak dalej
        Self.DepositItems({7430, 1}, {3416, 1}, {3061, 1}, {3322, 1})
                Self.DepositItems({3028, 2}, {3301, 2})            -- tutaj to

smao co wyżej bo jak jest za dużo itemek w jednej lini to się zawiesza
        wait(1500,1900)
            
elseif (labelName == "Cash") 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")
        setWalkerEnabled(true)
    
    elseif (labelName == "Withdraw") then
        setWalkerEnabled(false)
        delayWalker(5000)
        Self.SayToNpc("hi")
        sleep(math.random(700, 1400))
        Self.WithdrawMoney((ManaCost*(WantedManas-Self.ItemCount(ManaPotID))))
        sleep(math.random(700, 1400))
        Self.WithdrawMoney((HealthCost*(WantedHealth-Self.ItemCount

(HealthPotIDID))))
        sleep(math.random(700, 1400))
        Self.WithdrawMoney(100)
        sleep(math.random(700, 1400))
        Self.SayToNpc("yes")
        setWalkerEnabled(true)
        
    elseif (labelName == "Potions") then
        setWalkerEnabled(false)
        delayWalker(10000)
        Self.SayToNpc("hi")
        sleep(math.random(800, 1700))
        Self.SayToNpc({"Hi", "flasks", "yes", "yes", "yes", "Trade"}, 65)
        sleep(math.random(800, 1700))
        Self.SayToNpc("trade")
        sleep(math.random(2000, 2400))
            Self.ShopBuyItem(ManaPotID, (WantedManas-Self.ItemCount(ManaPotID)))
        sleep(math.random(2000, 2400))
            Self.ShopBuyItem(HealthPotID, (WantedHealth-Self.ItemCount

(HealthPotID)))
        sleep(math.random(800, 1700))
        setWalkerEnabled(true)

elseif (labelName == "FullCheck") then
        if (Self.ItemCount(ManaPotID) < WantedManas) or (Self.Cap() < MinCap)

or (Self.ItemCount(HealthPotID) < WantedHealth) then
            gotoLabel("PreDeposit")
        else
            gotoLabel("LetsHunt")
        end            

    elseif (labelName == "ResetBp") then
        Walker.Stop()

        Container.Close(ItemBP)    
        wait(1000)    
        Container.Close(GoldBP)
        wait(1000)
        Container.GetFirst():OpenChildren(ItemBP)
        wait(1000)
        Container.GetFirst():OpenChildren(GoldBP)
        wait(1000)        
        Container.GetByName(ItemBP):Minimize()
        wait(1000)
        Container.GetByName(GoldBP):Minimize()
        wait(200)
        if (HideEquipment) then
            Client.HideEquipment()
            wait(1000)
        end
        Walker.Start()    
    end
end


----------------------- Functions ----------------------
function SellItems(item) -- item = item ID
    wait(300, 1700)
    Self.ShopSellItem(item, Self.ShopGetItemSaleCount(item))
    wait(900, 1200)
end

function BuyItems(item, count) -- item = item id, count = how many you want to buy up

to
    wait(900, 1200)
    if (Self.ItemCount(item) < count) then
    Self.ShopBuyItem(item, (count-Self.ItemCount(item)))
    wait(200, 500)
    end
end

Self.ReachDepot = function (tries)
    local tries = tries or 3
    Walker.Stop()
    local DepotIDs = {3497, 3498, 3499, 3500}
    local DepotPos = {}
    for i = 1, #DepotIDs do
        local dps = Map.GetUseItems(DepotIDs)
        for j = 1, #dps do
            table.insert(DepotPos, dps[j])
        end
    end

    local function gotoDepot()
        local pos = Self.Position()
        print("Ilosc znalezionych Depo: " .. tostring(#DepotPos))
        for i = 1, #DepotPos do
            location = DepotPos
            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
                    Walker.Start()
                    return true
                end
            else
                print("To depo jest zajete, szukam dalej.")
            end
        end
        return false
    end
    
    repeat
        reachedDP = gotoDepot()
        if reachedDP then
            return true
        end
        tries = tries - 1
        sleep(100)
        print("Nie udalo sie dotrzec do depo... " .. tries .. " szukam

dalej.")
    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

Opublikowano
else if labelName == "doorN" then
Self.UseItemFromGround(location.x, location.y - 1, location.z)
else if labelName == "doorS" then
Self.UseItemFromGround(location.x, location.y + 1, location.z)
end

Doklej do na samym końcu callbacka i stwórz 2 labele pierwszy doorN kiedy drzwi masz north od siebie i drugi doorS kiedy drzwi masz south od siebie.

Efekty jednego dnia wolnego od pracy :

lWxix4K.png

Chcesz wspomóc produkcję tego bota? Masz doświadczenie w programowaniu modułów, tworzeniu GUI czy skryptowaniu [C#]?

napisz na pw : http://www.mpcforum.pl/user/1285262-bleblable/

Opublikowano

Takie coś mi wyskakuje

 

 

XenoScript Error:
           Script: DARA Drag.lua
           Line #: 1
           Chunk: C:?Users?NAZWA?DOCUME?1?XenoBot?Scripts??DARADR?1.LUA
           Error: unexpected symbol near 'ď'
This is an error with user-input and should not be reported as a bug with XenoBot

 

Tak wygląda mój skrypt:

 

---------------------------------
--------Twoj Waypoint------------
-------Created By NAZWA----------
---------------------------------

----------- BP SETUP ------------
--~ [bP 1] ~-- Main
--~ [bP 2] ~-- Produkty
--~ [bP 3] ~-- Gold

----------- DP SETUP ------------
--~ [DP 1] ~-- Rare
--~ [DP 2] ~-- Produkty

------------ Settings -----------

-- Mana Potions --

local ManasToLeave = 15    -- Z iloma manasami wracać
local WantedManas = 125        -- Ile Manasow kupić
local ManaPotID = 268         -- Mana Potion ID
local ManaCost = 50         -- Mana Potion koszt

-- Health Potions --

local HealthToLeave = 0        -- Z iloma healtami wracać
local WantedHealth = 0        -- Ile Healtow Kupić
local HealthPotID = 0        -- Health Potion ID
local HealthCost = 0        -- Koszt HP Potka

-- Other Options --

local MainBP = 2867         -- ID plecaka glownego   (Czerwony)
local ItemBP = 9602         -- ID plecaka na itemy     (Pomaranczowy)
local GoldBP = 2872         -- ID plecaka na kase     (Camouflage)
local MinCap = 50             -- Od ilu Capa wracać
local HideEquipment = true     -- Zminimalizować EQ

-- Floor Settings --

local SecondFloor = true     -- Tego nie zmieniajcie


Targeting.Start()
Looter.Start()

--------------------------------------------------------------------
--------------------------------------------------------------------
--------------------------------------------------------------------
--------------------------------------------------------------------
--------------------------------------------------------------------

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

local info = [[]]
    wait(5000)
    
    print([[
    --<Waypoint 100% Afk>--]])
    wait(5000)
    
-----------------------------------------------------------------------------------------------------------------------------------------
function onWalkerSelectLabel(labelName)

if (labelName == "Checker") then
        if (Self.ItemCount(ManaPotID) <= ManasToLeave) or (Self.ItemCount(HealthPotID) <= HealthToLeave) or (Self.Cap() < MinCap) then
            gotoLabel("Leave")
        else
            gotoLabel("Start Hunt")
    end    

elseif (labelName == "TravelGo") then
        setWalkerEnabled(false)
            delayWalker(5000)
               Self.Say("hi")
            sleep(math.random(700, 1400))
            Self.SayToNpc("wyspa na ktora chcesz plynanc")  -- Tutaj wpisz wyspe na ktora sie udajesz.
            sleep(math.random(300, 1000))
            Self.SayToNpc("yes")
        setWalkerEnabled(true)

elseif (labelName == "TravelBack") then
        setWalkerEnabled(false)
            delayWalker(5000)
            Self.Say("hi")
            sleep(math.random(700, 1400))
            Self.SayToNpc("Wyspa powrotna")                    -- Tutaj wpisz wyspe powrotna
            sleep(math.random(300, 1000))
            Self.SayToNpc("yes")
        setWalkerEnabled(true)

elseif (labelName == "Deposit") then
        setWalkerEnabled(false)
        Self.ReachDepot()
        Self.DepositItems({5877, 0}, {3301, 0}, {11457, 0}, {3297, 0})                -- Tutaj dodajesz ID itemkow ktore ma odkładać do Depo a po przecinku backpack w kolejności od lewej strony 0 oznacza miejsce pierwsze a 1 miejsce 2, 2 to miejsce trzecie i tak dalej
        Self.DepositItems({3071, 1}, {3416, 1}, {7430, 1}, {3322, 1}, {3028, 1})            -- tutaj to smao co wyżej bo jak jest za dużo itemek w jednej lini to się zawiesza
        wait(1500,1900)
            
elseif (labelName == "Cash") 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")
        setWalkerEnabled(true)
    
    elseif (labelName == "Withdraw") then
        setWalkerEnabled(false)
        delayWalker(5000)
        Self.SayToNpc("hi")
        sleep(math.random(700, 1400))
        Self.WithdrawMoney((ManaCost*(WantedManas-Self.ItemCount(ManaPotID))))
        sleep(math.random(700, 1400))
        Self.WithdrawMoney((HealthCost*(WantedHealth-Self.ItemCount(HealthPotIDID))))
        sleep(math.random(700, 1400))
        Self.WithdrawMoney(100)
        sleep(math.random(700, 1400))
        Self.SayToNpc("yes")
        setWalkerEnabled(true)
        
    elseif (labelName == "Potions") then
        setWalkerEnabled(false)
        delayWalker(10000)
        Self.SayToNpc("hi")
        sleep(math.random(800, 1700))
        Self.SayToNpc({"Hi", "flasks", "yes", "yes", "yes", "Trade"}, 65)
        sleep(math.random(800, 1700))
        Self.SayToNpc("trade")
        sleep(math.random(2000, 2400))
            Self.ShopBuyItem(ManaPotID, (WantedManas-Self.ItemCount(ManaPotID)))
        sleep(math.random(2000, 2400))
            Self.ShopBuyItem(HealthPotID, (WantedHealth-Self.ItemCount(HealthPotID)))
        sleep(math.random(800, 1700))
        setWalkerEnabled(true)

elseif (labelName == "FullCheck") then
        if (Self.ItemCount(ManaPotID) < WantedManas) or (Self.Cap() < MinCap) or (Self.ItemCount(HealthPotID) < WantedHealth) then
            gotoLabel("PreDeposit")
        else
            gotoLabel("LetsHunt")
        end            

    elseif (labelName == "ResetBp") then
        Walker.Stop()

        Container.Close(ItemBP)    
        wait(1000)    
        Container.Close(GoldBP)
        wait(1000)
        Container.GetFirst():OpenChildren(ItemBP)
        wait(1000)
        Container.GetFirst():OpenChildren(GoldBP)
        wait(1000)        
        Container.GetByName(ItemBP):Minimize()
        wait(1000)
        Container.GetByName(GoldBP):Minimize()
        wait(200)
        if (HideEquipment) then
            Client.HideEquipment()
            wait(1000)
        end
        Walker.Start()    
    end
end


----------------------- Functions ----------------------
function SellItems(item) -- item = item ID
    wait(300, 1700)
    Self.ShopSellItem(item, Self.ShopGetItemSaleCount(item))
    wait(900, 1200)
end

function BuyItems(item, count) -- item = item id, count = how many you want to buy up to
    wait(900, 1200)
    if (Self.ItemCount(item) < count) then
    Self.ShopBuyItem(item, (count-Self.ItemCount(item)))
    wait(200, 500)
    end
end

Self.ReachDepot = function (tries)
    local tries = tries or 3
    Walker.Stop()
    local DepotIDs = {3497, 3498, 3499, 3500}
    local DepotPos = {}
    for i = 1, #DepotIDs do
        local dps = Map.GetUseItems(DepotIDs)
        for j = 1, #dps do
            table.insert(DepotPos, dps[j])
        end
    end

    local function gotoDepot()
        local pos = Self.Position()
        print("Ilosc znalezionych Depo: " .. tostring(#DepotPos))
        for i = 1, #DepotPos do
            location = DepotPos
            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
                    Walker.Start()
                    return true
                end
            else
                print("To depo jest zajete, szukam dalej.")
            end
        end
        return false
    end
    
    repeat
        reachedDP = gotoDepot()
        if reachedDP then
            return true
        end
        tries = tries - 1
        sleep(100)
        print("Nie udalo sie dotrzec do depo... " .. tries .. " szukam dalej.")
    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)
    else if labelName == "doorN" then
    Self.UseItemFromGround(location.x, location.y - 1, location.z)
    else if labelName == "doorS" then
    Self.UseItemFromGround(location.x, location.y + 1, location.z)
    end
            end
        end
    end
    return store
end

 

 

Sprawdźcie, czy dobrze wkleiłem ten skrypt na otwieranie drzwi :).

Opublikowano

Na samym końcu callbacka a nie pliku ... http://pl.wikipedia.org/wiki/Callback_%28programowanie%29

Tak więc na chłopski rozum :

registerEventListener(EVENT_TYPE, CALLBACK)

Ten CALLBACK jest wywoływane kiedy EVENT_TYPE jest wysyłany więć później w kodzie masz :

function CALLBACK()
{ --początek bloku CALLBACK
    if costam == innecos then  --warunek1 

    elseif cosinnego == cosik then  --warunek2
    -------TU WKLEJASZ ...
    end  --koniec warunku
} --koniec bloku CALBACK

Efekty jednego dnia wolnego od pracy :

lWxix4K.png

Chcesz wspomóc produkcję tego bota? Masz doświadczenie w programowaniu modułów, tworzeniu GUI czy skryptowaniu [C#]?

napisz na pw : http://www.mpcforum.pl/user/1285262-bleblable/

Opublikowano

 

---------------------------------

--------Twoj Waypoint------------

-------Created By Sanix----------

---------------------------------

 

----------- BP SETUP ------------

--~ [bP 1] ~-- Main

--~ [bP 2] ~-- Produkty

--~ [bP 3] ~-- Gold

 

----------- DP SETUP ------------

--~ [DP 1] ~-- Rare

--~ [DP 2] ~-- Produkty

 

------------ Settings -----------

 

-- Mana Potions --

 

local ManasToLeave = 15     -- Z iloma manasami wracać

local WantedManas = 125        -- Ile Manasow kupić

local ManaPotID = 268         -- Mana Potion ID

local ManaCost = 50         -- Mana Potion koszt

 

-- Health Potions --

 

local HealthToLeave = 0        -- Z iloma healtami wracać

local WantedHealth = 0        -- Ile Healtow Kupić

local HealthPotID = 0        -- Health Potion ID

local HealthCost = 0        -- Koszt HP Potka

 

-- Other Options --

 

local MainBP = 2867         -- ID plecaka glownego   (Czerwony)

local ItemBP = 5949         -- ID plecaka na itemy     (Pomaranczowy)

local GoldBP = 2871         -- ID plecaka na kase     (Camouflage)

local MinCap = 20             -- Od ilu Capa wracać

local HideEquipment = true     -- Zminimalizować EQ

 

-- Floor Settings --

 

local SecondFloor = true     -- Tego nie zmieniajcie

 

 

Targeting.Start()

Looter.Start()

 

--------------------------------------------------------------------

--------------------------------------------------------------------

--------------------------------------------------------------------

--------------------------------------------------------------------

--------------------------------------------------------------------

 

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

 

local info = [[]]

    wait(5000)

    

    print([[

    --<Waypoint 100% Afk>--]])

    wait(5000)

    

-----------------------------------------------------------------------------------------------------------------------------------------

function onWalkerSelectLabel(labelName)

 

if (labelName == "Checker") then

        if (Self.ItemCount(ManaPotID) <= ManasToLeave) or (Self.ItemCount(HealthPotID) <= HealthToLeave) or (Self.Cap() < MinCap) then

            gotoLabel("Leave")

        else

            gotoLabel("Start Hunt")

    end    

 

elseif (labelName == "TravelGo") then

        setWalkerEnabled(false)

            delayWalker(5000)

               Self.Say("hi")

            sleep(math.random(700, 1400))

            Self.SayToNpc("wyspa na ktora chcesz plynanc")  -- Tutaj wpisz wyspe na ktora sie udajesz.

            sleep(math.random(300, 1000))

            Self.SayToNpc("yes")

        setWalkerEnabled(true)

 

elseif (labelName == "TravelBack") then

        setWalkerEnabled(false)

            delayWalker(5000)

            Self.Say("hi")

            sleep(math.random(700, 1400))

            Self.SayToNpc("Wyspa powrotna")                    -- Tutaj wpisz wyspe powrotna

            sleep(math.random(300, 1000))

            Self.SayToNpc("yes")

        setWalkerEnabled(true)

 

elseif (labelName == "Deposit") then

        setWalkerEnabled(false)

        Self.ReachDepot()

        Self.DepositItems({5877, 0}, {3301, 0}, {11457, 0}, {3297, 0})                -- Tutaj dodajesz ID itemkow ktore ma odkładać do Depo a po przecinku backpack w kolejności od lewej strony 0 oznacza miejsce pierwsze a 1 miejsce 2, 2 to miejsce trzecie i tak dalej

        Self.DepositItems({3071, 1}, {3416, 1}, {7430, 1}, {3322, 1}, {3028, 1})            -- tutaj to smao co wyżej bo jak jest za dużo itemek w jednej lini to się zawiesza

        wait(1500,1900)

            

elseif (labelName == "Cash") 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")

        setWalkerEnabled(true)

    

    elseif (labelName == "Withdraw") then

        setWalkerEnabled(false)

        delayWalker(5000)

        Self.SayToNpc("hi")

        sleep(math.random(700, 1400))

        Self.WithdrawMoney((ManaCost*(WantedManas-Self.ItemCount(ManaPotID))))

        sleep(math.random(700, 1400))

        Self.WithdrawMoney((HealthCost*(WantedHealth-Self.ItemCount(HealthPotIDID))))

        sleep(math.random(700, 1400))

        Self.WithdrawMoney(100)

        sleep(math.random(700, 1400))

        Self.SayToNpc("yes")

        setWalkerEnabled(true)

        

    elseif (labelName == "Potions") then

        setWalkerEnabled(false)

        delayWalker(10000)

        Self.SayToNpc("hi")

        sleep(math.random(800, 1700))

        Self.SayToNpc({"Hi", "flasks", "yes", "yes", "yes", "Trade"}, 65)

        sleep(math.random(800, 1700))

        Self.SayToNpc("trade")

        sleep(math.random(2000, 2400))

            Self.ShopBuyItem(ManaPotID, (WantedManas-Self.ItemCount(ManaPotID)))

        sleep(math.random(2000, 2400))

            Self.ShopBuyItem(HealthPotID, (WantedHealth-Self.ItemCount(HealthPotID)))

        sleep(math.random(800, 1700))

        setWalkerEnabled(true)

 

elseif (labelName == "FullCheck") then

        if (Self.ItemCount(ManaPotID) < WantedManas) or (Self.Cap() < MinCap) or (Self.ItemCount(HealthPotID) < WantedHealth) then

            gotoLabel("PreDeposit")

        else

            gotoLabel("LetsHunt")

        end            

 

    elseif (labelName == "ResetBp") then

        Walker.Stop()

 

        Container.Close(ItemBP)    

        wait(1000)    

        Container.Close(GoldBP)

        wait(1000)

        Container.GetFirst():OpenChildren(ItemBP)

        wait(1000)

        Container.GetFirst():OpenChildren(GoldBP)

        wait(1000)        

        Container.GetByName(ItemBP):Minimize()

        wait(1000)

        Container.GetByName(GoldBP):Minimize()

        wait(200)

        if (HideEquipment) then

            Client.HideEquipment()

            wait(1000)

        end

        Walker.Start()    

    end

end

 

 

----------------------- Functions ----------------------

function SellItems(item) -- item = item ID

    wait(300, 1700)

    Self.ShopSellItem(item, Self.ShopGetItemSaleCount(item))

    wait(900, 1200)

end

 

function BuyItems(item, count) -- item = item id, count = how many you want to buy up to

    wait(900, 1200)

    if (Self.ItemCount(item) < count) then

    Self.ShopBuyItem(item, (count-Self.ItemCount(item)))

    wait(200, 500)

    end

end

 

Self.ReachDepot = function (tries)

    local tries = tries or 3

    Walker.Stop()

    local DepotIDs = {3497, 3498, 3499, 3500}

    local DepotPos = {}

    for i = 1, #DepotIDs do

        local dps = Map.GetUseItems(DepotIDs)

        for j = 1, #dps do

            table.insert(DepotPos, dps[j])

        end

    end

 

    local function gotoDepot()

        local pos = Self.Position()

        print("Ilosc znalezionych Depo: " .. tostring(#DepotPos))

        for i = 1, #DepotPos do

            location = DepotPos

            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

                    Walker.Start()

                    return true

                end

            else

                print("To depo jest zajete, szukam dalej.")

            end

        end

        return false

    end

    

    repeat

        reachedDP = gotoDepot()

        if reachedDP then

            return true

        end

        tries = tries - 1

        sleep(100)

        print("Nie udalo sie dotrzec do depo... " .. tries .. " szukam dalej.")

    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

    else if labelName == "doorN" then

    Self.UseItemFromGround(location.x, location.y - 1, location.z)

    else if labelName == "doorS" then

    Self.UseItemFromGround(location.x, location.y + 1, location.z)

    end

 

Wciąż ten sam błąd...

Opublikowano

Wkleiłem ten twój skrypt na końcu, a z konfiguracją tego całego skryptu postępowałem, jak przy każdym innym. Niestety mistrzem komputerowym nie jestem.

Opublikowano

Masz coś takiego jak CALLBACK.

[skrypt wklejam w C-like, bo... jest łatwiejszy w zrozumieniu]

public SomeHandler myHandler( int someVar ); //Inicjacja handlera

myHandler += new SomeHandler(CallbackMethod); // Dodajemy nasz CALLBACK do Handlera

public void CallbackMethod(int someVar) { // To jest twój CALLBACK
// to jest blok kodu zaczyna się tu " { " a kończy tu " } "
// w Lua początek bloku to "nazwa()" a koniec to "end"
// tutaj zaczynają się warunki
if(someVar == 0){
// Jeżeli wartość zmiennej o nazwie "someVar" będzie równa "0" ten kod zostanie wykonany
}
else if(someVar > 0){
// Ale jeżeli wartość tej zmiennej będzie większa od zera to zostanie wykonany ten kod
}
// Koniec warunkowania
} //Tutaj jest koniec CALLBACKA

Czyli dla twojego przykładu :

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel") --Dodajemy CALLBACK do Handlera

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel") --To jest twój CALLBACK
--początek warunkowania
	if (labelName == "Checker") then --Jeżeli zmienna o nazwie "labelName" jest równa "Checker" to zostanie wykonany ten kod
			if (Self.ItemCount(ManaPotID) <= ManasToLeave) or (Self.ItemCount(HealthPotID) <= HealthToLeave) or (Self.Cap() < MinCap) then
				gotoLabel("Leave")
			else
				gotoLabel("Start Hunt")
		end    

	elseif (labelName == "TravelGo") then --ALE Jeżeli zmienna o nazwie "labelName" będzie równa "TravelGo" to zostanie wykonany ten kod
			setWalkerEnabled(false)
				delayWalker(5000)
				   Self.Say("hi")
				sleep(math.random(700, 1400))
				Self.SayToNpc("wyspa na ktora chcesz plynanc")  -- Tutaj wpisz wyspe na ktora sie udajesz.
				sleep(math.random(300, 1000))
				Self.SayToNpc("yes")
			setWalkerEnabled(true)
	end --Koniec warunkowania

end --Koniec bloku kodu CALLBACK'a

Biorąc wszystko to na logikę chcesz dodać nowy warunek, Jeżeli zmienna "labelName" będzie równa "doorS" to ma otworzyć drzwi poniżej postaci. Czyli przesuwamy koniec warunkowania niżej:

elseif (labelName == "TravelGo") then --ALE Jeżeli zmienna o nazwie "labelName" będzie równa "TravelGo" to zostanie wykonany ten kod
	setWalkerEnabled(false)
		delayWalker(5000)
		   Self.Say("hi")
		sleep(math.random(700, 1400))
		Self.SayToNpc("wyspa na ktora chcesz plynanc")  -- Tutaj wpisz wyspe na ktora sie udajesz.
		sleep(math.random(300, 1000))
		Self.SayToNpc("yes")
	setWalkerEnabled(true)



end --Koniec warunkowania

Mamy teraz miejsce na dopisanie kolejnego warunku a więc dopisujemy warunek "doorS":

elseif (labelName == "TravelGo") then --ALE Jeżeli zmienna o nazwie "labelName" będzie równa "TravelGo" to zostanie wykonany ten kod
	setWalkerEnabled(false)
		delayWalker(5000)
		   Self.Say("hi")
		sleep(math.random(700, 1400))
		Self.SayToNpc("wyspa na ktora chcesz plynanc")  -- Tutaj wpisz wyspe na ktora sie udajesz.
		sleep(math.random(300, 1000))
		Self.SayToNpc("yes")
	setWalkerEnabled(true)
--Dodajemy kolejny warunek:
else if labelName == "doorS" then
    Self.UseItemFromGround(location.x, location.y + 1, location.z)
--Tutaj dodajesz warunek doorN na przykładze z tego postu
end --Koniec warunkowania

Następnie, wchodzisz w walker, dodajesz Label i nazywasz go "doorS", przesuwasz go w odpowiednie miejsce na liście i testujesz.

Efekty jednego dnia wolnego od pracy :

lWxix4K.png

Chcesz wspomóc produkcję tego bota? Masz doświadczenie w programowaniu modułów, tworzeniu GUI czy skryptowaniu [C#]?

napisz na pw : http://www.mpcforum.pl/user/1285262-bleblable/

Opublikowano

Panowie, siedziałem nad tym ponad 2h, kopiowałem to:

  1. else if labelName == "doorN" then
  2. Self.UseItemFromGround(location.x, location.y - 1, location.z)
  3. else if labelName == "doorS" then
  4. Self.UseItemFromGround(location.x, location.y + 1, location.z)
  5. end

 

 

i wklejałem na końcu tych callbackow, czyli komend czy coś takiego, niestety cały czas ten sam błąd...

 

to jeden przykładowy z moich całych plików lua z tym skryptem na drzwi:

 

 

---------------------------------
--------Twoj Waypoint------------
-------Created By Sanix----------
---------------------------------

----------- BP SETUP ------------
--~ [bP 1] ~-- Main
--~ [bP 2] ~-- Produkty
--~ [bP 3] ~-- Gold

----------- DP SETUP ------------
--~ [DP 1] ~-- Rare
--~ [DP 2] ~-- Produkty

------------ Settings -----------

-- Mana Potions --

local ManasToLeave = 100    -- Z iloma manasami wracać
local WantedManas = 300        -- Ile Manasow kupić
local ManaPotID = 268         -- Mana Potion ID
local ManaCost = 50         -- Mana Potion koszt

-- Health Potions --

local HealthToLeave = 8        -- Z iloma healtami wracać
local WantedHealth = 20        -- Ile Healtow Kupić
local HealthPotID = 236        -- Health Potion ID
local HealthCost = 100        -- Koszt HP Potka

-- Other Options --

local MainBP = 2867         -- ID plecaka glownego   (Czerwony)
local ItemBP = 9602         -- ID plecaka na itemy     (Pomaranczowy)
local GoldBP = 2872         -- ID plecaka na kase     (Camouflage)
local MinCap = 50             -- Od ilu Capa wracać
local HideEquipment = true     -- Zminimalizować EQ

-- Floor Settings --

local SecondFloor = true     -- Tego nie zmieniajcie


Targeting.Start()
Looter.Start()

--------------------------------------------------------------------
--------------------------------------------------------------------
--------------------------------------------------------------------
--------------------------------------------------------------------
--------------------------------------------------------------------

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

local info = [[]]
    wait(5000)
    
    print([[
    --<Waypoint 100% Afk>--]])
    wait(5000)
    
-------------------------------------------------------------------------------------------------------

----------------------------------
function onWalkerSelectLabel(labelName)

if (labelName == "Checker") then
        if (Self.ItemCount(ManaPotID) <= ManasToLeave) or (Self.ItemCount(HealthPotID) <=

HealthToLeave) or (Self.Cap() < MinCap) then
            gotoLabel("Leave")
        else
            gotoLabel("Start Hunt")
    end    

elseif (labelName == "TravelGo") then
        setWalkerEnabled(false)
            delayWalker(5000)
               Self.Say("hi")
            sleep(math.random(700, 1400))
            Self.SayToNpc("wyspa na ktora chcesz plynanc")  -- Tutaj wpisz wyspe na ktora sie

udajesz.
            sleep(math.random(300, 1000))
            Self.SayToNpc("yes")
        setWalkerEnabled(true)

elseif (labelName == "TravelBack") then
        setWalkerEnabled(false)
            delayWalker(5000)
            Self.Say("hi")
            sleep(math.random(700, 1400))
            Self.SayToNpc("Wyspa powrotna")                    -- Tutaj wpisz wyspe

powrotna
            sleep(math.random(300, 1000))
            Self.SayToNpc("yes")
        setWalkerEnabled(true)

elseif (labelName == "Deposit") then
        setWalkerEnabled(false)
        Self.ReachDepot()
        Self.DepositItems({7436, 0}, {7454, 0})                -- Tutaj dodajesz ID

itemkow ktore ma odkładać do Depo a po przecinku backpack w kolejności od lewej strony 0 oznacza

miejsce pierwsze a 1 miejsce 2, 2 to miejsce trzecie i tak dalej
        Self.DepositItems({10293, 1}, {10311, 1})            -- tutaj to smao co

wyżej bo jak jest za dużo itemek w jednej lini to się zawiesza
        wait(1500,1900)
            
elseif (labelName == "Cash") 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")
        setWalkerEnabled(true)
    
    elseif (labelName == "Withdraw") then
        setWalkerEnabled(false)
        delayWalker(5000)
        Self.SayToNpc("hi")
        sleep(math.random(700, 1400))
        Self.WithdrawMoney((ManaCost*(WantedManas-Self.ItemCount(ManaPotID))))
        sleep(math.random(700, 1400))
        Self.WithdrawMoney((HealthCost*(WantedHealth-Self.ItemCount(HealthPotIDID))))
        sleep(math.random(700, 1400))
        Self.WithdrawMoney(100)
        sleep(math.random(700, 1400))
        Self.SayToNpc("yes")
        setWalkerEnabled(true)
        
    elseif (labelName == "Potions") then
        setWalkerEnabled(false)
        delayWalker(10000)
        Self.SayToNpc("hi")
        sleep(math.random(800, 1700))
        Self.SayToNpc({"Hi", "flasks", "yes", "yes", "yes", "Trade"}, 65)
        sleep(math.random(800, 1700))
        Self.SayToNpc("trade")
        sleep(math.random(2000, 2400))
            Self.ShopBuyItem(ManaPotID, (WantedManas-Self.ItemCount(ManaPotID)))
        sleep(math.random(2000, 2400))
            Self.ShopBuyItem(HealthPotID, (WantedHealth-Self.ItemCount(HealthPotID)))
        sleep(math.random(800, 1700))
        setWalkerEnabled(true)

elseif (labelName == "FullCheck") then
        if (Self.ItemCount(ManaPotID) < WantedManas) or (Self.Cap() < MinCap) or

(Self.ItemCount(HealthPotID) < WantedHealth) then
            gotoLabel("PreDeposit")
        else
            gotoLabel("LetsHunt")
        end
    else if labelName == "doorN" then
        Self.UseItemFromGround(location.x, location.y - 1, location.z)
        else if labelName == "doorS" then
        Self.UseItemFromGround(location.x, location.y + 1, location.z)
            end            

    elseif (labelName == "ResetBp") then
        Walker.Stop()

        Container.Close(ItemBP)    
        wait(1000)    
        Container.Close(GoldBP)
        wait(1000)
        Container.GetFirst():OpenChildren(ItemBP)
        wait(1000)
        Container.GetFirst():OpenChildren(GoldBP)
        wait(1000)        
        Container.GetByName(ItemBP):Minimize()
        wait(1000)
        Container.GetByName(GoldBP):Minimize()
        wait(200)
        if (HideEquipment) then
            Client.HideEquipment()
            wait(1000)
        end
        Walker.Start()    
    end
end


----------------------- Functions ----------------------
function SellItems(item) -- item = item ID
    wait(300, 1700)
    Self.ShopSellItem(item, Self.ShopGetItemSaleCount(item))
    wait(900, 1200)
end

function BuyItems(item, count) -- item = item id, count = how many you want to buy up to
    wait(900, 1200)
    if (Self.ItemCount(item) < count) then
    Self.ShopBuyItem(item, (count-Self.ItemCount(item)))
    wait(200, 500)
    end
end

Self.ReachDepot = function (tries)
    local tries = tries or 3
    Walker.Stop()
    local DepotIDs = {3497, 3498, 3499, 3500}
    local DepotPos = {}
    for i = 1, #DepotIDs do
        local dps = Map.GetUseItems(DepotIDs)
        for j = 1, #dps do
            table.insert(DepotPos, dps[j])
        end
    end

    local function gotoDepot()
        local pos = Self.Position()
        print("Ilosc znalezionych Depo: " .. tostring(#DepotPos))
        for i = 1, #DepotPos do
            location = DepotPos
            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
                    Walker.Start()
                    return true
                end
            else
                print("To depo jest zajete, szukam dalej.")
            end
        end
        return false
    end
    
    repeat
        reachedDP = gotoDepot()
        if reachedDP then
            return true
        end
        tries = tries - 1
        sleep(100)
        print("Nie udalo sie dotrzec do depo... " .. tries .. " szukam dalej.")
    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

Opublikowano

Znasz podstawy angielskiego?

end = koniec

 

W przypadku warunkowania

end = koniec warunkowania

if = jeżeli

elseif = inaczej jeżeli

 

Ty teraz zakończyłeś warunek a chwile później "zacząłeś" nowy od elseif

else if labelName == "doorN" then
        Self.UseItemFromGround(location.x, location.y - 1, location.z)
        else if labelName == "doorS" then
        Self.UseItemFromGround(location.x, location.y + 1, location.z)
            end            --ŹLE!

    elseif (labelName == "ResetBp") then

Efekty jednego dnia wolnego od pracy :

lWxix4K.png

Chcesz wspomóc produkcję tego bota? Masz doświadczenie w programowaniu modułów, tworzeniu GUI czy skryptowaniu [C#]?

napisz na pw : http://www.mpcforum.pl/user/1285262-bleblable/

Zarchiwizowany

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

×
×
  • Dodaj nową pozycję...