• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Little Fix :p

Snow

New Member
Joined
Jan 16, 2008
Messages
381
Reaction score
0
I have 2 scripts (2 levers) and I want 16 (identical to real), the last lever will remover 2 stones and after 30 minutes the stones will reappear.
I want it in a way that all levers will stay in one script.

here's one script:
LUA:
function onUse(cid, item, frompos, item2, topos)
	
		if item.uid == 3001 and item.itemid == 1945 then
	
			doPlayerSay(cid, "You flipped the first lever. Hurry up and find the next one.", 16)
			doTransformItem(item.uid,item.itemid+1)
		
		elseif item.uid == 3001 and item.itemid == 1946 then

			doTransformItem(item.uid,item.itemid-1)	
	doDecayItem(item.uid)	
	
		else
			doPlayerSendCancel(cid,"Sorry, not possible.")
		end

	return 1

end

second one..

LUA:
function onUse(cid, item, frompos, item2, topos)

		dzwignia1_pos = {x=1338, y=1234, z=12, stackpos=1}
		dzwignia1 = getThingfromPos(dzwignia1_pos)

		if item.uid == 3002 and item.itemid == 1945 and dzwignia1.itemid == 1946 then
	
			doPlayerSay(cid, "You flipped the second lever. Hurry up and find the next one.", 16)
			doTransformItem(item.uid,item.itemid+1)
		
		elseif item.uid == 3002 and item.itemid == 1946 then

			doTransformItem(item.uid,item.itemid-1)		
	
		else
			doPlayerSendCancel(cid,"Sorry, not possible.")
		end

	return 1

end

Of course I'll rep the helper :)

Thanks!
 
Why not use action ids instead of unique ids?
LUA:
local switch2 = getThingFromPos({x=xxxx, y=yyyy, z=z})
local switch3 = getThingFromPos({x=xxxx, y=yyyy, z=z})
local switch4 = getThingFromPos({x=xxxx, y=yyyy, z=z})
local switch5 = getThingFromPos({x=xxxx, y=yyyy, z=z})
local switch6 = getThingFromPos({x=xxxx, y=yyyy, z=z})
local switch7 = getThingFromPos({x=xxxx, y=yyyy, z=z})
local switch8 = getThingFromPos({x=xxxx, y=yyyy, z=z})
local switch9 = getThingFromPos({x=xxxx, y=yyyy, z=z})
local switch10 = getThingFromPos({x=xxxx, y=yyyy, z=z})
local switch11 = getThingFromPos({x=xxxx, y=yyyy, z=z})
local switch12 = getThingFromPos({x=xxxx, y=yyyy, z=z})
local switch13 = getThingFromPos({x=xxxx, y=yyyy, z=z})
local switch14 = getThingFromPos({x=xxxx, y=yyyy, z=z})
local switch15 = getThingFromPos({x=xxxx, y=yyyy, z=z})
local switch16 = getThingFromPos({x=xxxx, y=yyyy, z=z})
local stone1 = getThingFromPos({x=xxxx, y=yyyy, z=z})
local stone2 = getThingFromPos({x=xxxx, y=yyyy, z=z})

