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

Post Reply 
 
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ayuda Auto Enchant
Author Message
Aggresivnes Offline
Gremlin
*

Posts: 7
Joined: Jan 2014
Reputation: 0
Version: 1.4.2.132
Post: #1
Ayuda Auto Enchant

hola tengo un problema cuando pongo el auto enchant pongo todo los datos y le doy para que empiese a enchantar y solo enchanta 2 veses y se detiene y tengo que volver a darle para que enchante alguno sabe la solucion? este es mi enchant.lua

Quote:-- SCRIPT CONFIGURATION!

item_name = "Draconic Leather Boots"
enchant_name = "Blessed Scroll: Enchant Armor (Grade S)"
blessed_enchant_name = "Blessed Scroll: Enchant Armor (Grade S)"
max_enchant = 15
max_safe_enchant = 1
delay = 5

-- 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, 20)
else
enchant = getItemByName(enchant_name, 20)
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(200)
end

if ( enchantResult() == Enchant.ENCHANT_SUCCESS ) then
Sleep ( 500 ) -- 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+1)
Sleep ( 500 ) -- sleep so item data is updated
registerFailure ( item.Enchanted + 1)
end
printStatistics()
end
ShowToClient("Enchant", "Enchant script finished")
printStatistics()
02-01-2014 05:16 AM
Find all posts by this user Quote this message in a reply
Aggresivnes Offline
Gremlin
*

Posts: 7
Joined: Jan 2014
Reputation: 0
Version: 1.4.2.132
Post: #2
RE: Ayuda Auto Enchant

nadie sabe la solucion? si responden me serviria de mucho gracias [/align]
02-02-2014 05:00 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  ayuda general protection fault Aggresivnes 1 3,316 09-06-2021 23:06 PM
Last Post: markos2515
  Consulta/Ayuda shoeddy 0 1,440 05-18-2021 09:15 AM
Last Post: shoeddy
Star AYUDA CONFIGURARRR alaniz 0 1,636 01-02-2021 03:06 AM
Last Post: alaniz
  Ayuda para abrir mas de 3 cuentas kairos30 7 8,550 06-04-2020 05:36 AM
Last Post: studiotan
  Ayuda por favor ? me tira critical error lauchita92 0 1,807 10-30-2019 16:25 PM
Last Post: lauchita92
  Ayuda! Has sido desconectado del servidor madbytes 2 3,254 04-19-2018 20:28 PM
Last Post: madbytes
  Necesito ayuda porque me da critical error yigi1 5 5,820 01-26-2018 14:32 PM
Last Post: sousseky
Information Ayuda.. Load: general Error: call to loadLibrary N4N023 13 13,774 10-27-2017 01:19 AM
Last Post: smedina2005
Information (AYUDA) ERROR! Su cliente contiene archivos incorrectos Sustainer 0 2,117 10-13-2016 00:55 AM
Last Post: Sustainer
F.A.Q. Ayuda con un script Pls vannsito 0 2,351 07-23-2016 01:02 AM
Last Post: vannsito



User(s) browsing this thread: