GE Lisä Scriptejä

Hyödyllisiä ohjeita ja oppaita Farming Simulator 19 peliin.
Avatar
Mr_Mazzony
Viestit: 579
Liittynyt: 06.06.2017 15:36
Kielet: Suomi, English, norja wc-ankan kanssa.
Multiplayer tunnuksesi?: Mr_Mazzony
Erikoisosaamiseni: Muokkaus
Paikkakunta: Pohjois-Karjala

GE Lisä Scriptejä

Viesti Kirjoittaja Mr_Mazzony »

Ei aloittelijoille. Oletus on että osaa käyttää Google Kääntäjää. Scriptit/ohjeet saksaksi.

Scriptit mahdollistaa puidrn massa asettelun, peltojen fieldDefinitionin luonnin, monen objectin liikuttelun ja monta muutakin asioita helpottavaa toimintaa.

https://ls-modcompany.com/forum/board/1 ... ollection/

!
Käy vilkasemassa menneet Streamit Youtubesta. Ja miks ei menossaolevia kans.
https://www.youtube.com/channel/UCs0Gc6 ... O0OBB_2FgA
Discord Serveri täällä:
https://discord.gg/Xcjv5Xedvp
Avatar
truck-king
Viestit: 249
Liittynyt: 12.02.2011 10:17
Multiplayer tunnuksesi?: Tunnuksesi?
Erikoisosaamiseni: Modaaminen

Re: GE Lisä Scriptejä

Viesti Kirjoittaja truck-king »

Jatketaan tähän, kun kuuluu samaan kategoriaan.

Väsäsin editori scriptin joka tekee automaattisesti i3dMappings:it. Riittää siis, kun nimeää Editorissa objektit samalla nimellä xml-tiedoston node-kohtien kanssa. Tämän jälkeen ei haittaa vaikka editorissa indexit vaihtuisivat, kunhan vain joka kerta päivittää tällä scriptillä i3dMappings:it. Luonnollisesti objektit joihin halutaan node-kohdilla viitata, eivät saa olla samannimisiä.

KREDIITIT: Truck-King

ASENNUS:
Kuva
SCRIPTI:

Koodi: Valitse kaikki

-- Author: Truck-King 
-- Name: i3dMapper
-- Description:Makes i3dMappings automatically.
-- Icon:iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAXFJREFUOI1t0l9L1FEQxvHP6qYY+S8tjLQkSyK8MbOCCqSLIF9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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACyyxeIeDkAiEge8Tr8fwAA2hoVAAAAAADoEAQAAAAAAAAAAIAAAAAAAQAAAAAAAAAgAAAAAAAAAAYAAAAAAAAAAwAAAGAAAABgAAAABgAAAAQAAAACAAAA////////////////AAAAAA==
-- Hide: no

    function makeChildMapping(node, indexPath)
        for i=0,(getNumOfChildren(node) - 1) do
            local child = getChildAt(node,i);
            local index = indexPath .. (i)
            local name = getName(child)
            if name ~= "null" and name ~= ""  then
                addMapping(name,index)
            end;
            if getNumOfChildren(child) > 0 then
                makeChildMapping(child, index .. "|");
            end;
        end;
    end;

    mapIndexCount = 0
    function addMapping(name, index)
        --print (name .. "  index:" .. index)
        if xmlFile ~= 0 then
            setXMLString(xmlFile, "vehicle.i3dMappings.i3dMapping(".. mapIndexCount ..")#id", name)
            setXMLString(xmlFile, "vehicle.i3dMappings.i3dMapping(".. mapIndexCount ..")#node", index)
        end;
        mapIndexCount = mapIndexCount + 1;
    end;



    local roots = getChildAt(getRootNode(), 0)

    local node = getChildAt(roots, 0)
    if node ~= 0 and getUserAttribute(node, "xml") ~= nil and getUserAttribute(node, "xml") ~= "" then
        xmlFileName = getSceneFilename() .. "/../" .. getUserAttribute(node, "xml")
    elseif node ~= 0 and getUserAttribute(node, "xmlP") ~= nil and getUserAttribute(node, "xmlP") ~= "" then
        xmlFileName = getUserAttribute(node, "xmlP")
    end
    
    if xmlFileName ~= nil then 
        xmlFile = loadXMLFile("XML", xmlFileName)
    else
        print("xml-tiedostopolkua ei ole määritetty!")
		print("Katso käyttöohjeet www.ls-fin.com")
        return;
    end;
    if xmlFile ~= 0 and hasXMLProperty(xmlFile, "vehicle") then
        if hasXMLProperty(xmlFile, "vehicle.i3dMappings") then
            removeXMLProperty(xmlFile, "vehicle.i3dMappings")
        end;
        print("Tiedoston lataus onnistunut, muokataan..")
    else
        print("XML-tiedostoa ei löydy tai se on viallinen!")
		print("Katso käyttöohjeet www.ls-fin.com")
        return;
    end;


    for childs = 0, (getNumOfChildren(roots) - 1) do
        local child = getChildAt(roots, childs);
        local name = getName(child)
        local index = childs .. ">"
        if name ~= "null" and name ~= "" and not(getHasClassId(child, ClassIds.CAMERA)) then
            addMapping(name,index)
        end;
        makeChildMapping(child, index);
    end;

    if xmlFile ~= 0 then
        saveXMLFile(xmlFile)
        print("Muokkaus onnistuneesti suoritettu!")
    end;
