Signup Now
Results 1 to 8 of 8
  1. #1
    Free User
    Join Date
    Jul 2014
    Posts
    83
    Reputation
    20
    Rep Power
    20

    Improve function depositerbank()

    Its just a small think, just add a check balance after withdraw money to Lucas lib.

    EDIT:

    -- @name	depositerbank
    -- [MENTION=28084]desc[/MENTION] Deal with talk operations to deposit and withdraw the money needed for supplies.
    -- @param category The supply category to check. (optional)
    -- @param extragold The an extra amount of gold to withdraw. (optional)
    -- @param logoutifnocash If set to true, it will make your character logout if you have no cash in the bank. (optional)
    -- @returns boolean

    function depositerbank(supplycategory, extragold, logoutifnocash)
    extragold = extragold or 0

    local npccount = 0
    foreach creature m 'ns' do
    if m.dist <= 3 then
    npccount = npccount + 1
    end
    end

    if npccount == 0 then
    printerror('Unable to find a NPC close to you')
    return
    end

    local currentnpcmsg = $lastnpcmsg
    local tries = 0
    local maxtries = math.random(3, 5)

    repeat
    if not ischannel('NPCs') then
    say('hi')
    else
    npcsay('hi')
    end
    local t = $timems
    while $timems - t <= 2500 and currentnpcmsg == $lastnpcmsg do wait(100) end

    tries = tries + 1
    until $lastnpcmsg ~= currentnpcmsg or tries > maxtries

    npcsay('deposit all') wait(500,1000)
    npcsay('yes') wait(500,1000)

    -- check balance
    repeat
    npcsay('balance')
    until waitmessage('', 'Your account balance is %d+', 2000, true, MSG_NPC)

    -- withdraw needed money
    local towithdraw = moneytowithdraw(supplycategory) + extragold
    if towithdraw == 0 then
    return
    end

    local success = false
    repeat
    if $balance >= towithdraw then
    repeat
    npcsay('withdraw '..towithdraw) wait(500,1000)
    npcsay('yes')

    success = waitmessage('', 'Here you are, '..towithdraw..' gold. Please let me know if there is something else I can do for you.', 2000, false, MSG_NPC)
    until success
    else
    if (logoutifnocash) then
    printerror('Your character has logged out because you don\'t have enough money in bank.')
    xlog(true)

    setcavebot('off')
    return
    end
    playsoundflash('monster.wav') wait(1000)
    end
    until success
    end
    Last edited by firiots; 10-15-2014 at 12:39 AM.

  2. #2
    Moderator Raphael's Avatar
    Join Date
    Dec 2013
    Location
    raphseller.com
    Posts
    2,437
    Reputation
    309
    Rep Power
    29
    wat
    ??

  3. #3
    Free User
    Join Date
    Aug 2014
    Posts
    248
    Reputation
    26
    Rep Power
    20
    He is saying the action is this way:

    Hi
    deposit all
    yes
    balance
    withdraw (repots)

    and this make you go to spawn with HUD's balance outdated...

    For example you deposit and say balance the HUD shows 10k and then you withdraw 5k to spend in potions, the HUD will still show 10k but when you come back to bank you actually have 5k

  4. #4
    Banned
    Join Date
    Aug 2014
    Posts
    315
    Reputation
    18
    Rep Power
    0
    No he say that

    Hi
    deposit all
    balance
    withdraw xxxx
    balance

  5. #5
    Free User
    Join Date
    Jul 2014
    Posts
    83
    Reputation
    20
    Rep Power
    20
    Quote Originally Posted by Culas View Post
    He is saying the action is this way:

    Hi
    deposit all
    yes
    balance
    withdraw (repots)

    and this make you go to spawn with HUD's balance outdated...

    For example you deposit and say balance the HUD shows 10k and then you withdraw 5k to spend in potions, the HUD will still show 10k but when you come back to bank you actually have 5k
    Quote Originally Posted by osiris ra View Post
    No he say that

    Hi
    deposit all
    balance
    withdraw xxxx
    balance

    Exactly, Its just get balance to check if char has money for potions, but dont check after the withdraw.

    ps: please Raphael, change your avatar, it always makes me think your judging me

  6. #6
    Moderator Raphael's Avatar
    Join Date
    Dec 2013
    Location
    raphseller.com
    Posts
    2,437
    Reputation
    309
    Rep Power
    29
    Wait, are you suggesting it says 'balance' before and after withdrawing?
    To be honest, saying it before withdrawing is just plain retard, you could just check for a 'You don't have enough money' msg to know if you have enough money or not and say it after that, to have a updated balance while hunting.

    PS: That's because I am judging everyone.

  7. #7
    Free User
    Join Date
    Aug 2014
    Posts
    287
    Reputation
    29
    Rep Power
    20
    im not sure what this means updated while hunting but to have the balance said after bank done is easy

  8. #8
    Free User
    Join Date
    Jul 2014
    Posts
    83
    Reputation
    20
    Rep Power
    20
    Quote Originally Posted by Raphael View Post
    Wait, are you suggesting it says 'balance' before and after withdrawing?
    To be honest, saying it before withdrawing is just plain retard, you could just check for a 'You don't have enough money' msg to know if you have enough money or not and say it after that, to have a updated balance while hunting.

    PS: That's because I am judging everyone.
    He already say before withdraw to check if has enough money to supplies (it's already on Lucas lib), what I'm saying is check the real balance, after withdraw money for supplies, because it's what all scripters do.

 

 

Posting Permissions

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