MrGrey_Undis
Gremlin
Posts: 8
Joined: Mar 2013
Reputation: 0
Version:
1.4.1.95
|
Help with an augmentation script
There is a working script. The script inserts Life Stone into the set weapon if an augment not what is set in //xcfg that an augment is pulled out and the new is inserted. But there is a problem after by Life Stone it is inserted, the script for some reason waits about five minutes before pulling out Life Stone, and also waits after will pull out Life Stone before inserting the new.
Script:
Code:
local weaponName = "Hell Knife"
local lifestoneName = "Life Stone - Level 84"
local gemstoneName = "Gemstone D"
local gemstone_count = 30
local npcName = "Pushkin"
function getItemByName(name)
invList = GetInventory();
for item in invList.list do
if item.Name == name then
-- ShowToClient("ITEM", item.Name .. " (ID: " .. item.displayId .. ")");
return item
end
end
end
function openAugmentWindow(name)
target = GetTarget()
if ( target ~= nil ) then
if ( target:GetName() ~= name ) then
CancelTarget(true)
Sleep(100)
TargetNpc(name, 0)
Sleep(100)
end
else
TargetNpc(name, 0)
Sleep(100)
end
target = GetTarget()
if ( target ~= nil and target:GetName() == name ) then
Talk();
ClickAndWait("npc_268457188_Chat 5", "Smelt an item.");
Sleep(100)
ClickAndWait("npc_268457188_Link common/augmentation_01.htm", "Start smelting.");
Sleep(100)
ClickAndWait("npc_268457188_Augment 1", "Augment.")
Sleep(100)
return true
end
return false
end
function getItemByName(name)
invList = GetInventory();
for item in invList.list do
if item.Name == name then
-- ShowToClient("ITEM", item.Name .. " (ID: " .. item.displayId .. ")");
return item
end
end
end
function openAugmentCancelWindow(name)
target = GetTarget()
if ( target ~= nil ) then
if ( target:GetName() ~= name ) then
CancelTarget(true)
Sleep(100)
TargetNpc(name, 0)
Sleep(100)
end
else
TargetNpc(name, 0)
Sleep(100)
end
target = GetTarget()
if ( target ~= nil and target:GetName() == name ) then
Talk();
ClickAndWait("npc_268457188_Chat 6", "Cancel smelting.");
Sleep(100)
ClickAndWait("npc_268457188_Link common/augmentation_01.htm", "Remove the refined Life Stone.");
Sleep(100)
ClickAndWait("npc_268457188_Augment 1", "Remove.")
Sleep(100)
return true
end
return false
end
weapon = getItemByName(weaponName)
if ( weapon == nil ) then
ShowToClient("AUGMENT", "Could not find weapon " .. weaponName)
else
weaponId = weapon.objectId
GetAugmentManager():setItemId(weaponId)
repeat
if ( weapon.RefineryOp2 == 0 ) then
lifestone = getItemByName(lifestoneName)
gemstone = getItemByName(gemstoneName)
if ( lifestone == nil or gemstone == nil ) then
ShowToClient("AUGMENT:", "Out of gemstones or life stones")
break
end
GetAugmentManager():setItemId(weaponId)
GetAugmentManager():setLifeStoneId(lifestone.objectId)
GetAugmentManager():setGemstoneId(gemstone.objectId, 30)
GetAugmentManager():Augment()
if ( openAugmentWindow(npcName) == false ) then
break
end
while ( GetAugmentManager():getAugmentResult() == Augment.AUGMENT_PENDING ) do
Sleep(100)
end
if ( GetAugmentManager():getAugmentResult() == Augment.AUGMENT_FINISHED ) then
Sleep ( 100 ) -- sleep so item data is updated
weapon = GetInventory():FindById(weaponId)
end
if ( GetAugmentManager():KeepAugment ( weapon.RefineryOp2 ) == true ) then
ShowToClient("AUGMENT:", "You have achieved desired augment! " .. weapon.RefineryOp2)
break
end
else
if ( GetAugmentManager():KeepAugment ( weapon.RefineryOp2 ) == true ) then
ShowToClient("AUGMENT:", "You have achieved desired augment! " .. weapon.RefineryOp2)
break
end
GetAugmentManager():setItemId(weaponId)
GetAugmentManager():AugmentCancel()
if ( openAugmentCancelWindow(npcName) == false ) then
break
end
while ( GetAugmentManager():getAugmentCancelResult() == Augment.AUGMENT_CANCEL_PENDING ) do
Sleep(100)
end
if ( GetAugmentManager():getAugmentCancelResult() == Augment.AUGMENT_FINISHED ) then
Sleep ( 100 ) -- sleep so item data is updated
end
weapon = GetInventory():FindById(weaponId)
end
until false
end
Tell how to reduce this pause 5 minutes.
Generally judging by ravines after by PM it is inserted, the script tries to insert again pm into the same (already augmentirovanny weapon), but through any time after all removes LifeStone and again tries to remove it... And it is so constant. From here and delay. How to correct who knows? Or give normally working script for HF.
Also forgive me for my English)
|
|
03-05-2013 13:49 PM |
|
MrGrey_Undis
Gremlin
Posts: 8
Joined: Mar 2013
Reputation: 0
Version:
1.4.1.95
|
RE: Help with an augmentation script
//close
|
|
03-05-2013 22:57 PM |
|