Page 1 of 1

File not found, but file exists

Posted: Wed Jan 25, 2023 5:32 pm
by DemerNkardaz
Wrote some code for change icons of Rampant biters icons and get error "file not found". I readed rereaded rerereaded what I wrote and checks written paths, but I don't found any error. Maybe I just blind.

ImageImage

Code: Select all

local rampant_icon = "__PLORD__/graphics/icons/rampant/"

for e_name, entity in pairs(data.raw["unit"]) do
	if e_name:find("biter") then 
		if e_name:find("neutral") then entity.icon = rampant_icon .. "common_biter" end
		if e_name:find("acid") then entity.icon = rampant_icon .. "acid_biter" end
		if e_name:find("laser") then entity.icon = rampant_icon .. "laser_biter" end
		if e_name:find("fire") then entity.icon = rampant_icon .. "fire_biter" end
		if e_name:find("inferno") then entity.icon = rampant_icon .. "inferno_biter" end
		if e_name:find("wasp") then entity.icon = rampant_icon .. "wasp_biter" end
		if e_name:find("spawner") then entity.icon = rampant_icon .. "spawner_biter" end
		if e_name:find("electric") then entity.icon = rampant_icon .. "electric_biter" end
		if e_name:find("physical") then entity.icon = rampant_icon .. "physical_biter" end
		if e_name:find("troll") then entity.icon = rampant_icon .. "troll_biter" end
		if e_name:find("poison") then entity.icon = rampant_icon .. "poison_biter" end
		if e_name:find("suicide") then entity.icon = rampant_icon .. "suicide_biter" end
		if e_name:find("nuclear") then entity.icon = rampant_icon .. "nuclear_biter" end
		if e_name:find("energy-thief") then entity.icon = rampant_icon .. "energy_thief_biter" end
		if e_name:find("juggernaut") then entity.icon = rampant_icon .. "juggernaut_biter" end
		if e_name:find("fast") then entity.icon = rampant_icon .. "fast_biter" end
		if e_name:find("arachnid") then entity.icon = rampant_icon .. "arachnid_biter" end
	end
	if e_name:find("spitter") then 
		if e_name:find("neutral") then entity.icon = rampant_icon .. "common_spitter" end
		if e_name:find("acid") then entity.icon = rampant_icon .. "acid_spitter" end
		if e_name:find("laser") then entity.icon = rampant_icon .. "laser_spitter" end
		if e_name:find("fire") then entity.icon = rampant_icon .. "fire_spitter" end
		if e_name:find("inferno") then entity.icon = rampant_icon .. "inferno_spitter" end
		if e_name:find("wasp") then entity.icon = rampant_icon .. "wasp_spitter" end
		if e_name:find("spawner") then entity.icon = rampant_icon .. "spawner_spitter" end
		if e_name:find("electric") then entity.icon = rampant_icon .. "electric_spitter" end
		if e_name:find("physical") then entity.icon = rampant_icon .. "physical_spitter" end
		if e_name:find("troll") then entity.icon = rampant_icon .. "troll_spitter" end
		if e_name:find("poison") then entity.icon = rampant_icon .. "poison_spitter" end
		if e_name:find("suicide") then entity.icon = rampant_icon .. "suicide_spitter" end
		if e_name:find("nuclear") then entity.icon = rampant_icon .. "nuclear_spitter" end
		if e_name:find("energy-thief") then entity.icon = rampant_icon .. "energy_thief_spitter" end
		if e_name:find("juggernaut") then entity.icon = rampant_icon .. "juggernaut_spitter" end
		if e_name:find("fast") then entity.icon = rampant_icon .. "fast_spitter" end
		if e_name:find("arachnid") then entity.icon = rampant_icon .. "arachnid_spitter" end
	end
	if e_name:find("worm") then 
		if e_name:find("neutral") then entity.icon = rampant_icon .. "common_worm" end
		if e_name:find("acid") then entity.icon = rampant_icon .. "acid_worm" end
		if e_name:find("laser") then entity.icon = rampant_icon .. "laser_worm" end
		if e_name:find("fire") then entity.icon = rampant_icon .. "fire_worm" end
		if e_name:find("inferno") then entity.icon = rampant_icon .. "inferno_worm" end
		if e_name:find("wasp") then entity.icon = rampant_icon .. "wasp_worm" end
		if e_name:find("spawner") then entity.icon = rampant_icon .. "spawner_worm" end
		if e_name:find("electric") then entity.icon = rampant_icon .. "electric_worm" end
		if e_name:find("physical") then entity.icon = rampant_icon .. "physical_worm" end
		if e_name:find("troll") then entity.icon = rampant_icon .. "troll_worm" end
		if e_name:find("poison") then entity.icon = rampant_icon .. "poison_worm" end
		if e_name:find("suicide") then entity.icon = rampant_icon .. "suicide_worm" end
		if e_name:find("nuclear") then entity.icon = rampant_icon .. "nuclear_worm" end
		if e_name:find("energy-thief") then entity.icon = rampant_icon .. "energy_thief_worm" end
		if e_name:find("juggernaut") then entity.icon = rampant_icon .. "juggernaut_worm" end
		if e_name:find("fast") then entity.icon = rampant_icon .. "fast_worm" end
		if e_name:find("arachnid") then entity.icon = rampant_icon .. "arachnid_worm" end
	end
end

Re: File not found, but file exists

Posted: Wed Jan 25, 2023 5:36 pm
by Rseding91
You need to provide the file extension.

Re: File not found, but file exists

Posted: Wed Jan 25, 2023 5:39 pm
by DemerNkardaz
Rseding91 wrote: Wed Jan 25, 2023 5:36 pm You need to provide the file extension.
Strange, in some paths I was not used extension for img, and it was works, maybe this was exclude from rule

Ye, this was exclude or lucky? bug, with extension all icons works.
Image