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

Thread Closed 
 
Thread Rating:
  • 4 Vote(s) - 2.75 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem z/with autoenchant
Author Message
mistrz20 Offline
Gremlin
*

Posts: 5
Joined: Nov 2011
Reputation: 0
Version: 1.4.1.93
Post: #1
Problem z/with autoenchant

Mam prosbe do was, mogl by ktos przeszukac gdzie mam blad w scripcie? Z gory thx / Can someone check where i have mistake in my script. Thx
-- SCRIPT CONFIGURATION!

item_name = "Draconic Bow"
enchant_name = "Scroll: Enchant Weapon (S-Grade)"
blessed_enchant_name = "Blessed Scroll: Enchant Weapon (S-Grade)"
max_enchant = 10
max_safe_enchant = 4
delay = 1300

-- END OF SCRIPT CONFIGURATION

-- HELPER FUNCTIONS
function enchantResult()
return GetEnchantManager():getLastResult()
end

function getItemByName("Draconic Bow", 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("Draconic Bow", 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 Scroll: Enchant Weapon (S-Grade)", 10)
else
enchant = getItemByName("Blessed Scroll: Enchant Weapon (S-Grade)", 10)
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

albo ktos moze by napisal nowy na draconic bowa i blessed enchanty s grade weapon oraz max +10 and safe +4 Smile0 Dont delete my post plx
(This post was last modified: 05-19-2012 18:55 PM by mistrz20.)
05-19-2012 18:51 PM
Find all posts by this user
Salvatore Offline
Gremlin
*

Posts: 7
Joined: May 2012
Reputation: 0
Version: 1.4.2.132
Post: #2
RE: Problem z/with autoenchant

1.- Please use [CODE] bbcode to include scripts/plugins into a post.

What's the problem you'r having? Screenshot or something please.
05-20-2012 07:43 AM
Find all posts by this user
mistrz20 Offline
Gremlin
*

Posts: 5
Joined: Nov 2011
Reputation: 0
Version: 1.4.1.93
Post: #3
RE: Problem z/with autoenchant

There is a problem: http://pokazywarka.pl/bv7ey3/

My script looks like:
-- SCRIPT CONFIGURATION!

item_name = "Draconic Bow"
enchant_name = "Scroll: Enchant Weapon (S-Grade)"
blessed_enchant_name = "Blessed Scroll: Enchant Weapon (S-Grade)"
max_enchant = 10
max_safe_enchant = 4
delay = 1300

-- END OF SCRIPT CONFIGURATION

-- HELPER FUNCTIONS
function enchantResult()
return GetEnchantManager():getLastResult()
end

function getItemByName("Draconic Bow", 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("Draconic Bow", 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 Scroll: Enchant Weapon (S-Grade)", 10)
else
enchant = getItemByName("Blessed Scroll: Enchant Weapon (S-Grade)", 10)
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


Hmm, can u help ? Smile plx
05-20-2012 10:13 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,689 09-02-2022 17:36 PM
Last Post: newlifeform
  L2 Zaken Classic problem kvourg13 0 2,142 10-07-2018 05:29 AM
Last Post: kvourg13
  problem with the programm killbill 1 2,251 11-15-2017 02:54 AM
Last Post: kbelinh0
Sad License. problem jonathanf1 1 3,351 04-19-2017 23:07 PM
Last Post: Jonathan6666
  Problem... Critical error [c6 server] Nasif 2 4,559 10-18-2016 13:48 PM
Last Post: Verb
  AntiBot problem SaintRose 2 4,099 10-05-2016 22:27 PM
Last Post: Vinter
  Autofarm Script repeat without condition problem. either 3 4,870 05-25-2016 01:00 AM
Last Post: TheQQmaster
  how to resolve this problem? lozjan 1 3,041 05-21-2016 06:13 AM
Last Post: martlegion
  Healer Fix plugin problem aa300598 1 3,166 02-20-2016 13:21 PM
Last Post: Vinter
  Bot reset setting problem aa300598 2 3,655 02-04-2016 13:18 PM
Last Post: TheQQmaster



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