KÄYTTÖ:
Kuva
Aarnikotka ratissa tekee auton
Avatar
truck-king
Viestit: 249
Liittynyt: 12.02.2011 10:17
Multiplayer tunnuksesi?: Tunnuksesi?
Erikoisosaamiseni: Modaaminen

Re: GE Lisä Scriptejä

Viesti Kirjoittaja truck-king »

i3dMapper_Export:
Uusi versio ylläolevasta scriptistä. Eli i3d-mappingien automaattinen teko i3d:n perusteella. Tässä versiossa ei tarvitse pelleillä attribuuttien kanssa. Riittää, että i3d ja xml ovat samassa kansiossa ja nimetty samalla nimellä (esim. rattori.i3d ja rattori.xml) . Asennus samalla tavalla kuin yläpuolen viestissä.

Koodi: Valitse kaikki

-- Author: TeeKoo
-- Name: i3dMapperV2 (Export)
-- Description:Export i3dMappings
-- Icon:iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAYxJREFUOI3F0rFrk0EYBvDffSlfa41iaxXBYI2KQqSiiEOFgosiCP4Bbh1dFMTJpeBUFDro4iAuLln9A3Squ2MdiiXQQqkSKQnBNMnnkIv9bOLswXHHPc899zzvvfzvEVDAVNxDA61/8A+hGPcZ6nARG9iO80WOlB/FiA14G/GuCppRsRcdXB0hUIlYL84mKkmO0MFWtLmM8QNRS0gipzsA8gJ1LEUnJf3a5LMvI42c+iiBLNpq4QwWc9giLkRsEHdIAFZR1S/YbczE80soCqqhYDV/YeyAQBu78YV7uI5aklo491SYmndjesHSVlUx2xstkOE17qOMWcyGgrnTDzhyWSnrmDh+S5p1tIVhAdjEBzzCqz9Rgwxr7R8+br735Psnye6X4RrAHt7FdRypoBkKuriWnvCw/Njk0St0W6MF6DfM1xhJMmHl8Hnr+Nyqeb72TOPXDifv9iP09L+nZf97aniLlxASP8OYBm5OnjU/90YS+b0QbZaj0Lr9LpvGKUhnbN/Zcczf3dnDt9/ZzWybp//v3wAAAABJRU5ErkJgggAAAO8rTSYAAwCAFAAfUOBP0CDqOmkQotgIACswMJ0ZAC9EOlwAAAAAAAAAAAAAAAAAAAAAAAAAhAAxAAAAAACUURKYEQBET0NVTUV+MQAAbAAJAAQA775RSlplM1KkPS4AAABjuQ0AAAACAAAAAAAAAAAAQgAAAAAAByPvAEQAbwBjAHUAbQBlAG4AdABzAAAAQABzAGgAZQBsAGwAMwAyAC4AZABsAGwALAAtADIAMQA3ADcAMAAAABgAWgAxAAAAAAB7UIGREABNWUdBTUV+MQAAQgAJAAQA775RSjhoMVIGsy4AAABbuQ0AAAAGAAAAAAAAAAAAAAAAAAAAyH8FAE0AeQAgAEcAYQBtAGUAcwAAABgAcgAxAAAAAAAxUumsEABGQUM3RUF+MQAAWgAJAAQA7753TbZpMVIYtS4AAAC/WQYAAAANAAAAAAAAAAAAAAAAAAAA52PaAEYAYQByAG0AaQBuAGcAUwBpAG0AdQBsAGEAdABvAHIAMgAwADEAOQAAABgATgAxAAAAAAAwUjl6EABtb2RzAAA6AAkABADvvndNt2kxUgazLgAAAG99BwAAAAsAAAAAAAAAAAAAAAAAAAAwit0AbQBvAGQAcwAAABQAAAAAAAAAAAAAAAAAAIkrbyYABACLiVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAYxJREFUOI3F0rFrkw==
-- Hide: no

		local mapIndex = 0;
		local xmlFile = 0;

		function exportMappings()
			if hasXMLProperty(xmlFile, "vehicle.i3dMappings") then
				removeXMLProperty(xmlFile, "vehicle.i3dMappings")
				print("	Old i3dMappings removed")
			end;
			
			local root = getChildAt(getRootNode(), 0)		
			for childIndex = 0, (getNumOfChildren(root) - 1) do
				local child = getChildAt(root, childIndex);
				local name = getName(child)
				if name ~= "null" and name ~= "" and not(getHasClassId(child, ClassIds.CAMERA)) then
					addMappingToXml(name,childIndex .. ">")
				end
				makeChildMapping(child, childIndex .. ">");
			end;
			saveXMLFile(xmlFile)
			print("	File saved")
		end;

		function makeChildMapping(node, indexPath)
			for i=0,(getNumOfChildren(node) - 1) do
				local child = getChildAt(node,i);
				local index = indexPath .. (i)
				local name = getName(child)
				if name ~= "null" and name ~= "" then
					addMappingToXml(name,index)
				end;
				if getNumOfChildren(child) > 0 then
					makeChildMapping(child, index .. "|");
				end;
			end;
		end;

		function addMappingToXml(name, index)
			setXMLString(xmlFile, string.format("vehicle.i3dMappings.i3dMapping(%s)#id",mapIndex), name)
			setXMLString(xmlFile, string.format("vehicle.i3dMappings.i3dMapping(%s)#node",mapIndex), index)
			mapIndex = mapIndex + 1;
		end;
	
		print("i3dMapper (Export)")
		local path = getSceneFilename();
		path = string.gsub(path, "i3d", "xml")
		path = string.gsub(path, "I3D", "xml")
		
		if path ~= nil then 
			xmlFile = loadXMLFile("XML", path)
			if hasXMLProperty(xmlFile, "vehicle") then
				print(string.format("	Exporting i3dMappings to '%s'", path))					
				exportMappings()
			else
				print(string.format("	'%s' Not found or incorrect file", path))	
			end
		end
		print("i3dMapper (Export) finished")

