Jump to content

Recommended Posts

Posted

Hey guys.
 
I`ve problem with L2 Tower and enchanting by this way. When i start the script, my item is enchanted once or twice, then it stopping, and I need to spam the ">" to enchant my item. Any solution what I have to change in this script?
 
Here is the script:

 

-- SCRIPT CONFIGURATION!
 
item_name = "Nightmarish Tattoo"
enchant_name = "Scroll: Enchant Armor (Grade A)"
blessed_enchant_name = "Blessed Scroll: Enchant Weapon (Grade S)"
max_enchant = 25
max_safe_enchant = 25
delay = 0
 
-- END OF SCRIPT CONFIGURATION
 
-- HELPER FUNCTIONS
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
            return item
        end
    end
end
 
stats = {}
 
function registerSuccess(base)
    if stats[base] == nil then
        stats[base] = { success = 0, failure = 0 }
    end
    stats[base].success = stats[base].success + 1
end
 
function registerFailure(base)
    if stats[base] == nil then
        stats[base] = { success = 0, failure = 0 }
    end
    stats[base].failure = stats[base].failure + 1
end
 
function printStatistics()
    for i,v in ipairs(stats) do
        ShowToClient("Enchant", "[" ..     i - 1 .. "->" .. i .. "] Rate: success: " .. v.success .. " / fail: " .. v.failure .." (" .. ( v.success  * 100 )/ ( v.success + v.failure ) .. "%)")
    end
end
 
-- MAIN LOOP!
 
while true do
    -- find item for enchanting
    item = getItemByName(item_name, max_enchant)
    if ( item == nil ) then
        ShowToClient("Enchant", "Out of items" )
        break
    end
    -- find proper enchant scroll
    enchant = nil
    if ( item.Enchanted >= max_safe_enchant ) then
        enchant = getItemByName(blessed_enchant_name, 5)
    else
        enchant = getItemByName(enchant_name, 5)
    end
 
    if ( enchant == nil ) then
        ShowToClient("Enchant", "Out of enchants")
        break
    end
 
     GetEnchantManager():setDelay(delay)
    GetEnchantManager():setEnchantId(enchant.objectId)
    GetEnchantManager():setItemId(item.objectId)
    GetEnchantManager():Enchant()
 
    while ( enchantResult() == Enchant.ENCHANT_PENDING ) do
        Sleep(0)
    end
 
    if ( enchantResult() == Enchant.ENCHANT_SUCCESS ) then    
        Sleep ( 0 ) -- sleep so item data is updated
        item = GetInventory():FindById(item.objectId)
        ShowToClient("Enchant",  item.Name .. " is now +" .. item.Enchanted);
        registerSuccess ( item.Enchanted )
    elseif ( enchantResult() == Enchant.ENCHANT_FAILURE ) then
        ShowToClient("Enchant",  item.Name .. " failed on " .. item.Enchanted .. " -> " .. item.Enchanted +4)
        Sleep ( 0 ) -- sleep so item data is updated
        registerFailure ( item.Enchanted +4 )
    end
    printStatistics()
end
ShowToClient("Enchant", "Enchant script finished")
printStatistics()

Posted

blessed_enchant_name = "Blessed Scroll: Enchant Weapon (Grade S)"

max_enchant = 25

max_safe_enchant = 25

 

....

And what? I don`t use blessed scrolls there so It dont need to be correct. Anyone have suggestion how to fix it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • For exact same reason - there were accusation that I scammed. When was it? 2016? But in that time, admins actually didn't listen. I got banned, then unbaned (when I prooved I've refunded) but I was trash talking to mods. When few months later same shit happened, Grisom (?) old global mod, banned me anyway. You can read somewhere on forum how I was shitting on him for doing that (from other account because original account was banned) - which was banned too. He is not here anymore I think. Back in the days I was well know for not carring that much if I was talking to mod or admin, I didn't hold my tongue. Now You know. Just like You know - if I delay, I deliver or refund. I'm not a scammer, even if my old time haterz love to repeat themselfs like mantra. I don't care.
    • Okay I respect that but why is your other account banned?   I don't think this happened just because you delayed somebodys work even in 2012
    • Do You understand the fact, I won't scam anyone? Can You grasp such idea?  Second of all, if a random restaurant on Google Maps has 599 positive reviews and few negative ones with 4,8* score, do You ask Google to block it's profile and burn the place down? No? Then why the fuck You are crying about my random delays? If someone can't get a CUSTOM DESIGN on time, I refund. I'm not 16  y.o. anymore. I don't make living out of this L2 bullshit. Never did. Since 2012 I've made shit tons of projects. How many delays did I have? 12? 15? Out of hundrets of projects. Calm Your tits please. If I would actually take 4k euro and NOT deliver and NOT refund - admins can ban me. So don't compare me to Simple. And just so You know, Celestine sent me customers, so it's not like I've worked with him on his account all the time. That's another thing You won't understand. I won't waste anymore time on You and any other cunt who never was my customer but is bitching just because he has nothing better to do in his life. You don't like my work? Hove along, I don't give a shit. 
    • So he's like unsimple you would say? Cherry picking who's getting scammed.   Deliver 5 projects, don't deliver/delay the other 2 projects. Of course he won't scam you because he know what's gonna happen after since he's dealing with the admin himself.
  • Topics

×
×
  • Create New...