Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: What is wrong with this script? nothing happens

  1. #1
    Normal User
    Join Date
    Mar 2013
    Location
    SWE!
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    4

    What is wrong with this script? nothing happens

    I have written about half of this code:

    Code:
    local total = 0
    
    if (hpbuy > 0) then
        if (itemcount("health potion") < hpbuy) then 
            local hps = positive(hpbuy - itemcount("health potion")) * 45
            total = total + hps
            buyHP = true
        end
    elseif (mpBuy > 0) then 
        if (itemcount("mana potion") < mpBuy) then 
            local mps = positive(mpBuy - itemcount("mana potion potion")) * 45
            total = total + mps
            buyMP = true
        end
    elseif (itemcount("silver key") == 0) then 
        total = total + 50
        buyKey = true
    elseif (boots == itemid("leather boots")) then 
        total = total + 10
        buyBoots = true
        -- must make buy backpack
    end
    
    wait(500,1000)
    say("hi")
    wait(1500,2000)
    npcsay("deposit all")
    wait(1000,1300)
    npcsay("yes")
    wait(1000,1300)
    npcsay("balance")
    wait(2000)
    npcsay("withdraw "..Total)
    wait(1000,1300)
    npcsay("yes")
    wait(1000,1300)
    depositting = false


    But the bot passes through this script without doing anything.. doesnt even say anything to banker npc which im standing next to.

  2. #2
    iBot User Raph_'s Avatar
    Join Date
    Feb 2013
    Posts
    391
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    59
    Rep Power
    4
    What's the error that you can found on Debug?

  3. #3
    Normal User
    Join Date
    Mar 2013
    Location
    SWE!
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    4
    I don't know about debug?
    How can I access that?

  4. #4
    iBot User Raph_'s Avatar
    Join Date
    Feb 2013
    Posts
    391
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    59
    Rep Power
    4
    iBot (Main Window) > Help > Debug

  5. #5
    Banned
    Join Date
    May 2012
    Posts
    1,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    127
    Rep Power
    0
    npcsay("withdraw "..total) -- total instead of Total

  6. #6
    Normal User
    Join Date
    Mar 2013
    Location
    SWE!
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    4
    oh nice, yeah that fixed a big part of the script.. it now saw that i didnt have any health pots and then withdraw 90gp to bbuy 2 potions that i had set in settings.
    but it should have also withdraw 10gp for leather boots and 50gp for key! it didnt! I dont understand why?

  7. #7
    Normal User Raphael's Avatar
    Join Date
    Apr 2012
    Location
    São Paulo, Brazil
    Posts
    297
    Mentioned
    1 Post(s)
    Tagged
    3 Thread(s)
    Quoted
    5 Post(s)
    Reputation
    78
    Rep Power
    5
    You're using an [ilua]elseif[/ilua], while you should be using a new [ilua]if[/ilua].
    If you don't know why, google it.

  8. #8
    Normal User
    Join Date
    Mar 2013
    Location
    SWE!
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    4
    Thanks big time, you are totally right! it now withdraws 50 gp for key but still not for leather boots?
    Any idea why? I really don't know myself.

  9. #9
    Normal User Raphael's Avatar
    Join Date
    Apr 2012
    Location
    São Paulo, Brazil
    Posts
    297
    Mentioned
    1 Post(s)
    Tagged
    3 Thread(s)
    Quoted
    5 Post(s)
    Reputation
    78
    Rep Power
    5
    They should all be [ilua]if[/ilua]'s.

  10. #10
    Normal User
    Join Date
    Mar 2013
    Location
    SWE!
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    4
    Yes they are all IF's now but it doesn't take money for boots and I dont have any boots equiped.

    This is what code looks like right now:
    Code:
    local total = 0
    
    if (hpbuy > 0) then
        if (itemcount("health potion") < hpbuy) then 
            local hps = positive(hpbuy - itemcount("health potion")) * 45
            total = total + hps
            buyHP = true
        end
    end
    if (mpBuy > 0) then 
        if (itemcount("mana potion") < mpBuy) then 
        local mps = positive(mpBuy - itemcount("mana potion potion")) * 50
            total = total + mps
            buyMP = true
        end
    end
    if (itemcount("silver key") == 0) then 
        total = total + 50
        buyKey = true
    end
    if (boots == itemid("leather boots")) then 
        total = total + 10
        buyBoots = true
        -- must make buy backpack
    end
    
    wait(500,1000)
    say("hi")
    wait(1500,2000)
    npcsay("deposit all")
    wait(1000,1300)
    npcsay("yes")
    wait(1000,1300)
    npcsay("balance")
    wait(2000)
    npcsay("withdraw "..total)
    wait(1000,1300)
    npcsay("yes")
    wait(1000,1300)
    depositting = false

Posting Permissions

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