XenoBot Forums - Powered by vBulletin

User Tag List

Results 1 to 3 of 3

Thread: Help with my .lua file (newb)

  1. #1

    Join Date
    Mar 2012
    Posts
    182
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with my .lua file (newb)

    Hey, I get this error message.

    10:19 XenoScript Error:
    Script: Smuggler Pit Version 1.lua
    Line #: 55
    Chunk: C:\Users\Michael\Documents\XenoBot\Scripts\Smuggle r Pit Version 1.lua
    Error: '<eof>' expected near 'end'
    This is an error with user-input and should not be reported as a bug with XenoBot.
    The .lua is:

    Code:
    -- Smuggler Pit Version 1 by Rhinocort --
    --===========##[CONFIGURATION]##===========--
    
    local MinCap = 10 				-- Cap to deposit on.
    local MinMana = 5 				-- Manas to deposit on.
    
    local MaxMana = 10				-- Amount of manas to buy.
    
    local ManaId = 268				-- Id of Mana Potion.
    local ManaPrice = 50				-- How much Mana Potions cost.
    
    local GoldBP = 2872				-- Id of Gold Backpack
    
    local RareDP = 0 				-- BP in DP to put Non-Stackable Items Into
    local StackDP = 1				-- BP in DP to put Stackable Items Into
    -- (0 = first backpack, 1 = second and so on...) --
    
    --- DON'T CHANGE ANYTHING BELOW THIS LINE ---
    
    print("Smuggler Pit version 1 \nby Rhinocort")
    registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
    
    function onWalkerSelectLabel(labelName)
    	if (labelName == "ManaCap") then
    		print("Current Manas: " .. Self.ItemCount(268))
    		if (Self.Cap() > MinCap and Self.ItemCount(ManaId) > MinMana) then
    			gotoLabel("Start")
    		end
    	
    	elseif (labelName == "Bank") then
    		local amount = (MaxMana-Self.ItemCount(ManaId))*ManaPrice
    	    delayWalker(2000)
    		setWalkerEnabled(false)
    		Self.SayToNpc({"hi", "deposit all", "yes"}, 65)
    		if (amount > 0) then
    			Self.SayToNpc({"withdraw " .. amount, "yes", "balance"}, 65)
    		end
    		setWalkerEnabled(true)
    	elseif (labelName == "BuyManas") then
    		local manaCount = (MaxMana-Self.ItemCount(ManaId))
    	    delayWalker(2000)
    		setWalkerEnabled(false)
    		Self.SayToNpc({"hi", "vials", "yes", "trade"}, 65)
    		wait(2000, 3700)
    		while (Self.ItemCount(ManaId) < MaxMana) do
    			Self.ShopBuyItem(ManaId, manaCount)
    			wait(200, 500)
    		end
    	elseif (labelName == "DepositAll") then
    		delayWalker(2000)
    		setWalkerEnabled(false)
    		Self.SayToNpc({"hi", "deposit all", "yes", "balance"}, 65)
    		end
    	end
    end
    This is my first attempt at making a 100% afk script, so I am still learning. I copied a few things from other .lua files(@Infernal Bolt) I had and tried to glue all together, probally messed up somewhere.

    Help would be awsome!

    (I expect it to be an 'end' too much, or too few)

    Tnx
    Last edited by Rhinocort; 08-13-2012 at 08:37 AM.

  2. #2
    Banned
    Join Date
    Apr 2012
    Location
    Tennessee, USA
    Posts
    252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This fixed the error, there was 1 too many ends, and in the wrong spot. Also, for a continuous script running, you need to add a 'wait' at the end, as I have here

    PHP Code:
    -- Smuggler Pit Version 1 by Rhinocort --
    --===========
    ##[CONFIGURATION]##===========--
    local MinCap 10               -- Cap to deposit on.
    local MinMana 5               -- Manas to deposit on.

    local MaxMana 10              -- Amount of manas to buy.

    local ManaId 268              -- Id of Mana Potion.
    local ManaPrice 50                -- How much Mana Potions cost.

    local GoldBP 2872             -- Id of Gold Backpack

    local RareDP 
    0                -- BP in DP to put Non-Stackable Items Into
    local StackDP 
    1               -- BP in DP to put Stackable Items Into
    -- (first backpacksecond and so on...) --
    --- 
    DON'T CHANGE ANYTHING BELOW THIS LINE ---

    print("Smuggler Pit version 1 \nby Rhinocort")
    registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
    function onWalkerSelectLabel(labelName)
        if (labelName == "ManaCap") then
            print("Current Manas: " .. Self.ItemCount(268))
            if (Self.Cap() > MinCap and Self.ItemCount(ManaId) > MinMana) then
                gotoLabel("Start")
            end
        elseif (labelName == "Bank") then
            local amount = (MaxMana-Self.ItemCount(ManaId))*ManaPrice
            delayWalker(2000)
            setWalkerEnabled(false)
            Self.SayToNpc({"hi", "deposit all", "yes"}, 65)
            if (amount > 0) then
                Self.SayToNpc({"withdraw " .. amount, "yes", "balance"}, 65)
            end
            setWalkerEnabled(true)
        elseif (labelName == "BuyManas") then
            local manaCount = (MaxMana-Self.ItemCount(ManaId))
            delayWalker(2000)
            setWalkerEnabled(false)
            Self.SayToNpc({"hi", "vials", "yes", "trade"}, 65)
            wait(2000, 3700)
            while (Self.ItemCount(ManaId) < MaxMana) do
                Self.ShopBuyItem(ManaId, manaCount)
                wait(200, 500)
            end
        elseif (labelName == "DepositAll") then
            delayWalker(2000)
            setWalkerEnabled(false)
            Self.SayToNpc({"hi", "deposit all", "yes", "balance"}, 65)
        end
        wait(300,700)
    end 

  3. #3

    Join Date
    Mar 2012
    Posts
    182
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perfect, tnx!

    Edit: My .lua works now. But at the selected labelnames, it does not talk to npc, does not buy, sell or do anything.

    Edit2: Nevermind, fixed it. This newb forgot to actually execute the .lua..

    Topic closed
    Last edited by Rhinocort; 08-13-2012 at 09:17 AM.

Posting Permissions

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