Click here to buy some Tibia gold in our shop

Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Tutorial: Efficient potionbuying

  1. #1
    Join Date
    Jan 2008
    Location
    Surahammar, Sweden
    Posts
    113

    Default Tutorial: Efficient potionbuying

    Hello there

    in this tutorial we will look into how to implement a potionbuyer into your script, it is rather easy as long as you got a template to copypaste from, so here goes

    • 1. The script

    A simple script would look somewhat like this:
    Code:
    setPriority ancient scarab:+1
    setSpellkill ancient scarab,exori flam,3
    setmeleekill larva
    setloot 00 0D
    setloot 70 0D
    setLoot E2 0B
    setLoot D8 0B
    setLoot D9 0B
    setLoot D7 0B
    setLoot 3E 03
    setLoot CA 0B
    setLoot 1D 0D
    setloot D1 0B
    move 33042,32668,11
    move 33093,32655,11
    move 33067,32677,11
    move 33091,32683,11
    move 33062,32652,11
    gotoscriptline 0
    First off we have parameters which remains constant (until a reset is requested), such as what monsters will be targetted, how to kill them and what loot to take, then follows the waypoints, and at last we have gotoscriptline 0.

    • 2. Checking potions and walking to city

    Now, what we want the script to do is to return to the city to refill manapotions and/or deposit loot, so we'll need to use an IfTrue statement;
    Code:
    fastExiva _manapotionid = ED 00
    IfTrue ($countitems:{$_manapotionid$}$#number<#45) Goto $nlineoflabel:refill$
    gotoScriptLine 0
    :refill
    move 33119,32674,10
    move 33118,32677,9
    move 33163,32685,9
    move 33164,32685,8
    move 33153,32686,8
    move 33153,32687,7
    The first line gives the variable _manapotionid the value ED 00 (strong manapotion) and the second line checks your opened containers for the value you assigned to _manapotionid, and if you have below 45 potions left, the script will jump to the label :refill.
    If this is false, then it will go back to hunt. If true, the script will follow what's written below :refill, namely waypoints out of the cave.

    • 3. Withdrawing money from bank

    When you're at the bank, you'll need to withdraw money to afford the potions, and by using this template it's pretty easy;
    Code:
    fastExiva _manas = 300
    fastExiva _idcost = 80
    fastExiva _mana = $numericalexp:{$_manas$}-{$countitems:{$_manapotionid$}$}$
    fastExiva _manacost = $numericalexp:{$_mana$}*{$_idcost$}$
    saymessage hi
    waitX 2
    fastExiva > 96 04 $hex-tibiastr:deposit all$
    waitX 1
    fastExiva > 96 04 $hex-tibiastr:yes$
    waitx 1
    sayInTrade withdraw $_manacost$
    waitX 1
    fastExiva > 96 04 $hex-tibiastr:yes$
    waitx 1
    The first four lines assigns values to variables, the first line defines how many potions you're carrying in total, the second line defines what one potion of that type costs (strong manapotion in this case), the third line calculates how many manas you'll need to buy, and the fourth line defines how much it will cost.
    The following banking lines are basic NPC talking, it'll say hi, deposit all the cash you have on you and withdraw the cost of the potions.
    Onwards to the potionbuying!

    • 4. Buying the potions

    Now, to make this actually work as an AFK script, you'll need to have your backpack/bag with backpacks/bags of potions in your backpack slot, and your main backpack/bag in arrowslot. You'll also need to cover the empty space in your backpack/bag with potions, I find worms to be most efficient (do NOT use gold/platinum/crystal coins to fill out the space).
    Okay, so now to the actual buying;
    Code:
    saymessage hi
    waitx 2
    fastExiva > 96 04 $hex-tibiastr:vial$
    waitx 2
    fastExiva > 96 04 $hex-tibiastr:yes$
    waitx 1
    fastExiva > 96 04 $hex-tibiastr:yes$
    fastExiva > 96 04 $hex-tibiastr:yes$
    waitx 2
    fastExiva > 96 04 $hex-tibiastr:trade$
    waitx 2
    fastExiva > 07 00 7A $_manapotionid$ 00 $numbertohex2:{$numericalexp:{$_mana$}/4$}$ 00
    fastExiva > 07 00 7A $_manapotionid$ 00 $numbertohex2:{$numericalexp:{$_mana$}/4$}$ 00
    fastExiva > 07 00 7A $_manapotionid$ 00 $numbertohex2:{$numericalexp:{$_mana$}/4$}$ 00
    fastExiva > 07 00 7A $_manapotionid$ 00 $numbertohex2:{$numericalexp:{$_mana$}/4$}$ 00
    The first few lines greets the NPC and sells the vials you have on you, to make space for new potions.
    Next, the script will bring up the trade window with the NPC, then the script will buy a fourth of the needed potions four times. I made it this way since you can't buy more than 100 potions at once, however, you may edit this to your needs.

    CONTINUES IN NEXT POST
    Last edited by Crille; 12-20-2008 at 06:24.

  2. #2
    Join Date
    Jan 2008
    Location
    Surahammar, Sweden
    Posts
    113

    Default

    • 5. The final script

    The final script has functions that are not explained in this tutorial, but anyway, here it is;
    Code:
    # Script made by Karelazi
    # Special thanks to Erra :)
    # Add Scarab, Larva, Hyaena and Nomad to safelist
    
    # <--------- CHANGE THESE SETTINGS --------->
    # MP = 0C 01, SMP = ED 00, GMP = EE 00
    fastExiva _manapotionid = ED 00
    # How many manas do you have?
    fastExiva _manas = 300
    # How much does 1 potion cost? MP = 50, SMP = 80, GMP = 120
    fastExiva _idcost = 80
    
    onGMpause
    :hunt
    setfollow
    setany
    setPriority ancient scarab:+1
    setSpellkill ancient scarab,exori flam,3
    setmeleekill larva
    setdontretryattacks
    setlootdistance 3
    setloot 00 0D
    setloot 70 0D
    setLoot E2 0B
    setLoot D8 0B
    setLoot D9 0B
    setLoot D7 0B
    setLoot 3E 03
    setLoot CA 0B
    setLoot 1D 0D
    setloot D1 0B
    move 33042,32668,11
    move 33093,32655,11
    move 33067,32677,11
    move 33091,32683,11
    move 33062,32652,11
    setveryfriendly
    setnofollow
    move 33064,32652,10
    setspellkill scarab,exori flam,3
    setmeleekill larva
    move 33067,32653,10
    waitx 2
    fastexiva > 0F 00 78 2B 81 8D 7F 0A 1B 01 01 2A 81 8C 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2B 81 8D 7F 0A 1B 01 01 2A 81 8C 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2B 81 8D 7F 0A 1B 01 01 2A 81 8C 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2B 81 8D 7F 0A 1B 01 01 2A 81 8C 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2B 81 8D 7F 0A 1B 01 01 2A 81 8C 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2B 81 8D 7F 0A 1B 01 01 2A 81 8C 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2B 81 8D 7F 0A 1B 01 01 2A 81 8C 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2B 81 8D 7F 0A 1B 01 01 2A 81 8C 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2B 81 8D 7F 0A 1B 01 01 2A 81 8C 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2B 81 8D 7F 0A 1B 01 01 2A 81 8C 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2B 81 8D 7F 0A 1B 01 01 2A 81 8C 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2B 81 8D 7F 0A 1B 01 01 2A 81 8C 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2B 81 8D 7F 0A 1B 01 01 2A 81 8C 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2B 81 8D 7F 0A 1B 01 01 2A 81 8C 7F 0A 01
    waitx 1
    resetLoot
    setLoot D7 0B
    setLoot 00 0D
    setLoot 70 0D
    setLoot D7 0B
    setLoot 3E 03
    setLoot CA 0B
    setLoot 1D 0D
    setloot D1 0B
    dropLootOnGround 33067,32653,10
    fastexiva > 0F 00 78 2A 81 8C 7F 0A 1B 01 01 2B 81 8D 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2A 81 8C 7F 0A 1B 01 01 2B 81 8D 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2A 81 8C 7F 0A 1B 01 01 2B 81 8D 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2A 81 8C 7F 0A 1B 01 01 2B 81 8D 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2A 81 8C 7F 0A 1B 01 01 2B 81 8D 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2A 81 8C 7F 0A 1B 01 01 2B 81 8D 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2A 81 8C 7F 0A 1B 01 01 2B 81 8D 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2A 81 8C 7F 0A 1B 01 01 2B 81 8D 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2A 81 8C 7F 0A 1B 01 01 2B 81 8D 7F 0A 01
    waitx 1
    fastexiva > 0F 00 78 2A 81 8C 7F 0A 1B 01 01 2B 81 8D 7F 0A 01
    waitx 1
    resetkill
    setspellkill ancient scarab,exori flam,3
    setany
    IfTrue ($countitems:82 19$#number>#0) Goto $nlineoflabel:refill$
    IfTrue ($countitems:{$_manapotionid$}$#number<#45) Goto $nlineoflabel:refill$
    move 33062,32652,11
    gotoScriptLine $nlineoflabel:hunt$
    :refill
    resetkill
    setSpellkill ancient scarab,exori flam,3
    saymessage utana vid
    move 33119,32674,10
    saymessage utani hur
    move 33118,32677,9
    move 33163,32685,9
    setveryfriendly
    setfollow
    setmeleekill larva
    move 33164,32685,8
    move 33153,32686,8
    move 33153,32687,7
    :ankgate
    move 33153,32758,7
    move 33153,32761,7
    move 33153,32761,7
    waitx 1
    IfTrue ($myy$#string=#32760) Goto $nlineoflabel:exiva1$
    gotoscriptline $nlineoflabel:check1$
    :exiva1
    fastexiva > 67
    waitx 1
    :check1
    IfTrue ($myy$#string<>#32761) Goto $nlineoflabel:ankgate$
    fastexiva > 67
    waitx 1
    IfTrue ($myz$#string<>#6) Goto $nlineoflabel:ankgate$
    :ankgate2
    move 33152,32763,6
    move 33155,32766,6
    waitx 1
    saymessage exiva > 67
    waitX 1
    IfTrue ($myz$#string<>#7) Goto $nlineoflabel:ankgate2$
    :bank
    move 33135,32827,7
    IfTrue ($myy$#string=#32827) Goto $nlineoflabel:go3$
    Gotoscriptline $nlineoflabel:bank$
    saymessage exiva > 65
    :go3
    move 33135,32823,6
    IfTrue ($countitems:{$_manapotionid$}$#number<#45) Goto $nlineoflabel:bankmanas$
    IfTrue ($countitems:82 19$#number>#0) Goto $nlineoflabel:banksofts$
    :banksofts
    saymessage hi
    waitX 2
    fastExiva > 96 04 $hex-tibiastr:deposit all$
    waitX 1
    fastExiva > 96 04 $hex-tibiastr:yes$
    waitx 1
    fastExiva > 96 04 $hex-tibiastr:withdraw 10500$
    waitX 1
    fastExiva > 96 04 $hex-tibiastr:yes$
    Gotoscriptline $nlineoflabel:goboat$
    :bankmanas
    # Calculates how many manas you're gonna need and how much it costs
    fastExiva _mana = $numericalexp:{$_manas$}-{$countitems:{$_manapotionid$}$}$
    fastExiva _manacost = $numericalexp:{$_mana$}*{$_idcost$}$
    saymessage hi
    waitX 2
    fastExiva > 96 04 $hex-tibiastr:deposit all$
    waitX 1
    fastExiva > 96 04 $hex-tibiastr:yes$
    waitx 1
    sayInTrade withdraw $_manacost$
    waitX 1
    fastExiva > 96 04 $hex-tibiastr:yes$
    waitx 1
    move 33131,32817,6
    move 33131,32815,5
    move 33131,32813,5
    saymessage hi
    waitx 2
    fastExiva > 96 04 $hex-tibiastr:vial$
    waitx 2
    fastExiva > 96 04 $hex-tibiastr:yes$
    waitx 1
    fastExiva > 96 04 $hex-tibiastr:yes$
    fastExiva > 96 04 $hex-tibiastr:yes$
    waitx 2
    fastExiva > 96 04 $hex-tibiastr:trade$
    waitx 2
    fastExiva > 07 00 7A $_manapotionid$ 00 $numbertohex2:{$numericalexp:{$_mana$}/4$}$ 00
    fastExiva > 07 00 7A $_manapotionid$ 00 $numbertohex2:{$numericalexp:{$_mana$}/4$}$ 00
    fastExiva > 07 00 7A $_manapotionid$ 00 $numbertohex2:{$numericalexp:{$_mana$}/4$}$ 00
    fastExiva > 07 00 7A $_manapotionid$ 00 $numbertohex2:{$numericalexp:{$_mana$}/4$}$ 00
    waitx 1
    move 33131,32817,6
    move 33134,32818,6
    IfTrue ($countitems:82 19$#number>#0) Goto $nlineoflabel:banksofts$
    move 33137,32815,6
    move 33139,32815,7
    Gotoscriptline $nlineoflabel:back$
    :goboat
    move 33135,32827,7
    move 33084,32876,7
    move 33084,32878,6
    move 33092,32884,6
    fastExiva > A2 $hex-idofname:Captain Sinbeard$
    waitx 2
    saymessage hi
    waitX 2
    fastExiva > 96 04 $hex-tibiastr:venore$
    waitX 1
    fastExiva > 96 04 $hex-tibiastr:yes$
    waitx 1
    move 32953,32050,6
    move 32952,32108,6
    sayMessage hi
    waitX 2
    :softs
    fastExiva > 96 04 $hex-tibiastr:soft boots$
    waitX 1
    fastExiva > 96 04 $hex-tibiastr:yes$
    IfTrue ($countitems:82 19$#number>#0) Goto $nlineoflabel:softs$
    move 32954,32041,6
    move 32955,32023,6
    fastExiva > A2 $hex-idofname:Captain Fearless$
    waitx 3
    sayMessage hi
    waitX 2
    fastExiva > 96 04 $hex-tibiastr:ankrahmun$
    waitX 1
    fastExiva > 96 04 $hex-tibiastr:yes$
    waitx 1
    move 33084,32878,6
    move 33084,32876,7
    :back
    move 33135,32827,7
    :ankgate3
    move 33153,32770,7
    move 33153,32766,7
    waitX 1
    IfTrue ($myz$#string<>#6) Goto $nlineoflabel:ankgate3$
    waitx 1
    :ankgate4
    move 33153,32762,6
    waitx 1
    move 33153,32759,7
    waitX 1
    IfTrue ($myz$#string<>#7) Goto $nlineoflabel:ankgate4$
    waitx 1
    move 33154,32687,7
    saymessage utana vid
    move 33153,32686,8
    move 33163,32684,8
    move 33164,32684,9
    saymessage utani hur
    move 33119,32677,9
    move 33118,32676,10
    move 33064,32652,10
    move 33064,32653,10
    move 33062,32652,11
    gotoScriptLine $nlineoflabel:hunt$
    That concludes this tutorial, and I hope you've learned what I'm trying to teach
    Last edited by Crille; 12-20-2008 at 05:07.

  3. #3
    Join Date
    Jan 2007
    Location
    New Zealand
    Posts
    94

    Default

    Ty for this it will help alot of people xD

    (\(\
    (>'.')
    (~(")(")
    BoO!

    New Zealand Represent.

  4. #4
    Join Date
    Jan 2008
    Location
    Surahammar, Sweden
    Posts
    113

    Default

    got stickied pretty fast, haha

  5. #5
    Join Date
    Jun 2008
    Location
    Botting in a cave near YOU
    Posts
    4

    Default

    Great tutorial!

  6. #6
    Join Date
    Feb 2007
    Location
    Carlin
    Posts
    6

    Default

    BEWARE OF CRILLE!
    HE GOT A T-SHIRT IRL WITH HIS TIBIA CHARACTER NAME ON. XDDDDDDDDDDDDDDDDDDDDDDDDd
    Marissa <3

  7. #7
    Join Date
    Jan 2008
    Location
    Surahammar, Sweden
    Posts
    113

    Default

    and I know you guys want it

  8. #8
    Join Date
    Sep 2007
    Location
    The netherlands.
    Posts
    47

    Default

    Quote Originally Posted by Crille View Post
    Hello there

    Now, to make this actually work as an AFK script, you'll need to have your backpack/bag with backpacks/bags of potions in your backpack slot, and your main backpack/bag in arrowslot. You'll also need to cover the empty space in your backpack/bag with potions, I find worms to be most efficient (do NOT use gold/platinum/crystal coins to fill out the space).
    Okay, so now to the actual buying;
    I dont really get what you mean with this, for example:

    You got your bp with more backpacks in your bpslot. You got 16 bps in your bp so you will need to fill 4slots (normal bp) with worms?

  9. #9
    Join Date
    Jan 2008
    Location
    Surahammar, Sweden
    Posts
    113

    Default

    no, you just put worms in the empty spaces

  10. #10
    Join Date
    Sep 2006
    Posts
    9

    Default

    hightech script, nice

Page 1 of 3 123 LastLast

Posting Permissions

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