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

Thread Closed 
 
Thread Rating:
  • 20 Vote(s) - 3.1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Auto item enchant problem [Video]
Author Message
AdioZ Offline
VIP Member
***

Posts: 35
Joined: Mar 2012
Reputation: -11
Version: 1.4.1.118
Post: #1
Question Auto item enchant problem [Video]

Hey, i'm having problem with auto item enchant script. I'm currently playing in http://l2accident.eu/ It's c6 pvp custom server (java). Problem: Then I start script and it enchants once or twice and stops, I must turn it off and turn it on again to enchant from+2 to+3 and so on! wppw offered auto enchant, but problem stays...
Also made video if you don't understand my poor English Smile Exclamation
Youtube HD Video Smile



    LUA Programming
-- SCRIPT CONFIGURATION!
 
item_name = "Sword of Miracles"
--item_name = "Sword of Miracle"
enchant_name = "Scroll: Enchant Weapon (Grade A)"
--enchant_name = "Scroll: Enchant Weapon (Grade A)"
blessed_enchant_name = "Scroll: Enchant Weapon (Grade A)"
max_enchant = 15
max_safe_enchant = 3
delay = 100
 
-- 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()



Help ME!
(This post was last modified: 06-21-2012 13:51 PM by Fox.)
06-13-2012 12:21 PM
Find all posts by this user
krazybosnian Offline
Gremlin
*

Posts: 9
Joined: Jan 2012
Reputation: 1
Version: 1.4.1.118
Post: #2
RE: Auto item enchant problem [Video]

(06-13-2012 12:21 PM)AdioZ Wrote:  Hey, i'm having problem with auto item enchant script. I'm currently playing in http://l2accident.eu/ It's c6 pvp custom server (java). Problem: Then I start script and it enchants once or twice and stops, I must turn it off and turn it on again to enchant from+2 to+3 and so on! wppw offered auto enchant, but problem stays...
Also made video if you don't understand my poor English Smile Exclamation
Youtube HD Video Smile



PHP Code:
-- SCRIPT CONFIGURATION!
 
item_name "Sword of Miracles"
--item_name "Sword of Miracle"
enchant_name "Scroll: Enchant Weapon (Grade A)"
--enchant_name "Scroll: Enchant Weapon (Grade A)"
blessed_enchant_name "Scroll: Enchant Weapon (Grade A)"
max_enchant 15
max_safe_enchant 
3
delay 
100
 
-- END OF SCRIPT CONFIGURATION
 
-- HELPER FUNCTIONS
function enchantResult()
  return 
GetEnchantManager():getLastResult()
end
 
function getItemByName(namemaxenchant)
    
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 0failure }
    
end
    stats
[base].success stats[base].success 1
end
 
function registerFailure(base)
    if 
stats[base] == nil then
        stats
[base] = { success 0failure }
    
end
    stats
[base].failure stats[base].failure 1
end
 
function printStatistics()
    for 
i,v in ipairs(stats) do
        
ShowToClient("Enchant""[" ..     .. "->" .. .. "] 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_namemax_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_name20)
    else
        
enchant getItemByName(enchant_name20)
    
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() 

Help ME!

You are sure the enchant scroll is not called

Scroll: Enchant Weapon (A-grade) ?
06-19-2012 22:28 PM
Find all posts by this user
AdioZ Offline
VIP Member
***

Posts: 35
Joined: Mar 2012
Reputation: -11
Version: 1.4.1.118
Post: #3
RE: Auto item enchant problem [Video]

(06-19-2012 22:28 PM)krazybosnian Wrote:  
(06-13-2012 12:21 PM)AdioZ Wrote:  Hey, i'm having problem with auto item enchant script. I'm currently playing in http://l2accident.eu/ It's c6 pvp custom server (java). Problem: Then I start script and it enchants once or twice and stops, I must turn it off and turn it on again to enchant from+2 to+3 and so on! wppw offered auto enchant, but problem stays...
Also made video if you don't understand my poor English Smile Exclamation
Youtube HD Video Smile



PHP Code:
-- SCRIPT CONFIGURATION!
 
item_name "Sword of Miracles"
--item_name "Sword of Miracle"
enchant_name "Scroll: Enchant Weapon (Grade A)"
--enchant_name "Scroll: Enchant Weapon (Grade A)"
blessed_enchant_name "Scroll: Enchant Weapon (Grade A)"
max_enchant 15
max_safe_enchant 
3
delay 
100
 
-- END OF SCRIPT CONFIGURATION
 
-- HELPER FUNCTIONS
function enchantResult()
  return 
GetEnchantManager():getLastResult()
end
 
function getItemByName(namemaxenchant)
    
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 0failure }
    
end
    stats
[base].success stats[base].success 1
end
 
function registerFailure(base)
    if 
stats[base] == nil then
        stats
[base] = { success 0failure }
    
end
    stats
[base].failure stats[base].failure 1
end
 
function printStatistics()
    for 
i,v in ipairs(stats) do
        
ShowToClient("Enchant""[" ..     .. "->" .. .. "] 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_namemax_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_name20)
    else
        
enchant getItemByName(enchant_name20)
    
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() 

Help ME!

You are sure the enchant scroll is not called

Scroll: Enchant Weapon (A-grade) ?

Its interlude man...Look at video im enchanting, but after 2+ it stops, then i must start the script again...
06-21-2012 13:42 PM
Find all posts by this user
ChinLao Offline
Gremlin
*

Posts: 5
Joined: Dec 2011
Reputation: 0
Version: 1.4.2.133
Post: #4
RE: Auto item enchant problem [Video]

Do you found a problem?

I got a problem on c6 when blessing with Blessed scroolls, and item burns not to +0, but to +4, then script stops..
(This post was last modified: 08-03-2012 23:21 PM by ChinLao.)
08-03-2012 23:14 PM
Find all posts by this user
feliperigo Offline
Elpy
*

Posts: 2
Joined: Apr 2012
Reputation: 0
Version: 1.4.1.112
Post: #5
RE: Auto item enchant problem [Video]

same problem any help? enchant auto to +1 +2 and stop, if restart script only enchant one time.
08-05-2012 11:06 AM
Find all posts by this user
Thread Closed 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Problem with High Five client newlifeform 0 1,684 09-02-2022 17:36 PM
Last Post: newlifeform
  Auto Augment - Services / AIO NPC. 2pho3nix 11 18,385 07-27-2020 09:37 AM
Last Post: z3renity
  Script item using before hitting mob TMBlack 0 1,424 01-29-2019 12:24 PM
Last Post: TMBlack
  L2 Zaken Classic problem kvourg13 0 2,138 10-07-2018 05:29 AM
Last Post: kvourg13
  problem with the programm killbill 1 2,245 11-15-2017 02:54 AM
Last Post: kbelinh0
Sad License. problem jonathanf1 1 3,348 04-19-2017 23:07 PM
Last Post: Jonathan6666
  [Need Help] Enchant Script nvnhathuy 1 5,553 03-03-2017 20:07 PM
Last Post: deivuzas1
  Problem... Critical error [c6 server] Nasif 2 4,553 10-18-2016 13:48 PM
Last Post: Verb
  AntiBot problem SaintRose 2 4,094 10-05-2016 22:27 PM
Last Post: Vinter
  Autofarm Script repeat without condition problem. either 3 4,865 05-25-2016 01:00 AM
Last Post: TheQQmaster



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