i3dMapper_Import:

Vastaavanlainen kuin ylläoleva scripti. Toimii vain toiseen suuntaan. Eli nimeää i3d:n nodet i3dmappingsien pohjalta. Niille nodeille joille ei ole i3dmappingia määritetty, ei tehdä nimeen muutoksia.

Koodi: Valitse kaikki

-- Author: TeeKoo
-- Name: i3dMapperV2 (Import)
-- Description:Import i3dMappings
-- Icon:iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAUpJREFUOI3F0j9LW2EUBvBf/tS0kKEFN0URSgsBoeDioGNdBL9DNie/gmvo4KCjpXPWFoeOHUo/g4IQEVrS6QYxhJo21+Ge6Js/pWMPHO7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HBdj1a0AQAAsFuOVrQBAADQYI9WtAEAAJBfj1a0AQAAwFeOVrQBAAAQ6LRWtAEAALBhj1a0AQAAsGCPVrQBAADwX49WtAEAAJBej1a0AQAAUIe3VrQBAAAwYY9WtAEAAA==
-- Hide: no

		local xmlFile = 0;
		local totalChanges = 0;

		function importMappings()		
			local found = true
			local name =  ""
			local index = ""
			local i = 0
			local root = getChildAt(getRootNode(), 0)
			
			while(true) do
				found, name, index = getMappingFromXml(i)
				if not found then break end;
				i = i + 1
				setNodeName(name, index, root)		
			end	
		end;

		function setNodeName(name, index, node)
			for ind in string.gmatch(index, "%d+") do
				node = getChildAt(node, tonumber(ind))
			end
			local originName = getName(node)
			if originName ~= name then
				setName(node, name)
				print(string.format("	Node '%s' renamed to '%s'", originName, name))
				totalChanges = totalChanges + 1
			end
		end;

		function getMappingFromXml(mapIndex)
			if hasXMLProperty(xmlFile, string.format("vehicle.i3dMappings.i3dMapping(%d)", mapIndex)) then
				local name = getXMLString(xmlFile, string.format("vehicle.i3dMappings.i3dMapping(%s)#id",mapIndex))
				local index = getXMLString(xmlFile, string.format("vehicle.i3dMappings.i3dMapping(%s)#node",mapIndex))
				return true, name, index				
			end
			return false
		end;
	
		print("i3dMapper (Import)")
		local path = getSceneFilename();
		path = string.gsub(path, "i3d", "xml")
		path = string.gsub(path, "I3D", "xml")
		
		if path ~= nil then 
			xmlFile = loadXMLFile("XML", path)
			if hasXMLProperty(xmlFile, "vehicle.i3dMappings") then
				print(string.format("	Importing i3dMappings from '%s'", path))					
				importMappings()
			else
				print(string.format("	'%s' Not found or incorrect file", path))	
			end
		end
		print(string.format("i3dMapper (Import) finished, renamed %s nodes", totalChanges))
Aarnikotka ratissa tekee auton
Vastaa Viestiin

Palaa sivulle “Ohjeet ja oppaat”