When loading a save it shows the following error: __SuperLab__/control.lua:29:')' expected (to close ')' at line 1) near 'end'
Everything has been explained and clarified, thanks for all your help, cheers



Code: Select all
game.onevent(defines.events.ontick,function(event)
  if game.player.character and game.player.character.insert and game.player.character.insert.name == "superlab" and game.player.character.insert.getinventory(2).getitemcount("superlab") >= 1 and event.tick-glob.superlab >=180 then
    local superlab = game.findentities{{game.player.character.insert.position.x-5,game.player.character.insert.position.y-5},{game.player.character.insert.position.x+5,game.player.character.insert.position.y+5}}
    local drop = false
    local biters = 0
    for k,v in pairs(superlab) do
      if v.force.equals(game.forces.enemy) then
        biters = biters + 1
        if biters < 5 then
          drop = false
        end
      end
    end
  end
  if drop then
    glob.superlab=event.tick
	  for k,c in pairs(superlab) do
	    if v.force.equals(game.forces.enemy) then
		  if v.health then
		    v.die()
	      else
	        v.destroy()
	      end
        end
      end
      game.player.character.insert.getinventory(2).remove{name="superlab", count=1}
    end
  end
end)Code: Select all
game.findentities{{ stuff },{stuff}}Code: Select all
game.findentities({stuff},{stuff})

DevilOwnpag wrote:I put the wrong file...
here it isCode: Select all
game.onevent(defines.events.ontick,function(event) if game.player.character and game.player.character.insert and game.player.character.insert.name == "superlab" and game.player.character.insert.getinventory(2).getitemcount("superlab") >= 1 and event.tick-glob.superlab >=180 then local superlab = game.findentities{{game.player.character.insert.position.x-5,game.player.character.insert.position.y-5},{game.player.character.insert.position.x+5,game.player.character.insert.position.y+5}} local drop = false local biters = 0 for k,v in pairs(superlab) do if v.force.equals(game.forces.enemy) then biters = biters + 1 if biters < 5 then drop = false end end end end if drop then glob.superlab=event.tick for k,c in pairs(superlab) do if v.force.equals(game.forces.enemy) then if v.health then v.die() else v.destroy() end end end game.player.character.insert.getinventory(2).remove{name="superlab", count=1} end end end)
Code: Select all
game.onevent(defines.events.ontick,function(event)
	if game.player.character and game.player.character.insert and game.player.character.insert.name == "superlab" and game.player.character.insert.getinventory(2).getitemcount("superlab") >= 1 and event.tick-glob.superlab >=180 then
		local superlab = game.findentities{{game.player.character.insert.position.x-5,game.player.character.insert.position.y-5},{game.player.character.insert.position.x+5,game.player.character.insert.position.y+5}}
		local drop = false
		local biters = 0
		for k,v in pairs(superlab) do
			if v.force.equals(game.forces.enemy) then
			biters = biters + 1
				if biters < 5 then
					drop = false
				end
			end
		end
	end
	if drop then
		glob.superlab=event.tick
			for k,c in pairs(superlab) do
				if v.force.equals(game.forces.enemy) then
					if v.health then
					v.die()
					else
					v.destroy()
					end
				end
			end
		game.player.character.insert.getinventory(2).remove{name="superlab", count=1}
	end
end)