Signup Now
Results 1 to 4 of 4
  1. #1
    Moderator RoxZin xD's Avatar
    Join Date
    Dec 2013
    Location
    Rio de Janeiro
    Posts
    4,914
    Reputation
    109
    Rep Power
    31

    Can someone give me a hand on this one?

    So, I've made a simple action to sell a few items and what happens is that it will count the first one and will stick with it, without selling the others. Maybe it's because of the way I'm calling count, but someone more experienced on Lua can explain me why it's not working.

    local StackableSell = {"Minotaur Horn", "Broken Crossbow", "Purple Robe", "Piece of Warrior Armor", "Piece of Archer Armor"}

    for r = 1, #StackableSell do
    count = tradecount('sell', StackableSell[r])
    npctalk('hi', 'trade')
    waitping()
    while count > 0 do
    sellitems(StackableSell[r], count)
    wait(505,1010)
    end
    waitping()
    end


    Can someone give me a hand? Thanks ;-)



    Troubled Animals Quest [100+]
    ALL
    Feyrist Animals Surface [160+]
    RP
    Feyrist Silencers Underground X1 [180+]
    RP | EK
    Feyrist Silencers Underground X2 [200+]
    RP | EK
    Feyrist Silencers Surface [210+]
    RP | EK
    Rathleton Sewers [240+]
    RP
    Glooth Fairy [350+]
    ED/MS
    Hardcore Draken Walls [400+]
    EK

  2. #2
    Free User joraanpe's Avatar
    Join Date
    Dec 2013
    Posts
    212
    Reputation
    36
    Rep Power
    21
    Quote Originally Posted by RoxZin xD View Post
    So, I've made a simple action to sell a few items and what happens is that it will count the first one and will stick with it, without selling the others. Maybe it's because of the way I'm calling count, but someone more experienced on Lua can explain me why it's not working.

    local StackableSell = {"Minotaur Horn", "Broken Crossbow", "Purple Robe", "Piece of Warrior Armor", "Piece of Archer Armor"}

    for r = 1, #StackableSell do
    count = tradecount('sell', StackableSell[r])
    npctalk('hi', 'trade')
    waitping()
    while count > 0 do
    sellitems(StackableSell[r], count)
    wait(505,1010)
    end
    waitping()
    end


    Can someone give me a hand? Thanks ;-)
    its wierd, i made this code last night for my orc fortress script and it sells everything inside my two backpacks, the only difference is that i didnt use a variable for setting up the tradecount(), i added the tradecount directly inside the sellitems, might worth to try if it makes any difference

  3. #3
    Moderator Leonardo's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    758
    Reputation
    77
    Rep Power
    22
    The problem is count is being updated only 1 time, like joraanpe said you don't need to add a variable for it just call the function:

    local StackableSell = {"Minotaur Horn", "Broken Crossbow", "Purple Robe", "Piece of Warrior Armor", "Piece of Archer Armor"}

    npctalk('hi', 'trade')
    for r = 1, #StackableSell do
    while tradecount('sell', StackableSell[r]) > 0 do
    sellitems(StackableSell[r], 100)
    waitping()
    end
    end

  4. #4
    Moderator RoxZin xD's Avatar
    Join Date
    Dec 2013
    Location
    Rio de Janeiro
    Posts
    4,914
    Reputation
    109
    Rep Power
    31
    Oh, thanks a lot, guys! Now it worked perfectly

    The only fucked up part is that it will say "hi, trade" for every item, but that's because of the function sellitems() :|
    Last edited by RoxZin xD; 12-17-2013 at 03:26 AM.



    Troubled Animals Quest [100+]
    ALL
    Feyrist Animals Surface [160+]
    RP
    Feyrist Silencers Underground X1 [180+]
    RP | EK
    Feyrist Silencers Underground X2 [200+]
    RP | EK
    Feyrist Silencers Surface [210+]
    RP | EK
    Rathleton Sewers [240+]
    RP
    Glooth Fairy [350+]
    ED/MS
    Hardcore Draken Walls [400+]
    EK

 

 

Posting Permissions

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