avatar
Untitled

Guest 60 16th Jan, 2020

MARKUP 2.32 KB
                                           
                         macro(10000, "click dancing",  function()
	  for i, tile in ipairs(g_map.getTiles(posz())) do
		  for u,item in ipairs(tile:getItems()) do
			  if (item:getId() == 2772) then
				g_game.use(item) 
			  end
			end
		end
	end)	
	
	
	function hasSongEffect(tile)
	  for i, fx in ipairs(tile:getEffects()) do
		if ((fx:getId() == 22) or (fx:getId() == 23) or (fx:getId() == 24) or (fx:getId() == 25) or (fx:getId() == 19) or (fx:getId() == 20) or (fx:getId() == 6) or (fx:getId() == 5)) then
		  return true
		end
	  end
	  return false
	end

	function hasId(tile)
		for u,fx in ipairs(tile:getItems()) do
			if ((fx:getId() == 499) or (fx:getId() == 500) or (fx:getId() == 501) or (fx:getId() == 502) or (fx:getId() == 503) or (fx:getId() == 504) or (fx:getId() == 505)) then
				return true
			end
		end
		return false
	end

	local startPos

	macro(200, "song",  function()
		local playerTile = g_map.getTile(player:getPosition());
		if (not(startPos == nil)) then
			local lastPos = g_map.getTile(startPos)
			if ( not hasSongEffect(lastPos) and hasId(lastPos)) then
				autoWalk(startPos, 100, { ignoreNonPathable = true })
			end
		end

		if (hasSongEffect(playerTile)) then
			local pos1 = {x=player:getPosition().x+1, y=player:getPosition().y, z=player:getPosition().z}
			local tile1 = g_map.getTile(pos1)
			local pos2 = {x=player:getPosition().x, y=player:getPosition().y+1, z=player:getPosition().z}
			local tile2 = g_map.getTile(pos2)	
			local pos3 = {x=player:getPosition().x-1, y=player:getPosition().y, z=player:getPosition().z}
			local tile3 = g_map.getTile(pos3)
			local pos4 = {x=player:getPosition().x, y=player:getPosition().y-1, z=player:getPosition().z}
			local tile4 = g_map.getTile(pos4)
			

			
			if ( not hasSongEffect(tile1) and hasId(tile1)) then		
				autoWalk(pos1, 100, { ignoreNonPathable = true })
			elseif ( not hasSongEffect(tile2) and hasId(tile2)) then
				autoWalk(pos2, 100, { ignoreNonPathable = true })
			elseif ( not hasSongEffect(tile3) and hasId(tile3)) then
				autoWalk(pos3, 100, { ignoreNonPathable = true })
			elseif ( not hasSongEffect(tile4) and hasId(tile4)) then
				autoWalk(pos4, 100, { ignoreNonPathable = true })

			end		
			startPos = player:getPosition()
		end
	end)
                      
                                       
To share this paste please copy this url and send to your friends
RAW Paste Data
Recent Pastes