Results 1 to 8 of 8

Thread: Buying Items

  1. #1
    Normal User JustAnotherDay's Avatar
    Join Date
    Jun 2012
    Posts
    47
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    13
    Rep Power
    5

    Buying Items

    Wel, I've come up with this, and it doesn't really seem to work like I intended to. It buys manas.. but for all the money it has. Could someone help me out?

    Code:
    sellflasks() wait(800,1200)
    
    -- [Mana] --
    local CurrentMana = itemcount(ManaName)
    local Amount1 = ManaAmount - CurrentMana
    
    while Amount1 > 0 and ManaRefill == true do
    buyitems(ManaName,  Amount1) wait(800,1200)
    moveitems(ManaName, SupplyBP, Amount1) wait(800,1200)
    end
    
    -- [Health1]  --
    local CurrentHealth1 = itemcount(HealthName1)
    local Amount2 = HealthAmount1 - CurrentHealth1
    
    while Amount2 > 0 and HealthRefill1 == true do
    buyitems(HealthName1, Amount2) wait(800,1200)
    moveitems(HealthName1, SupplyBP, Amount2) wait(800,1200)
    end
    
    --  [Health2]  -
    local CurrentHealth2 = itemcount(HealthName2)
    local Amount3 = HalthAmount2 - CurrentHealth2
    
    while Amount3 > 0 and HealthRefill2 == true do
    buyitems(HealthName2, Amount3) wait(800,1200)
    moveitems(HealthName2, SupplyBP, Amount3) wait(800,1200)
    end
    wait(2000,3000)

  2. #2
    Normal User
    Join Date
    May 2012
    Posts
    312
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    11
    Rep Power
    5
    the variable Amount1 will be almost allways bigger than 0, I think it should me something like
    PHP Code:
    while amount1 manastobuy and ManaRefill == true do 

  3. #3
    Normal User JustAnotherDay's Avatar
    Join Date
    Jun 2012
    Posts
    47
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    13
    Rep Power
    5
    But don't you think its a problem with he buyitems() ? Because if ManaAmount = CurrentMana then Amount = 0, therefor it wont buy anything.

  4. #4
    iBot User pink_panther's Avatar
    Join Date
    May 2012
    Location
    Australia
    Posts
    4,075
    Mentioned
    49 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    178 Post(s)
    Reputation
    309
    Rep Power
    10
    Quote Originally Posted by JustAnotherDay View Post
    Wel, I've come up with this, and it doesn't really seem to work like I intended to. It buys manas.. but for all the money it has. Could someone help me out?

    Code:
    sellflasks() wait(800,1200)
    
    -- [Mana] --
    local CurrentMana = itemcount(ManaName)
    local Amount1 = ManaAmount - CurrentMana
    
    while Amount1 > 0 and ManaRefill == true do
    buyitems(ManaName,  Amount1) wait(800,1200)
    moveitems(ManaName, SupplyBP, Amount1) wait(800,1200)
    end
    
    -- [Health1]  --
    local CurrentHealth1 = itemcount(HealthName1)
    local Amount2 = HealthAmount1 - CurrentHealth1
    
    while Amount2 > 0 and HealthRefill1 == true do
    buyitems(HealthName1, Amount2) wait(800,1200)
    moveitems(HealthName1, SupplyBP, Amount2) wait(800,1200)
    end
    
    --  [Health2]  -
    local CurrentHealth2 = itemcount(HealthName2)
    local Amount3 = HalthAmount2 - CurrentHealth2
    
    while Amount3 > 0 and HealthRefill2 == true do
    buyitems(HealthName2, Amount3) wait(800,1200)
    moveitems(HealthName2, SupplyBP, Amount3) wait(800,1200)
    end
    wait(2000,3000)
    You're script is messy as balls, just use this.

    PHP Code:
    local mainBp "Backpack of Holding"
    local supplyBp "Green Backpack"
    local nameMp "Mana Potion"
    local nameHp "Strong Health Potion"
    local maxMp 300
    local maxHp 
    50

    -- Mana potions
    while itemcount(nameMp) < maxMp do
    buyitemsupto(nameMpmaxMpitemcount(nameMp))
    wait(700,1300)
    end

    while itemcount(nameMpmainBp) > do
    moveitems(nameMpmainBpsupplyBp100)
    end
    -- Health potions
    while itemcount(nameHp) < maxHp do
    buyitemsupto(nameHpmaxHpitemcount(nameHp))
    wait(700,1300)
    end

    while itemcount(nameHpmainBp) > do
    moveitems(nameHpmainBpsupplyBp100)
    end 
    I changed the variables, but you can change them back to whatever. You also don't really need the While X do Y around the buyitemsupto function, it's pretty pointless.

    Nor so i see the point of "ManaRefill == true"
    Last edited by pink_panther; 07-25-2012 at 05:16 AM.

  5. #5
    Normal User JustAnotherDay's Avatar
    Join Date
    Jun 2012
    Posts
    47
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    13
    Rep Power
    5
    Yeah, but that one was buyitems() not upto. Well, haven't tried upto yet, so I'll give it a shot

  6. #6
    Normal User
    Join Date
    May 2012
    Posts
    312
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    11
    Rep Power
    5
    Quote Originally Posted by JustAnotherDay View Post
    But don't you think its a problem with he buyitems() ? Because if ManaAmount = CurrentMana then Amount = 0, therefor it wont buy anything.
    Nah, I will explain. The variable ammount1 saves the ammount of manas you have(makes the difference between the manas you want to buy and the current you have).
    So, your script will keep buying manas as long as
    PHP Code:
    while Amount1 and ManaRefill == true do 
    So all the actions inside this loop will execute as long as you have more than 0 manas (1,2,3...infinite) where infinite is the limit of cash

  7. #7
    Normal User JustAnotherDay's Avatar
    Join Date
    Jun 2012
    Posts
    47
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    13
    Rep Power
    5
    Oh yeah your right, didn't notice that. Anyways, trying with buyitemsupto() and its working so far ^^

  8. #8
    Normal User
    Join Date
    May 2012
    Posts
    312
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    11
    Rep Power
    5
    Quote Originally Posted by JustAnotherDay View Post
    Oh yeah your right, didn't notice that. Anyways, trying with buyitemsupto() and its working so far ^^
    Ok glad it helped but please, take a look here and try to help me aswell
    http://www.tibiaibot.com/forum/showt...his-won-t-work

Posting Permissions

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