function onUse(cid, item, frompos, item2, topos)
	if(item.itemid == 1946) then
		doTransformItem(item.uid, item.itemid - 1)
		return true
	end

	if(item.itemid ~= 1945) then
		return true
	end        
        
	if item.actionid == 3001 then
        	doPlayerSay(cid, "You flipped the first lever. Hurry up and find the next one.", 16)
		doItemSetAttribute(switch2.uid, "aid", 3002)
	elseif item.actionid == 3002 then
		doPlayerSay(cid, "You flipped the second lever. Hurry up and find the next one.", 16) 
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(switch3.uid, "aid", 3003)
	elseif item.actionid == 3003 then
		doPlayerSay(cid, "You flipped the third lever. Hurry up and find the next one.", 16)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(switch4.uid, "aid", 3004)
	elseif item.actionid == 3004 then
		doPlayerSay(cid, "You flipped the fourth lever. Hurry up and find the next one.", 16) 
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(switch5.uid, "aid", 3005)
	elseif item.actionid == 3005 then
		doPlayerSay(cid, "You flipped the fifth lever. Hurry up and find the next one.", 16) 
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(switch6.uid, "aid", 3006)
	elseif item.actionid == 3006 then
		doPlayerSay(cid, "You flipped the sixth lever. Hurry up and find the next one.", 16) 
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(switch7.uid, "aid", 3007)
	elseif item.actionid == 3007 then
		doPlayerSay(cid, "You flipped the seventh lever. Hurry up and find the next one.", 16) 
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(switch8.uid, "aid", 3008)
	elseif item.actionid == 3008 then
		doPlayerSay(cid, "You flipped the eighth lever. Hurry up and find the next one.", 16) 
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(switch9.uid, "aid", 3009)
	elseif item.actionid == 3009 then
		doPlayerSay(cid, "You flipped the ninth lever. Hurry up and find the next one.", 16) 
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(switch10.uid, "aid", 3010)
	elseif item.actionid == 3010 then
		doPlayerSay(cid, "You flipped the tenth lever. Hurry up and find the next one.", 16) 
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(switch11.uid, "aid", 3011)
	elseif item.actionid == 3011 then
		doPlayerSay(cid, "You flipped the eleventh lever. Hurry up and find the next one.", 16) 
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(switch12.uid, "aid", 3012)
	elseif item.actionid == 3012 then
		doPlayerSay(cid, "You flipped the twelfth lever. Hurry up and find the next one.", 16) 
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(switch13.uid, "aid", 3013)
	elseif item.actionid == 3013 then
		doPlayerSay(cid, "You flipped the thirteenth lever. Hurry up and find the next one.", 16) 
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(switch14.uid, "aid", 3014)
	elseif item.actionid == 3014 then
		doPlayerSay(cid, "You flipped the fourteenth lever. Hurry up and find the next one.", 16) 
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(switch15.uid, "aid", 3015)
	elseif item.actionid == 3015 then
		doPlayerSay(cid, "You flipped the fifteenth lever. Hurry up and find the next one.", 16) 
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(switch16.uid, "aid", 3016)
	elseif item.actionid == 3016 then
		doPlayerSay(cid, "You flipped the last lever.", 16) 
		doItemSetAttribute(item.uid, "aid", 0)
		doRemoveItem(stone1.uid)
		doRemoveItem(stone2.uid)
		addEvent(doCreateItem, 60*1000*30, *stone1 itemid*, {x=xxxx,y=yyyy,z=z})
		addEvent(doCreateItem, 60*1000*30, *stone2 itemid*, {x=xxxx,y=yyyy,z=z})
	end
	doTransformItem(item.uid, item.itemid + 1)
	return true

end

That's how I'd do it, without setting any ActionIds except for the first switch that way it will work in order.
 
Last edited:
i'm getting this

[20/02/2010 12:14:58] [Error - LuaScriptInterface::loadFile] data/actions/scripts/quests/pitsOfInferno/levers.lua:3: '}' expected near ')'
[20/02/2010 12:14:58] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/pitsOfInferno/levers.lua)
[20/02/2010 12:14:58] data/actions/scripts/quests/pitsOfInferno/levers.lua:3: '}' expected near ')'
 
