Results 1 to 8 of 8

Thread: Help with an Useful Action for paladins!

  1. #1
    Normal User
    Join Date
    Jun 2013
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    4

    Help with an Useful Action for paladins!

    Hello!
    I was trying to simplify my script of withdrawing and buying correct number of spears depending of my cap.

    What I did was:

    1 - Inside my setup :
    PHP Code:
    ExtraCap 100
    SpearType 
    "Royal Spear"
    SpearPrice 15
    SpearWeight 
    25
    MaxSpear 
    = (cap ExtraCap) / SpearWeight 
    2 - Inside my Bank Action
    PHP Code:
    Money MaxSpear weaponamount

    npcsay
    ("hi")
    npcsay("withdraw "..Money)
    npcsay("yes"
    3 - Inside my Shop Action
    PHP Code:
    npcsay("hi")
    npcsay("trade")
    buyitemsupto(SpearTypeMaxSpear
    And EVERYTHING Works, I found it was a very attractive action for paladins, BUT, I got a problem and that's when you enter.
    I want to know how to make the variable 'Money' never go a fractionary number.
    The Spear Shop Npc wroked fine, it buy the right amount of spears,
    But my char is saying like "withdraw 400.8" and the NPC doesn't recognize it as 400 :/

    Help me to find out how to make the variable 'Money" always result in a integer number!
    Thank yo!
    Last edited by edurvd; 06-11-2013 at 12:36 PM.

  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
    Code:
    Money = math.floor(MaxSpear - weaponamount)

  3. #3
    Normal User
    Join Date
    Jun 2013
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    4
    Didn't Work :/
    I want to change the "1000" for a exact amount.
    Thanks for trying to help anyways!

    That's my Whole Banking Action:
    PHP Code:
    Ammo 1000
    RefillMp 
    = (MaxMp itemcount(Mp)) * MpPrice
    RefillHp 
    = (MaxHp itemcount(Hp)) * HpPrice

    Money 
    Ammo RefillMp RefillHp

    if Money 0 then
    wait
    (500)
    npcsay("hi")
    wait(400)
    npcsay("deposit all")
    wait(400)
    npcsay("yes")
    wait(400)
    npcsay("withdraw "..Money)
    wait(400)
    npcsay("yes")
    wait(400)
    npcsay("balance")
    wait(400)
    end 
    Last edited by edurvd; 06-11-2013 at 06:12 PM.

  4. #4
    iBot User
    Join Date
    Jun 2012
    Posts
    517
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    4 Post(s)
    Reputation
    132
    Rep Power
    7
    PHP Code:
    Ammo AmmoToBuy ammoamount 
    AmmoToBuy = amount of items that you want buy
    Last edited by garkstal13; 06-11-2013 at 06:19 PM.

  5. #5
    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
    On setup do like that:
    Code:
    MaxSpear = math.floor((cap - ExtraCap) / SpearWeight)
    And your action:
    Code:
    Ammo = MaxSpear - weaponamount
    RefillMp = (MaxMp - itemcount(Mp)) * MpPrice
    RefillHp = (MaxHp - itemcount(Hp)) * HpPrice
    
    Money = math.ceil((Ammo + RefilMp + RefillHp) / 1000) * 1000
    
    if Money > 0 then
    	say("hi")
    	wait(1000, 2000)
    	npcsay("deposit all")
    	wait(800, 1300)
    	npcsay("yes")
    	wait(800, 1300)
    	npcsay("withdraw "..Money)
    	wait(800, 1300)
    	npcsay("yes")
    	wait(800, 1300)
    	npcsay("balance")
    	wait(800, 1300)
    end

  6. #6
    Normal User
    Join Date
    Jun 2013
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    4
    Still doesn't work :/ The bot simply ignore the bank Action ;/

    Nvm dude, I really would like to thank you to trying to help me but I am placing Ammo = 1000 and everything is just working as I wanted.
    The Setup
    PHP Code:
    MaxSpear = (cap ExtraCap) / SpearWeight 
    Works perfectly. So I placed a amount of gold and deposit the rest afterwards and everything is going very well.
    Last edited by edurvd; 06-12-2013 at 10:09 PM.

  7. #7
    Premium User Eldar's Avatar
    Join Date
    Apr 2013
    Location
    Poland
    Posts
    1,335
    Mentioned
    37 Post(s)
    Tagged
    2 Thread(s)
    Quoted
    62 Post(s)
    Reputation
    159
    Rep Power
    7
    Code:
    Money = positive(MaxSpear * SpearPrice)

  8. #8
    Normal User
    Join Date
    Jun 2013
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    4
    Finally got this stuff working!!!
    Thank you guys so much!

    I made it works with your guys help like this:
    Setup:
    PHP Code:
    BuySpear math.floor((cap ExtraCap) / SpearWeight
    Bank Action:
    PHP Code:
    Ammo positive(BuySpear SpearPrice
    Spear Shop Action:
    PHP Code:
    buyitems(SpearTypeBuySpear

Posting Permissions

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