L2Tower Discord Let's keep the community alive with discord. Discussions about plugins and scripts L2Tower Discord

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Auto Enchant Script
Author Message
sone78 Offline
Elpy
*

Posts: 4
Joined: Feb 2013
Reputation: 0
Version: 1.4.3.143
Post: #1
Auto Enchant Script

Hi, can someone help me. The auto enchant script works fine until item fails then it stops.

Code:
function enchantResult()
  return GetEnchantManager():getLastResult()
end

function getItemByName(name, maxenchant)
    invList = GetInventory();
    for item in invList.list do
        if item.Name == name and item.Enchanted < maxenchant then
            -- ShowToClient("ITEM", item.Name .. " (ID: " .. item.displayId  .. ")");
            return item
        end
    end
end

maxenchant = 20
GetEnchantManager():setDelay(200)

while true do
    -- weapon = getItemByName("Draconic Leather Boots", maxenchant)
    -- enchant = getItemByName("Scroll: Enchant Armor (Grade S)", maxenchant)
    Sleep ( 1000 ) -- sleep so item data is updated
    weapon = getItemByName("Draconic Leather Boots", maxenchant)
    enchant = getItemByName("Scroll: Enchant Armor (Grade S)", maxenchant)

    if ( weapon.Enchanted > maxenchant ) then
        ShowToClient("Enchant:", "Reached desired enchant")
        break
    end

    GetEnchantManager():setEnchantId(enchant.objectId)
    GetEnchantManager():setItemId(weapon.objectId)
    GetEnchantManager():Enchant()
    -- ShowToClient(">>>>",  "Waiting for result...");
    while ( enchantResult() == Enchant.ENCHANT_PENDING ) do
        Sleep(200)
    end
    if ( enchantResult() == Enchant.ENCHANT_SUCCESS ) then    
        Sleep ( 100 ) -- sleep so item data is updated
        weapon = GetInventory():FindById(weapon.objectId)
        ShowToClient("Enchant",  weapon.Name .. " is now +" .. weapon.Enchanted);
    end
end
(This post was last modified: 11-25-2014 12:23 PM by sone78.)
11-25-2014 12:22 PM
Find all posts by this user Quote this message in a reply
sone78 Offline
Elpy
*

Posts: 4
Joined: Feb 2013
Reputation: 0
Version: 1.4.3.143
Post: #2
RE: Auto Enchant Script

Some help plx?
11-26-2014 00:07 AM
Find all posts by this user Quote this message in a reply
Hebdzik Offline
Tester

Posts: 1,235
Joined: Aug 2011
Reputation: 265
Version: 1.4.3.143
Post: #3
RE: Auto Enchant Script

by default when you update l2tower you get 2 scripts to enchant ites, they dont works for you?

Warning hammer!!! Use Search before you post something
If i hellp you, you can thx me by +1 Reputation
[Image: U63SU]
11-26-2014 10:01 AM
Find all posts by this user Quote this message in a reply
sone78 Offline
Elpy
*

Posts: 4
Joined: Feb 2013
Reputation: 0
Version: 1.4.3.143
Post: #4
RE: Auto Enchant Script

Its the same they work, until item fails. Then it stops and i have to restart the script to start again.
11-26-2014 17:20 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Auto Augment - Services / AIO NPC. 2pho3nix 11 17,647 07-27-2020 09:37 AM
Last Post: z3renity
  [Need Help] Enchant Script nvnhathuy 1 5,290 03-03-2017 20:07 PM
Last Post: deivuzas1
  Help, with "Auto" De-level script JavaFan 3 3,122 11-12-2015 17:18 PM
Last Post: JavaFan
  Get skill enchant level raid1141 1 4,161 10-15-2015 14:57 PM
Last Post: raid1141
  [HELP] Auto Saved DC ! nikevers 0 2,001 07-28-2015 00:32 AM
Last Post: nikevers
  AUTO RES ACCEPT sonsfully 17 11,357 07-15-2015 19:59 PM
Last Post: Maveco
  Auto Accept Res Not working aywka 32 16,438 07-10-2015 08:16 AM
Last Post: TheQQmaster
Information pet auto attack alexanderkalm 0 2,658 07-09-2015 06:14 AM
Last Post: alexanderkalm
  WTB Auto accept mail scripts or plugins king200527 0 2,241 07-07-2015 11:39 AM
Last Post: king200527
  Not workl: Auto Resurrection On! . erickalisetc 9 6,546 05-27-2015 07:37 AM
Last Post: rORUMI



User(s) browsing this thread: 1 Guest(s)