this is how the script is actually..:
PHP:
local switch2 = getThingFromPos({x=498, y=1381, z=13})
local switch3 = getThingFromPos({x=450, y=1415, z=13})
local switch4 = getThingFromPos({x=496, y=1402, z=14)
local switch5 = getThingFromPos({x=494, y=1386, z=11)
local switch6 = getThingFromPos({x=453, y=1381, z=11})
local switch7 = getThingFromPos({x=494, y=1408, z=12})
local switch8 = getThingFromPos({x=460, y=1412, z=13})
local switch9 = getThingFromPos({x=450, y=1412, z=11})
local switch10 = getThingFromPos({x=454, y=1385, z=12})
local switch11 = getThingFromPos({x=493, y=1390, z=12})
local switch12 = getThingFromPos({x=481, y=1418, z=12})
local switch13 = getThingFromPos({x=457, y=1419, z=12})
local switch14 = getThingFromPos({x=467, y=1417, z=12})
local switch15 = getThingFromPos({x=481, y=1407, z=13})
local switch16 = getThingFromPos({x=455, y=1388, z=11})
local stone1 = getThingFromPos({x=458, y=1386, z=11})
local stone2 = getThingFromPos({x=459, y=1386, z=11})

function onUse(cid, item, frompos, item2, topos)
        if(item.itemid == 1946) then
                doTransformItem(item.uid, item.itemid - 1)
                return true
        end

        if(item.itemid ~= 1945) then
                return true
        end        
       
        if item.actionid == 4001 then
                doPlayerSay(cid, "You flipped the first lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(switch2.uid, "aid", 4002)
        elseif item.actionid == 4002 then
                doPlayerSay(cid, "You flipped the second lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch3.uid, "aid", 4003)
        elseif item.actionid == 4003 then
                doPlayerSay(cid, "You flipped the third lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch4.uid, "aid", 4004)
        elseif item.actionid == 4004 then
                doPlayerSay(cid, "You flipped the fourth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch5.uid, "aid", 4005)
        elseif item.actionid == 4005 then
                doPlayerSay(cid, "You flipped the fifth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch6.uid, "aid", 4006)
        elseif item.actionid == 4006 then
                doPlayerSay(cid, "You flipped the sixth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch7.uid, "aid", 4007)
        elseif item.actionid == 4007 then
                doPlayerSay(cid, "You flipped the seventh lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch8.uid, "aid", 4008)
        elseif item.actionid == 4008 then
                doPlayerSay(cid, "You flipped the eighth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch9.uid, "aid", 4009)
        elseif item.actionid == 4009 then
                doPlayerSay(cid, "You flipped the ninth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch10.uid, "aid", 4010)
        elseif item.actionid == 4010 then
                doPlayerSay(cid, "You flipped the tenth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch11.uid, "aid", 4011)
        elseif item.actionid == 4011 then
                doPlayerSay(cid, "You flipped the eleventh lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch12.uid, "aid", 4012)
        elseif item.actionid == 4012 then
                doPlayerSay(cid, "You flipped the twelfth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch13.uid, "aid", 4013)
        elseif item.actionid == 4013 then
                doPlayerSay(cid, "You flipped the thirteenth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch14.uid, "aid", 4014)
        elseif item.actionid == 4014 then
                doPlayerSay(cid, "You flipped the fourteenth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch15.uid, "aid", 4015)
        elseif item.actionid == 4015 then
                doPlayerSay(cid, "You flipped the fifteenth lever. Hurry up and find the last one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch16.uid, "aid", 4016)
        elseif item.actionid == 4016 then
                doPlayerSay(cid, "You flipped the last lever.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doRemoveItem(stone1.uid)
                doRemoveItem(stone2.uid)
                addEvent(doCreateItem, 60*1000*30, *stone1 itemid*, {x=458,y=1386,z=11})
                addEvent(doCreateItem, 60*1000*30, *stone2 itemid*, {x=459,y=1386,z=11})
        end
        doTransformItem(item.uid, item.itemid + 1)
        return true

end

back to second page, please someone help, players are wanting to do poi!
 
Try this (edit all the positions and ids)

This script orginally scripted by Zyntax
LUA:
local Q_Switches = {
   [4000] = 1945,     ----- [Unique ID] = Item ID
   [4001] = 1946,
   [4002] = 1945,
   [4003] = 1946,
}
local function resettq1(item, getstatue, statue)
    doCreateItem(getstatue.itemid, 1, statue)
    for key, value in pairs(Q_Switches) do
        if (getTileThingByPos((getThingPos(key))).itemid == 1946) then
            doTransformItem(key, 1945)
        end
    end
end
function onUse(cid, item, item2, frompos, topos)
local statue = {x=520, y=232, z=7, stackpos=1}
local getstatue = getTileItemById(statue, 1449)
local timeToReset = 10000
   for i, v in pairs(Q_Switches) do
      if not (getTileThingByPos((getThingPos(i))).itemid == v) then
        if item.itemid == 1945 then
            doTransformItem(item.uid, 1946)
        else
            doTransformItem(item.uid, 1945)
        end
         return true
      end
   end
   if item.itemid == 1945 then
            doTransformItem(item.uid, 1946)
        else
            doTransformItem(item.uid, 1945)
        end
   doPlayerSendTextMessage(cid, 22, "A statue opened a hidden place in the jungle. Hurry it\'s only opened for 10 seconds!")
   doRemoveItem(getstatue.uid, 1)
   addEvent(resettq1, timeToReset, item, getstatue, statue)
   return true
end
 
local switch2 = getThingFromPos({x=498, y=1381, z=13})
local switch3 = getThingFromPos({x=450, y=1415, z=13})
local switch4 = getThingFromPos({x=496, y=1402, z=14)
local switch5 = getThingFromPos({x=494, y=1386, z=11)
local switch6 = getThingFromPos({x=453, y=1381, z=11})
local switch7 = getThingFromPos({x=494, y=1408, z=12})
local switch8 = getThingFromPos({x=460, y=1412, z=13})
local switch9 = getThingFromPos({x=450, y=1412, z=11})
local switch10 = getThingFromPos({x=454, y=1385, z=12})
local switch11 = getThingFromPos({x=493, y=1390, z=12})
local switch12 = getThingFromPos({x=481, y=1418, z=12})
local switch13 = getThingFromPos({x=457, y=1419, z=12})
local switch14 = getThingFromPos({x=467, y=1417, z=12})
local switch15 = getThingFromPos({x=481, y=1407, z=13})
local switch16 = getThingFromPos({x=455, y=1388, z=11})
local stone1 = getThingFromPos({x=458, y=1386, z=11})
local stone2 = getThingFromPos({x=459, y=1386, z=11})

function onUse(cid, item, frompos, item2, topos)
if(item.itemid == 1946) then
doTransformItem(item.uid, item.itemid - 1)
return true
end

if(item.itemid ~= 1945) then
return true
end

if item.actionid == 4001 then
doPlayerSay(cid, "You flipped the first lever. Hurry up and find the next one.", 16)
doItemSetAttribute(switch2.uid, "aid", 4002)
elseif item.actionid == 4002 then
doPlayerSay(cid, "You flipped the second lever. Hurry up and find the next one.", 16)
doItemSetAttribute(item.uid, "aid", 0)
doItemSetAttribute(switch3.uid, "aid", 4003)
elseif item.actionid == 4003 then
doPlayerSay(cid, "You flipped the third lever. Hurry up and find the next one.", 16)
doItemSetAttribute(item.uid, "aid", 0)
doItemSetAttribute(switch4.uid, "aid", 4004)
elseif item.actionid == 4004 then
doPlayerSay(cid, "You flipped the fourth lever. Hurry up and find the next one.", 16)
doItemSetAttribute(item.uid, "aid", 0)
doItemSetAttribute(switch5.uid, "aid", 4005)
elseif item.actionid == 4005 then
doPlayerSay(cid, "You flipped the fifth lever. Hurry up and find the next one.", 16)
doItemSetAttribute(item.uid, "aid", 0)
doItemSetAttribute(switch6.uid, "aid", 4006)
elseif item.actionid == 4006 then
doPlayerSay(cid, "You flipped the sixth lever. Hurry up and find the next one.", 16)
doItemSetAttribute(item.uid, "aid", 0)
doItemSetAttribute(switch7.uid, "aid", 4007)
elseif item.actionid == 4007 then
doPlayerSay(cid, "You flipped the seventh lever. Hurry up and find the next one.", 16)
doItemSetAttribute(item.uid, "aid", 0)
doItemSetAttribute(switch8.uid, "aid", 4008)
elseif item.actionid == 4008 then
doPlayerSay(cid, "You flipped the eighth lever. Hurry up and find the next one.", 16)
doItemSetAttribute(item.uid, "aid", 0)
doItemSetAttribute(switch9.uid, "aid", 4009)
elseif item.actionid == 4009 then
doPlayerSay(cid, "You flipped the ninth lever. Hurry up and find the next one.", 16)
doItemSetAttribute(item.uid, "aid", 0)
doItemSetAttribute(switch10.uid, "aid", 4010)
elseif item.actionid == 4010 then
doPlayerSay(cid, "You flipped the tenth lever. Hurry up and find the next one.", 16)
doItemSetAttribute(item.uid, "aid", 0)
doItemSetAttribute(switch11.uid, "aid", 4011)
elseif item.actionid == 4011 then
doPlayerSay(cid, "You flipped the eleventh lever. Hurry up and find the next one.", 16)
doItemSetAttribute(item.uid, "aid", 0)
doItemSetAttribute(switch12.uid, "aid", 4012)
elseif item.actionid == 4012 then
doPlayerSay(cid, "You flipped the twelfth lever. Hurry up and find the next one.", 16)
doItemSetAttribute(item.uid, "aid", 0)
doItemSetAttribute(switch13.uid, "aid", 4013)
elseif item.actionid == 4013 then
doPlayerSay(cid, "You flipped the thirteenth lever. Hurry up and find the next one.", 16)
doItemSetAttribute(item.uid, "aid", 0)
doItemSetAttribute(switch14.uid, "aid", 4014)
elseif item.actionid == 4014 then
doPlayerSay(cid, "You flipped the fourteenth lever. Hurry up and find the next one.", 16)
doItemSetAttribute(item.uid, "aid", 0)
doItemSetAttribute(switch15.uid, "aid", 4015)
elseif item.actionid == 4015 then
doPlayerSay(cid, "You flipped the fifteenth lever. Hurry up and find the last one.", 16)
doItemSetAttribute(item.uid, "aid", 0)
doItemSetAttribute(switch16.uid, "aid", 4016)
elseif item.actionid == 4016 then
doPlayerSay(cid, "You flipped the last lever.", 16)
doItemSetAttribute(item.uid, "aid", 0)
doRemoveItem(stone1.uid)
doRemoveItem(stone2.uid)
addEvent(doCreateItem, 60*1000*30, *stone1 itemid*, {x=458,y=1386,z=11})
addEvent(doCreateItem, 60*1000*30, *stone2 itemid*, {x=459,y=1386,z=11})
end
doTransformItem(item.uid, item.itemid + 1)
return true

end

change getthingfrompos under your function
 
i'm getting this

[20/02/2010 12:14:58] [Error - LuaScriptInterface::loadFile] data/actions/scripts/quests/pitsOfInferno/levers.lua:3: '}' expected near ')'
[20/02/2010 12:14:58] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/pitsOfInferno/levers.lua)
[20/02/2010 12:14:58] data/actions/scripts/quests/pitsOfInferno/levers.lua:3: '}' expected near ')'

^^ is the error :(
 
Code:
local switch2 = getThingFromPos({x=498, y=1381, z=13})
local switch3 = getThingFromPos({x=450, y=1415, z=13})
local switch4 = getThingFromPos({x=496, y=1402, z=14})
local switch5 = getThingFromPos({x=494, y=1386, z=11})
local switch6 = getThingFromPos({x=453, y=1381, z=11})
local switch7 = getThingFromPos({x=494, y=1408, z=12})
local switch8 = getThingFromPos({x=460, y=1412, z=13})
local switch9 = getThingFromPos({x=450, y=1412, z=11})
local switch10 = getThingFromPos({x=454, y=1385, z=12})
local switch11 = getThingFromPos({x=493, y=1390, z=12})
local switch12 = getThingFromPos({x=481, y=1418, z=12})
local switch13 = getThingFromPos({x=457, y=1419, z=12})
local switch14 = getThingFromPos({x=467, y=1417, z=12})
local switch15 = getThingFromPos({x=481, y=1407, z=13})
local switch16 = getThingFromPos({x=455, y=1388, z=11})
local stone1 = getThingFromPos({x=458, y=1386, z=11})
local stone2 = getThingFromPos({x=459, y=1386, z=11})

function onUse(cid, item, frompos, item2, topos)
        if(item.itemid == 1946) then
                doTransformItem(item.uid, item.itemid - 1)
                return true
        end

        if(item.itemid ~= 1945) then
                return true
        end        
       
        if item.actionid == 4001 then
                doPlayerSay(cid, "You flipped the first lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(switch2.uid, "aid", 4002)
        elseif item.actionid == 4002 then
                doPlayerSay(cid, "You flipped the second lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch3.uid, "aid", 4003)
        elseif item.actionid == 4003 then
                doPlayerSay(cid, "You flipped the third lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch4.uid, "aid", 4004)
        elseif item.actionid == 4004 then
                doPlayerSay(cid, "You flipped the fourth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch5.uid, "aid", 4005)
        elseif item.actionid == 4005 then
                doPlayerSay(cid, "You flipped the fifth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch6.uid, "aid", 4006)
        elseif item.actionid == 4006 then
                doPlayerSay(cid, "You flipped the sixth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch7.uid, "aid", 4007)
        elseif item.actionid == 4007 then
                doPlayerSay(cid, "You flipped the seventh lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch8.uid, "aid", 4008)
        elseif item.actionid == 4008 then
                doPlayerSay(cid, "You flipped the eighth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch9.uid, "aid", 4009)
        elseif item.actionid == 4009 then
                doPlayerSay(cid, "You flipped the ninth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch10.uid, "aid", 4010)
        elseif item.actionid == 4010 then
                doPlayerSay(cid, "You flipped the tenth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch11.uid, "aid", 4011)
        elseif item.actionid == 4011 then
                doPlayerSay(cid, "You flipped the eleventh lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch12.uid, "aid", 4012)
        elseif item.actionid == 4012 then
                doPlayerSay(cid, "You flipped the twelfth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch13.uid, "aid", 4013)
        elseif item.actionid == 4013 then
                doPlayerSay(cid, "You flipped the thirteenth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch14.uid, "aid", 4014)
        elseif item.actionid == 4014 then
                doPlayerSay(cid, "You flipped the fourteenth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch15.uid, "aid", 4015)
        elseif item.actionid == 4015 then
                doPlayerSay(cid, "You flipped the fifteenth lever. Hurry up and find the last one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch16.uid, "aid", 4016)
        elseif item.actionid == 4016 then
                doPlayerSay(cid, "You flipped the last lever.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doRemoveItem(stone1.uid)
                doRemoveItem(stone2.uid)
                addEvent(doCreateItem, 60*1000*30, *stone1 itemid*, {x=458,y=1386,z=11})
                addEvent(doCreateItem, 60*1000*30, *stone2 itemid*, {x=459,y=1386,z=11})
        end
        doTransformItem(item.uid, item.itemid + 1)
        return true

end
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 1946) then
		doTransformItem(item.uid, item.itemid - 1)
		return true
	elseif(item.itemid ~= 1945 or item.actionid < 1) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		return true
	elseif item.actionid == 4001 then
		doCreatureSay(cid, "You flipped the first lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(getTileItemById({x=498, y=1381, z=13}, 1945).uid, "aid", 4002)
	elseif item.actionid == 4002 then
		doCreatureSay(cid, "You flipped the second lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=450, y=1415, z=13}, 1945).uid, "aid", 4003)
	elseif item.actionid == 4003 then
		doCreatureSay(cid, "You flipped the third lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=496, y=1402, z=14}, 1945).uid, "aid", 4004)
	elseif item.actionid == 4004 then
		doCreatureSay(cid, "You flipped the fourth lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=494, y=1386, z=11}, 1945).uid, "aid", 4005)
	elseif item.actionid == 4005 then
		doCreatureSay(cid, "You flipped the fifth lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=453, y=1381, z=11}, 1945).uid, "aid", 4006)
	elseif item.actionid == 4006 then
		doCreatureSay(cid, "You flipped the sixth lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=494, y=1408, z=12}, 1945).uid, "aid", 4007)
	elseif item.actionid == 4007 then
		doCreatureSay(cid, "You flipped the seventh lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=460, y=1412, z=13}, 1945).uid, "aid", 4008)
	elseif item.actionid == 4008 then
		doCreatureSay(cid, "You flipped the eighth lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=450, y=1412, z=11}, 1945).uid, "aid", 4009)
	elseif item.actionid == 4009 then
		doCreatureSay(cid, "You flipped the ninth lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=454, y=1385, z=12}, 1945).uid, "aid", 4010)
	elseif item.actionid == 4010 then
		doCreatureSay(cid, "You flipped the tenth lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=493, y=1390, z=12}, 1945).uid, "aid", 4011)
	elseif item.actionid == 4011 then
		doCreatureSay(cid, "You flipped the eleventh lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=481, y=1418, z=12}, 1945).uid, "aid", 4012)
	elseif item.actionid == 4012 then
		doCreatureSay(cid, "You flipped the twelfth lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=457, y=1419, z=12}, 1945).uid, "aid", 4013)
	elseif item.actionid == 4013 then
		doCreatureSay(cid, "You flipped the thirteenth lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=467, y=1417, z=12}, 1945).uid, "aid", 4014)
	elseif item.actionid == 4014 then
		doCreatureSay(cid, "You flipped the fourteenth lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=481, y=1407, z=13}, 1945).uid, "aid", 4015)
	elseif item.actionid == 4015 then
		doCreatureSay(cid, "You flipped the fifteenth lever. Hurry up and find the last one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=455, y=1388, z=11}, 1945).uid, "aid", 4016)
	elseif item.actionid == 4016 then
		doCreatureSay(cid, "You flipped the last lever!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doRemoveItem(getTileItemById({x=458, y=1386, z=11}, 1304).uid)
		doRemoveItem(getTileItemById({x=459, y=1386, z=11}, 1304).uid)
		doSendMagicEffect({x=458, y=1386, z=11}, CONST_ME_EXPLOSIONAREA)
		doSendMagicEffect({x=459, y=1386, z=11}, CONST_ME_EXPLOSIONAREA)
		addEvent(doCreateItem, 30 * 60000, 1304, {x=458,y=1386,z=11})
		addEvent(doCreateItem, 30 * 60000, 1304, {x=459,y=1386,z=11})
	end
	doTransformItem(item.uid, 1946)
	return true
end
 
Last edited:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 1946) then
		doTransformItem(item.uid, item.itemid - 1)
		return true
	elseif(item.itemid ~= 1945 or item.actionid < 1) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		return true
	elseif item.actionid == 4001 then
		doCreatureSay(cid, "You flipped the first lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(getTileItemById({x=498, y=1381, z=13}, 1945).uid, "aid", 4002)
	elseif item.actionid == 4002 then
		doCreatureSay(cid, "You flipped the second lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=450, y=1415, z=13}, 1945).uid, "aid", 4003)
	elseif item.actionid == 4003 then
		doCreatureSay(cid, "You flipped the third lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=496, y=1402, z=14}, 1945).uid, "aid", 4004)
	elseif item.actionid == 4004 then
		doCreatureSay(cid, "You flipped the fourth lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=494, y=1386, z=11}, 1945).uid, "aid", 4005)
	elseif item.actionid == 4005 then
		doCreatureSay(cid, "You flipped the fifth lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=453, y=1381, z=11}, 1945).uid, "aid", 4006)
	elseif item.actionid == 4006 then
		doCreatureSay(cid, "You flipped the sixth lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=494, y=1408, z=12}, 1945).uid, "aid", 4007)
	elseif item.actionid == 4007 then
		doCreatureSay(cid, "You flipped the seventh lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=460, y=1412, z=13}, 1945).uid, "aid", 4008)
	elseif item.actionid == 4008 then
		doCreatureSay(cid, "You flipped the eighth lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=450, y=1412, z=11}, 1945).uid, "aid", 4009)
	elseif item.actionid == 4009 then
		doCreatureSay(cid, "You flipped the ninth lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=454, y=1385, z=12}, 1945).uid, "aid", 4010)
	elseif item.actionid == 4010 then
		doCreatureSay(cid, "You flipped the tenth lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=493, y=1390, z=12}, 1945).uid, "aid", 4011)
	elseif item.actionid == 4011 then
		doCreatureSay(cid, "You flipped the eleventh lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=481, y=1418, z=12}, 1945).uid, "aid", 4012)
	elseif item.actionid == 4012 then
		doCreatureSay(cid, "You flipped the twelfth lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=457, y=1419, z=12}, 1945).uid, "aid", 4013)
	elseif item.actionid == 4013 then
		doCreatureSay(cid, "You flipped the thirteenth lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=467, y=1417, z=12}, 1945).uid, "aid", 4014)
	elseif item.actionid == 4014 then
		doCreatureSay(cid, "You flipped the fourteenth lever. Hurry up and find the next one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=481, y=1407, z=13}, 1945).uid, "aid", 4015)
	elseif item.actionid == 4015 then
		doCreatureSay(cid, "You flipped the fifteenth lever. Hurry up and find the last one!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doItemSetAttribute(getTileItemById({x=455, y=1388, z=11}, 1945).uid, "aid", 4016)
	elseif item.actionid == 4016 then
		doCreatureSay(cid, "You flipped the last lever!", TALKTYPE_ORANGE_1)
		doItemSetAttribute(item.uid, "aid", 0)
		doRemoveItem(getTileItemById({x=458, y=1386, z=11}, 1304).uid)
		doRemoveItem(getTileItemById({x=459, y=1386, z=11}, 1304).uid)
		doSendMagicEffect({x=458, y=1386, z=11}, CONST_ME_EXPLOSIONAREA)
		doSendMagicEffect({x=459, y=1386, z=11}, CONST_ME_EXPLOSIONAREA)
		addEvent(doCreateItem, 30 * 60000, 1304*, {x=458,y=1386,z=11})
		addEvent(doCreateItem, 30 * 60000, 1304, {x=459,y=1386,z=11})
	end
	doTransformItem(item.uid, 1946)
	return true
end


[26/02/2010 21:08:52] [Error - LuaScriptInterface::loadFile] data/actions/scripts/quests/pitsOfInferno/levers.lua:74: unexpected symbol near ','
[26/02/2010 21:08:52] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/pitsOfInferno/levers.lua)
[26/02/2010 21:08:52] data/actions/scripts/quests/pitsOfInferno/levers.lua:74: unexpected symbol near ','

got this on yours, using 0.3.6 pl1
 
Code:
local switch2 = getThingFromPos({x=498, y=1381, z=13})
local switch3 = getThingFromPos({x=450, y=1415, z=13})
local switch4 = getThingFromPos({x=496, y=1402, z=14})
local switch5 = getThingFromPos({x=494, y=1386, z=11})
local switch6 = getThingFromPos({x=453, y=1381, z=11})
local switch7 = getThingFromPos({x=494, y=1408, z=12})
local switch8 = getThingFromPos({x=460, y=1412, z=13})
local switch9 = getThingFromPos({x=450, y=1412, z=11})
local switch10 = getThingFromPos({x=454, y=1385, z=12})
local switch11 = getThingFromPos({x=493, y=1390, z=12})
local switch12 = getThingFromPos({x=481, y=1418, z=12})
local switch13 = getThingFromPos({x=457, y=1419, z=12})
local switch14 = getThingFromPos({x=467, y=1417, z=12})
local switch15 = getThingFromPos({x=481, y=1407, z=13})
local switch16 = getThingFromPos({x=455, y=1388, z=11})
local stone1 = getThingFromPos({x=458, y=1386, z=11})
local stone2 = getThingFromPos({x=459, y=1386, z=11})

function onUse(cid, item, frompos, item2, topos)
        if(item.itemid == 1946) then
                doTransformItem(item.uid, item.itemid - 1)
                return true
        end

        if(item.itemid ~= 1945) then
                return true
        end        
       
        if item.actionid == 4001 then
                doPlayerSay(cid, "You flipped the first lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(switch2.uid, "aid", 4002)
        elseif item.actionid == 4002 then
                doPlayerSay(cid, "You flipped the second lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch3.uid, "aid", 4003)
        elseif item.actionid == 4003 then
                doPlayerSay(cid, "You flipped the third lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch4.uid, "aid", 4004)
        elseif item.actionid == 4004 then
                doPlayerSay(cid, "You flipped the fourth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch5.uid, "aid", 4005)
        elseif item.actionid == 4005 then
                doPlayerSay(cid, "You flipped the fifth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch6.uid, "aid", 4006)
        elseif item.actionid == 4006 then
                doPlayerSay(cid, "You flipped the sixth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch7.uid, "aid", 4007)
        elseif item.actionid == 4007 then
                doPlayerSay(cid, "You flipped the seventh lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch8.uid, "aid", 4008)
        elseif item.actionid == 4008 then
                doPlayerSay(cid, "You flipped the eighth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch9.uid, "aid", 4009)
        elseif item.actionid == 4009 then
                doPlayerSay(cid, "You flipped the ninth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch10.uid, "aid", 4010)
        elseif item.actionid == 4010 then
                doPlayerSay(cid, "You flipped the tenth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch11.uid, "aid", 4011)
        elseif item.actionid == 4011 then
                doPlayerSay(cid, "You flipped the eleventh lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch12.uid, "aid", 4012)
        elseif item.actionid == 4012 then
                doPlayerSay(cid, "You flipped the twelfth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch13.uid, "aid", 4013)
        elseif item.actionid == 4013 then
                doPlayerSay(cid, "You flipped the thirteenth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch14.uid, "aid", 4014)
        elseif item.actionid == 4014 then
                doPlayerSay(cid, "You flipped the fourteenth lever. Hurry up and find the next one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch15.uid, "aid", 4015)
        elseif item.actionid == 4015 then
                doPlayerSay(cid, "You flipped the fifteenth lever. Hurry up and find the last one.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doItemSetAttribute(switch16.uid, "aid", 4016)
        elseif item.actionid == 4016 then
                doPlayerSay(cid, "You flipped the last lever.", 16)
                doItemSetAttribute(item.uid, "aid", 0)
                doRemoveItem(stone1.uid)
                doRemoveItem(stone2.uid)
                addEvent(doCreateItem, 60*1000*30, *stone1 itemid*, {x=458,y=1386,z=11})
                addEvent(doCreateItem, 60*1000*30, *stone2 itemid*, {x=459,y=1386,z=11})
        end
        doTransformItem(item.uid, item.itemid + 1)
        return true

end

[26/02/2010 21:10:10] [Error - LuaScriptInterface::loadFile] data/actions/scripts/quests/pitsOfInferno/levers.lua:93: unexpected symbol near '*'
[26/02/2010 21:10:10] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/pitsOfInferno/levers.lua)
[26/02/2010 21:10:10] data/actions/scripts/quests/pitsOfInferno/levers.lua:93: unexpected symbol near '*'

and this on yours

sorry for double post :(
 
[26/02/2010 21:08:52] [Error - LuaScriptInterface::loadFile] data/actions/scripts/quests/pitsOfInferno/levers.lua:74: unexpected symbol near ','
[26/02/2010 21:08:52] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/pitsOfInferno/levers.lua)
[26/02/2010 21:08:52] data/actions/scripts/quests/pitsOfInferno/levers.lua:74: unexpected symbol near ','

got this on yours, using 0.3.6 pl1
-facepalm-

next time remove that asterisk yourself
 
Back
Top