XenoBot Forums - Powered by vBulletin

User Tag List

Page 9 of 9 FirstFirst ... 789
Results 81 to 90 of 90

Thread: 100% AFK Script Making

  1. #81
    Tibiano's Avatar
    Join Date
    Oct 2014
    Location
    Spain
    Posts
    401
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    CAN YOU SHARE A SIMILAR OF THAT CODE UPDATED FOR SCRIPTING?

    REGARDS BRO! <3


    Code:
    ------ REFILL SETTINGS ------
    local LeaveMana = 100 --- How many mana potions until you leave the hunt?
    local BuyMana = 300 --- How many mana potions you begin the hunt with?
    
    local LeaveHealth = 5 --- How many health potions until you leave the hunt?
    local BuyHealth = 10 --- How many health potions you begin the hunt with?
    
    local AmmoName = "Royal Spear"	--- What ammunition are you using?
    local LeaveAmmo = 10 --- How much ammunition until you leave hunt?
    local BuyAmmo = 45 --- How much ammunition do you begin the hunt with?
    local AmmoCost = 15 --- What is the cost of your selected ammunition?
    
    local LeaveCap = 100 --- Leaves spawn when character reaches this cap.
    local HideEquipment = true --- Do you want to minimize your equipment?
    local LogoutStamina = false --- Do you want to logout at 16 hours? (Inside the depot)
    
    -- Item ID's, if you don't want to use SHP and SMP, change these:
    
    local ManaName = "Strong Mana Potion" 
    local ManaCost = 80
    local HealthName = "Strong Health Potion" 
    local HealthCost = 100
    
    -- Backpack Configuration:
    
    local LootBP = "Fur Backpack"
    local GoldBP = "Jewelled Backpack"
    
    -- Spawn Options
    
    local HuntMiddle = false
    
    -- Here I'm gonna get the item ids, leave this as it is.
    
    local ManaID = Item.GetID(ManaName)
    local HealthID = Item.GetID(HealthName)
    local AmmoID = Item.GetID(AmmoName)
    
    -- These are the flask IDs, not worth changing since it will sell all flasks regardless of type.
    local FlaskID = 283
    local FlaskIDA = 284
    local FlaskIDB = 285
    
    -- local GoldBP = 5801 --- Item ID of your gold backpack.
    
    registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
    
    function onWalkerSelectLabel(labelName)
    	if (labelName == "Checker") then
    		-- Check Supplies, Hunt or Leave
    		Walker.ConditionalGoto((Self.ItemCount(ManaID) <= LeaveMana) or (Self.Cap() < LeaveCap) or (Self.ItemCount(HealthID) <= LeaveHealth) or (Self.ItemCount(AmmoID) <= LeaveAmmo), "Leave", "BeginHunt")
    
    	elseif (labelName == "Start") then
    		Walker.ConditionalGoto((Self.Position().z == 11), "BeginHunt", "ReachDepot")
    	
    	elseif (labelName == "DepositGold") then
    		-- Deposit Gold, check balance.
    		Walker.Stop()
    		Self.SayToNpc({"hi", "deposit all", "yes"}, 100)
    
    		local withdrawManas = math.max(BuyMana - Self.ItemCount(ManaID), 0)*ManaCost
    		local withdrawHealths = math.max(BuyHealth - Self.ItemCount(HealthID), 0)*HealthCost
    		local withdrawAmmo = math.max(BuyAmmo - Self.ItemCount(AmmoID), 0)*AmmoCost
    		local total = math.abs(withdrawManas + withdrawHealths + withdrawAmmo)
    
    		if total >= 1 then
    			Self.SayToNpc({"withdraw " .. total, "yes", "balance"}, 100)
    		end
    		Walker.Start()
    
    	elseif (labelName == "DepositItems") then
    		-- Deposit Items
    		Walker.Stop()
    		Self.ReachDepot(5)
    		Self.DepositItems({5882, 1}, {3028, 1}, {3029, 1}, {5948, 1}, {11457, 1}, {5920, 1}, {5877, 1}, {3061, 1})
    		Self.DepositItems({3386, 0}, {3392, 0}, {7402, 0}, {7399, 0}, {3428, 0}, {3416, 0}, {3280, 0}, {3071, 0}, {7430, 0}, {3322, 0})
    		Walker.Start()
    
    	elseif (labelName == "BuyManas") then
    		-- Buy Mana Potions
    		Walker.Stop()
    		if (Self.ItemCount(ManaID) < BuyMana) or (Self.ItemCount(HealthID) < BuyHealth) then
    			print("Buying manas or healths")
    			Self.SayToNpc({"hi", "flasks"}, 100)
    			while (Self.ItemCount(FlaskID) >= 1) or (Self.ItemCount(FlaskIDA) >= 1) or (Self.ItemCount(FlaskIDB) >= 1) do
    				Self.SayToNpc("yes", 100)
    			end
    			wait(2000)
    			Self.SayToNpc("trade", 100)
    			wait(2000)
    			while (Self.ItemCount(ManaID) < BuyMana) do
    				Self.ShopBuyItemsUpTo(ManaID, BuyMana)
    				wait(500,800)
    			end
    			if (Self.ItemCount(HealthID) < BuyHealth) then
    				Self.ShopBuyItemsUpTo(HealthID, BuyHealth)
    				wait(500)
    			end
    			wait(200, 500)
    		end
    		Walker.Start()
    
    	elseif (labelName == "CheckGoneUp") then
    		-- Check we're on floor 3
    		Walker.ConditionalGoto((Self.Position().z == 7), "OpenSouth", "Leave")
    
    	elseif (labelName == "CheckGoneDown") then
    		-- Check we're on floor 7
    		Walker.ConditionalGoto((Self.Position().z == 11), "AmDown", "EnterResp")
    
    	elseif (labelName == "BuySpears") then
    			--------------------------------- TODO -------------------------
    		Walker.Stop()
    		Self.SayToNpc({"hi", "trade"}, 100)
    		-- Buy spears, make sure Self.ItemCount returns items in hands.
    		while (Self.ItemCount(AmmoID) < BuyAmmo) do
    			Self.ShopBuyItemsUpTo(AmmoID, BuyAmmo)
    			wait(500,800)
    		end
    		Walker.Start()
    
    	elseif (labelName == "ResetBps") then
    		-- Reset Backpacks
    		Walker.Stop()
    		Self.CloseContainers()
    		Self.OpenMainBackpack(true):OpenChildren({LootBP, true}, {GoldBP, true})
    		Container.GetFirst():Minimize()
    		Walker.Start()
    
    	elseif (labelName == "OpenNorth") then
    		Walker.Stop()
    		Self.UseItemFromGround(Self.Position().x, Self.Position().y - 1, Self.Position().z) 
    		Walker.Start()
    
    	elseif (labelName == "OpenSouth") then
    		Walker.Stop()
    		Self.UseItemFromGround(Self.Position().x, Self.Position().y + 1, Self.Position().z) 
    		Walker.Start()
    
    	elseif (labelName == "MiddleSpawn") then
    		Walker.Stop()
    		Walker.ConditionalGoto(HuntMiddle, "MiddleGo", "MiddleDone")
    		Walker.Start()
    	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[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
    					Walker.Start()
    					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

    Thanks all![/QUOTE]
    More threads:

    Selling:
    140 ED + 92 MS
    EK +72




    Trading History:

    114 EK + 57 ED Sold to @dambrian
    2 P.Scrolls Sold to @hfuryz
    1 P.Scroll Sold to @aprilwong
    64 RP Sold to @Perik1996
    Avatar Sold to @IronGatey

  2. #82
    Lifetime Subscriber
    Join Date
    Sep 2015
    Posts
    13
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    very good

  3. #83
    gregory's Avatar
    Join Date
    Sep 2013
    Location
    Newcastle, England
    Posts
    145
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Is there a label to use a key on a door?

  4. #84

    Join Date
    May 2012
    Location
    Germany
    Posts
    273
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hey Josh can you show the lua files for mages, cause if i try to delete the ammo crap the complete script trashed and now nothign works he ingore all labels what i ma doing wrong?

  5. #85
    Senior Member XtrmJosh's Avatar
    Join Date
    Apr 2012
    Location
    Cambridge, England
    Posts
    1,330
    Mentioned
    39 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Talis View Post
    Hey Josh can you show the lua files for mages, cause if i try to delete the ammo crap the complete script trashed and now nothign works he ingore all labels what i ma doing wrong?
    You don't need to delete much to make it work for mages, just gotta adjust gotta remove the math which adds gold for spears or whatever from this:

    Code:
    		local withdrawManas = math.max(BuyMana - Self.ItemCount(ManaID), 0)*ManaCost
    		local withdrawHealths = math.max(BuyHealth - Self.ItemCount(HealthID), 0)*HealthCost
    		local withdrawAmmo = math.max(BuyAmmo - Self.ItemCount(AmmoID), 0)*AmmoCost
    		local total = math.abs(withdrawManas + withdrawHealths + withdrawAmmo)
    Delete the withdrawAmmo line so it becomes

    Code:
    		local withdrawManas = math.max(BuyMana - Self.ItemCount(ManaID), 0)*ManaCost
    		local withdrawHealths = math.max(BuyHealth - Self.ItemCount(HealthID), 0)*HealthCost
    		local total = math.abs(withdrawManas + withdrawHealths + withdrawAmmo)
    However, as a mage you might just want to use it to buy runes or something instead. Up to you, aside from that, you just don't add the labels to go buy items and while it consumes an extra few bytes of your storage, it won't do you any real harm. To do this, leave the script exactly as it was, but change the name of your ammo to the name of your rune, set the cost up as if the rune is a type of ammo, and set waypoints to the rune NPC instead of the ammo NPC. It'd be a mess but it would work. I don't advocate that anyone who uses this tutorial uses it to make scripts "for sale", so I anticipate this would be fine.
    You cannot fail, so I'm lowering the standard.

  6. #86

    Join Date
    Feb 2016
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hell Josh, I have a question about a supply bp. I have tried to add one but I failed every time. The bot wont open it. Do you know why/how?
    Can you also explain how the bot will move the supplies?

  7. #87

    Join Date
    Jul 2016
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi how to add sellitem on this script?
    i tryed just change that buyitem to sellitem and name/id but still not working.

  8. #88
    mikjail's Avatar
    Join Date
    Jan 2016
    Location
    Venezuela
    Posts
    39
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    outdate? deprecated?

  9. #89

    Join Date
    Jul 2017
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lightbulb help guys

    Sup Guys!

    I have ben tryed change this script and update then for a knight hunt.
    But, idk why, the scrip cant read how many potions the character have and always buy all supply again, in addition to always leave on checkers hunt.

    So, can someone help me?

    this is my try:

    Code:
    ------ REFILL SETTINGS ------
    local LeaveMana = 500 --- How many mana potions until you leave the hunt?
    local BuyMana = 1500 --- How many mana potions you begin the hunt with?
    
    local LeaveHealth = 50 --- How many health potions until you leave the hunt?
    local BuyHealth = 100 --- How many health potions you begin the hunt with?
    
    local AmmoName = "Royal Spear"	--- What ammunition are you using?
    local LeaveAmmo = 0 --- How much ammunition until you leave hunt?
    local BuyAmmo = 0 --- How much ammunition do you begin the hunt with?
    local AmmoCost = 0 --- What is the cost of your selected ammunition?
    
    local LeaveCap = 100 --- Leaves spawn when character reaches this cap.
    local HideEquipment = true --- Do you want to minimize your equipment?
    local LogoutStamina = false --- Do you want to logout at 16 hours? (Inside the depot)
    
    -- Item ID's, if you don't want to use SHP and SMP, change these:
    
    local ManaName = "mana potion" 
    local ManaCost = 50
    local HealthName = "supreme health potion" 
    local HealthCost = 500
    
    -- Backpack Configuration:
    
    local LootBP = "Backpack"
    local GoldBP = "Brocade Backpack"
    
    -- Spawn Options
    
    local HuntMiddle = true
    
    -- Here I'm gonna get the item ids, leave this as it is.
    
    local ManaID = Item.GetID(ManaName)
    local HealthID = Item.GetID(HealthName)
    local AmmoID = Item.GetID(AmmoName)
    
    -- These are the flask IDs, not worth changing since it will sell all flasks regardless of type.
    local FlaskID = 283
    local FlaskIDA = 284
    local FlaskIDB = 285
    
    -- local GoldBP = 5801 --- Item ID of your gold backpack.
    -- local GoldBP = 5801 --- Item ID of your gold backpack.
    
    registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
    
    function onWalkerSelectLabel(labelName)
    	if (labelName == "Checker") then
    		-- Check Supplies, Hunt or Leave
    		Walker.ConditionalGoto((Self.ItemCount(ManaID) <= LeaveMana) or (Self.Cap() < LeaveCap) or (Self.ItemCount(HealthID) <= LeaveHealth), "Leave", "BeginHunt")
    
    	elseif (labelName == "Start") then
    		Walker.ConditionalGoto((Self.Position().z == 11), "BeginHunt", "ReachDepot")
    	
    	elseif (labelName == "DepositGold") then
    		-- Deposit Gold, check balance.
    		Walker.Stop()
    		Self.SayToNpc({"hi", "deposit all", "yes"}, 100)
    
    		local withdrawManas = math.max(BuyMana - Self.ItemCount(ManaID), 0)*ManaCost
    		local withdrawHealths = math.max(BuyHealth - Self.ItemCount(HealthID), 0)*HealthCost
    		local total = math.abs(withdrawManas + withdrawHealths)
    
    		if total >= 1 then
    			Self.SayToNpc({"withdraw " .. total, "yes", "balance"}, 100)
    		end
    		Walker.Start()
    
    	elseif (labelName == "DepositItems") then
    		-- Deposit Items
    		Walker.Stop()
    		Self.ReachDepot(5)
    		Self.DepositItems({12683, 2}, {14043, 2}, {14247, 2}, {14248, 2}, {14250, 2}, {3052, 2}, {13987, 2}, {13990, 2}, {14009, 2}, {14247, 2}, {3052, 2}, {12683, 2}, {14040, 2}, {14042, 2}, {12683, 2}, {14043, 2}, {14247, 2}, {14248, 2}, {14250, 2}, {3052, 2}, {12683, 2}, {14040, 2}, {14042, 2}, {3052, 2}, {13987, 2}, {13990, 2}, {14009, 2}, {14247, 2}, {238, 1}, {239, 1}, {3029, 1}, {12730, 1}, {14010, 1}, {14011, 1}, {14044, 1}, {14142, 1}, {3029, 1}, {3578, 1}, {5895, 1}, {12730, 1}, {14008, 1}, {14085, 1}, {238, 1}, {239, 1}, {3032, 1}, {5895, 1}, {12730, 1}, {14012, 1}, {14013, 1}, {14041, 1}, {14085, 1}, {14252, 1}, {238, 1}, {239, 1}, {3029, 1}, {12730, 1}, {14010, 1}, {14011, 1}, {14044, 1}, {14142, 1}, {238, 1}, {239, 1}, {3032, 1}, {5895, 1}, {12730, 1}, {14012, 1}, {14013, 1}, {14041, 1}, {14085, 1}, {14252, 1}, {281, 1}, {3029, 1}, {3578, 1}, {5895, 1}, {12730, 1}, {14017, 1}, {3029, 1}, {3578, 1}, {5895, 1}, {12730, 1}, {14008, 1}, {14085, 1})
    		Walker.Start()
    
    	elseif (labelName == "BuyManas") then
    		-- Buy Mana Potions
    		Walker.Stop()
    		if (Self.ItemCount(ManaID) < BuyMana) or (Self.ItemCount(HealthID) < BuyHealth) then
    			print("Buying manas or healths")
    			Self.SayToNpc({"hi", "flasks"}, 100)
    			while (Self.ItemCount(FlaskID) >= 1) or (Self.ItemCount(FlaskIDA) >= 1) or (Self.ItemCount(FlaskIDB) >= 1) do
    				Self.SayToNpc("yes", 100)
    			end
    			wait(2000)
    			Self.SayToNpc("trade", 100)
    			wait(2000)
    			while (Self.ItemCount(ManaID) < BuyMana) do
    				Self.ShopBuyItemsUpTo(ManaID, BuyMana)
    				wait(500,800)
    			end
    			if (Self.ItemCount(HealthID) < BuyHealth) then
    				Self.ShopBuyItemsUpTo(HealthID, BuyHealth)
    				wait(500)
    			end
    			wait(200, 500)
    		end
    		Walker.Start()
    
    	elseif (labelName == "CheckGoneUp") then
    		-- Check we're on floor 3
    		Walker.ConditionalGoto((Self.Position().z == 7), "OpenSouth", "Leave")
    
    	elseif (labelName == "CheckGoneDown") then
    		-- Check we're on floor 7
    		Walker.ConditionalGoto((Self.Position().z == 11), "AmDown", "EnterResp")
    
    	elseif (labelName == "BuySpears") then
    			--------------------------------- TODO -------------------------
    		Walker.Stop()
    		Self.SayToNpc({"hi", "trade"}, 100)
    		-- Buy spears, make sure Self.ItemCount returns items in hands.
    		while (Self.ItemCount(AmmoID) < BuyAmmo) do
    			Self.ShopBuyItemsUpTo(AmmoID, BuyAmmo)
    			wait(500,800)
    		end
    		Walker.Start()
    
    	elseif (labelName == "ResetBps") then
    		-- Reset Backpacks
    		Walker.Stop()
    		Self.CloseContainers()
    		Self.OpenMainBackpack(true):OpenChildren({LootBP, true}, {GoldBP, true})
    		Container.GetFirst():Minimize()
    		Walker.Start()
    
    	elseif (labelName == "OpenNorth") then
    		Walker.Stop()
    		Self.UseItemFromGround(Self.Position().x, Self.Position().y - 1, Self.Position().z) 
    		Walker.Start()
    
    	elseif (labelName == "OpenSouth") then
    		Walker.Stop()
    		Self.UseItemFromGround(Self.Position().x, Self.Position().y + 1, Self.Position().z) 
    		Walker.Start()
    
    	elseif (labelName == "MiddleSpawn") then
    		Walker.Stop()
    		Walker.ConditionalGoto(HuntMiddle, "MiddleGo", "MiddleDone")
    		Walker.Start()
    	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[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
    					Walker.Start()
    					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
    Last edited by Barao; 07-15-2017 at 02:37 AM.

  10. #90

    Join Date
    Sep 2017
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone know what to add to make it travel by boat? would really appreciate it!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •