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
скрипт на аргументацию
Author Message
atazoid Offline
Elpy
*

Posts: 1
Joined: Jan 2015
Reputation: 0
Version: 1.4.1.124
Post: #1
скрипт на аргументацию

Доброго времени суток всем! Пытаюсь я запустить ниже приведенный скрипт в рабочий режим, увы, не выходит. При запуске скрипта в чат выводится сообщение:AUGMENT: Out of gemstones or life stones. Хотя в инвентаре все предметы присутствуют. Мб была у кого такая проблема и кто просто шарит в скриптах, посоветуйте, что не так?
Code:
local weaponName = "Demitelum"
local lifestoneName = "Top-Grade Life Stone - Level 84"
local gemstoneName = "Gemstone B"
local gemstone_count = 58
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(500)
            TargetNpc(name, 0)
            Sleep(500)
        end
    else
        TargetNpc(name, 0)
        Sleep(500)
    end

    target = GetTarget()
    if ( target ~= nil and target:GetName() == name ) then
        Talk()
        Sleep(500)
        Click("05", "Augment Item.");
        Sleep(500)
        Click("00", "Start smelting.");
        Sleep(500)
        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(500)
            TargetNpc(name, 0)
            Sleep(500)
        end
    else
        TargetNpc(name, 0)
        Sleep(500)
    end

    target = GetTarget()
    if ( target ~= nil and target:GetName() == name ) then
     Talk();
        Sleep(500)
        Click("06", "Cancel item Augmentation.");
        Sleep(500)
        Click("00", "Remove the Stone of Life.");
        Sleep(500)
        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)
            --- HERE ---
            GetAugmentManager():setGemstoneId(gemstone.objectId, gemstone_count)
            GetAugmentManager():Augment()
            Sleep(1000)            
            if ( openAugmentWindow(npcName) == false ) then
                break
            end

            while ( GetAugmentManager():getAugmentResult() == Augment.AUGMENT_PENDING ) do
                Sleep(200)
            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(200)
            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

Причем работает скрипт на энчант и боты в полном объеме, без каких либо нареканий...
(This post was last modified: 01-27-2015 01:49 AM by atazoid.)
01-27-2015 01:44 AM
Find all posts by this user Quote this message in a reply
alberthofman Offline
Ratman Chieftain
*

Posts: 29
Joined: May 2013
Reputation: 0
Version: 1.4.2.133
Post: #2
RE: скрипт на аргументацию

не проще через плагин?
01-27-2015 21:38 PM
Find all posts by this user Quote this message in a reply
TheQQmaster Offline
Trolling the Trolls
*****

Posts: 1,532
Joined: Jun 2012
Reputation: 642
Version: 1.4.2.133
Post: #3
RE: скрипт на аргументацию

jebasit na offi,

    LUA Programming
--How To Use!!
-- Start With Weapon you need to augment EQUIPPED!
-- Start With Helmet on your Char!.. IF YOU REMOVE HELMET THE AUGMENTATION WILL STOP (so you can interrupt the script anytime you want)
-- Choose The Next 4 variables Correctly (Write The Exact Names with Exact Capital Letters and Same Spaces!):
local lifestoneName = "Mid-grade Life Stone - Level 80"
local gemstoneName = "Gemstone (A-grade)"
local gemstone_count = 13;
local npcName = "Pushkin"; --  only Pushkin(Giran)/ Wilbert(Aden) Supported!
 
 
 
------Dont Touch Under This Line---------
local AugStatus = 0;
local count = 0; 
AugStatusC = 0;
 
function getItemByName(name)
	local invList = GetInventory();
	for item in invList.list do
		if (item.Name == name) then
			return item;
		end;
	end;
end;
 
function openAugmentWindow(name)
	local target = GetTarget();
	if (target ~= nil) then
		if (target:GetName() ~= name) then
			Command("/target " .. name);
			Sleep(1000);
		end;
	else
		Command("/target " .. name);
		Sleep(1000);
	end;
 
	target = GetTarget();
	if (target ~= nil) and (target:GetName() == name) then
		if (name == "Wilbert") then
			Talk();
			ClickLinkAndWait("blacksmith_wilbert005.htm");
			Sleep(100);
			ClickLinkAndWait("smelting_start.htm");
			Sleep(100);
			QuestReply("menu_select?ask=-503&reply=100");
			Sleep(1000);
			return true;
		elseif (name == "Pushkin") then
			Talk();
			--Sleep(1000);
			ClickLinkAndWait("blacksmith_pushkin005.htm");
			Sleep(100);
			ClickLinkAndWait("smelting_start.htm");
			Sleep(100);
			QuestReply("menu_select?ask=-503&reply=100")
			Sleep(1000);
			return true;
		end;
	end;
	return false;
end;
 
function getItemByName(name)
	local invList = GetInventory();
	for item in invList.list do
		if (item.Name == name) then
			return item;
		end;
	end;
end;
 
function openAugmentCancelWindow(name)
	count = 2;
	target = GetTarget();
	if (target ~= nil) then
		if (target:GetName() ~= name) then
			Command("/target " .. name);
			Sleep(1000);
		end
	else
		Command("/target " .. name);
		Sleep(1000);
	end;
 
	target = GetTarget();
	if (target ~= nil) and (target:GetName() == name) then
		if (name == "Wilbert") then
			Talk();
			ClickLinkAndWait("blacksmith_wilbert005.htm");
			Sleep(100);
			ClickLinkAndWait("smelting_break.htm");
			Sleep(100);
			ClickLink("menu_select?ask=-503&reply=200");
			Sleep(1000);
			return true;
		elseif (name == "Pushkin") then
			Talk();
			ClickLinkAndWait("blacksmith_pushkin005.htm");
			Sleep(100);
			ClickLinkAndWait("smelting_break.htm");
			Sleep(100);
			QuestReply("menu_select?ask=-503&reply=200");
			Sleep(1000);
			return true;
		end;
	end;
	return false;
end;
 
weaponId = GetMe():GetEquip_WeaponId();
 
if (weaponId == nil) or (weaponId == 0) then
	ShowToClient(tostring(os.date("%X")), "You Dont have Any Weapon Equiped to augment!",3)	;
else
	weapon = GetInventory():FindById(weaponId);
	if (weapon ~= nil) and ((weapon.RefineryOp2 ~= 0) or (weapon.RefineryOp1 ~= 0)) then
		ShowToClient(tostring(os.date("%X")), "You Must Start With Non Augmented weapon!",3) ;
	else
		repeat
 
			if (weapon.RefineryOp2 == 0) and (weapon.RefineryOp1 == 0) then
				AugStatus = 0;
				lifestone = getItemByName(lifestoneName);	
				gemstone = getItemByName(gemstoneName);
				if (lifestone == nil) then
					ShowToClient(tostring(os.date("%X")), "Out of life stones.",3);
					break;
				end;
				if (gemstone == nil) then
					ShowToClient(tostring(os.date("%X")), "Out of gemstones.",3);
					AugStatus = 1;
					break;
				end;
				if (gemstone.ItemNum < gemstone_count) then
					ShowToClient(tostring(os.date("%X")), "Gemstones are not enough.",3);
					AugStatus = 1;
					break;
				end;				
 
				ShowToClient(tostring(os.date("%X")), "Augmenting ..",3);
				AugStatusC = AugStatusC+1;
				GetAugmentManager():setItemId(weaponId);
				GetAugmentManager():setLifeStoneId(lifestone.objectId);
				GetAugmentManager():setGemstoneId(gemstone.objectId, gemstone_count);
				GetAugmentManager():Augment();	
				if (openAugmentWindow(npcName) == false) then
					ShowToClient(tostring(os.date("%X")), "NPC FAIL.",3);
					AugStatus = 1;
					break;
				end;
				repeat
					Sleep(1000);
					weapon = GetInventory():FindById(weaponId);
				until weapon.RefineryOp1 ~= 0
 
				if (weapon == nil) then
					ShowToClient(tostring(os.date("%X")), "The Weapon Couldn't be Detected!",3);
					AugStatus = 1;
					break;
				else
 
					if (GetAugmentManager():KeepAugment(weapon.RefineryOp2) == true) or (GetAugmentManager():KeepAugment(weapon.RefineryOp1) == true) then
						ShowToClient(tostring(os.date("%X")), "Congratulation! You have achieved a desired augment!",3)
						AugStatus = 1;
					else
						ShowToClient(tostring(os.date("%X")), "Obtained Useless Augment ...",3)
					end;
				end;
				count = 1;
				if (GetMe():GetEquip_HelmId() == 0) then
					ShowToClient(tostring(os.date("%X")), "Augmentation Stoped Manualy by removing helment.",3);
					AugStatus = 1;
					break;							
				end;
			else
				Sleep(500);
				ShowToClient(tostring(os.date("%X")), "Canceling Augmentation ..",3);
				weapon = GetInventory():FindById(weaponId);
				if weapon == nil then
					ShowToClient(tostring(os.date("%X")), "Weapon for cancel not detected.",3);
					count = 3
					AugStatus = 1;
					break;
				end;
				if (count == 1) then
					GetAugmentManager():setItemId(weaponId);
					GetAugmentManager():AugmentCancel();
					count = 2;
				end;
				Sleep(500);
 
				if (count == 2) and (openAugmentCancelWindow(npcName) == false) then
					ShowToClient(tostring(os.date("%X")), "The NPC Dialog Is not Working Properly.",3);
					count = 3
					AugStatus = 1;
					break;
				end;
 
				repeat
					Sleep(1000);
					weapon = GetInventory():FindById(weaponId);
				until weapon.RefineryOp1 == 0
 
				if not (weapon.RefineryOp1 == 0 and weapon.RefineryOp2 == 0) then
					ShowToClient(tostring(os.date("%X")), "Augment Canceling Failed.",3);
					AugStatus = 1;
					break;				
				end;
				if (GetMe():GetEquip_HelmId() == 0) then
					ShowToClient(tostring(os.date("%X")), "Augmentation Stoped Manualy by removing helment.",3);
					AugStatus = 1;
					break;							
				end;
			end;
		until weapon == nil or AugStatus == 1 ;
		ShowToClient(tostring(os.date("%X")),"Have Fun!",3);
	end;
end;


PUSH [Image: knUu53] IF HELPED
01-27-2015 23:22 PM
Visit this user's website Find all posts by this user Quote this message in a reply
aezez Offline
Elpy
*

Posts: 1
Joined: Jan 2015
Version: None
Post: #4
RE: скрипт на аргументацию

очень нужен скрипт для интерлюда
можт ктонить посоветовать?
01-29-2015 09:26 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Скрипт на квест A Special Order DeSilvia 0 4,758 01-13-2017 22:31 PM
Last Post: DeSilvia
  Помогите составить скрипт AloneMODE 2 5,554 12-16-2015 22:01 PM
Last Post: TheQQmaster
  Скрипт на заточку. CreonMaltese 18 24,660 08-02-2015 21:17 PM
Last Post: TheQQmaster
  Проблема со скриптом. Останавливается скрипт после скила. immortal89 0 2,093 06-25-2015 03:13 AM
Last Post: immortal89
  Скрипт на ТТ set899ful 8 16,659 06-22-2015 20:04 PM
Last Post: adterorist1
  помогите найти скрипт или разобраться adterorist1 0 3,437 06-12-2015 00:41 AM
Last Post: adterorist1
  Скрипт для Хилера. Yoxo 0 2,484 04-19-2015 18:20 PM
Last Post: Yoxo
  Объясните плз как работает этот скрипт. Yoxo 1 4,593 03-14-2015 12:21 PM
Last Post: TheQQmaster
  Скрипт на Energy Stone Satellizer2000 0 3,181 01-17-2015 13:54 PM
Last Post: Satellizer2000
Exclamation Скрипт на точку (помогите) kertis 0 3,093 01-13-2015 18:09 PM
Last Post: kertis



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