<?xml version="1.0"?>
<rss version="2.0"><channel><title/><link>https://www.loverslab.com/blogs/blog/1803-skyrim-tips-tricks/</link><description><![CDATA[<p>
	Conveniences for Skyrim modding and game play.
</p>
]]></description><language>en</language><item><title>Running Script Functions From a Batch File</title><link>https://www.loverslab.com/blogs/entry/15987-running-script-functions-from-a-batch-file/</link><description><![CDATA[<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	Batch files offer a convenient way to run console commands, but they're limited to the available console commands.  A simple way to run a script, with all the power of script functions, is to create a simple quest that runs a script at startup and then shuts down.  Here's an example.
</p>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	 
</p>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	I sometimes want to know the editor ID and Form ID of the cell where my character is.  If something looks wrong there, I'd like to quickly check it in a mod editor, or perhaps it's an interesting place that I'd like to return to with COC.
</p>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	 
</p>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	I made a simple quest that runs a script to print the cell info to the console and then stop.
</p>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	 
</p>

<div class="ipsSpoiler" data-ipsspoiler="">
	<div class="ipsSpoiler_header">
		<span>Spoiler</span>
	</div>

	<div class="ipsSpoiler_contents ipsClearfix">
		<p>
			<a class="ipsAttachLink ipsAttachLink_image" href="https://www.loverslab.com/uploads/monthly_2022_02/WhereAmI.png.e407d5750a7cdb0640d6483e5e230744.png" data-fileid="1383593" data-fileext="png" rel=""><img class="ipsImage ipsImage_thumbnailed" data-fileid="1383593" data-ratio="228.33" data-unique="4suoye6mx" width="473" alt="WhereAmI.png" src="https://www.loverslab.com/uploads/monthly_2022_02/WhereAmI.thumb.png.5e27b238f5cb5d7c651e5141abb29126.png"></a>
		</p>
	</div>
</div>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	 
</p>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	 
</p>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	<strong>The script</strong>
</p>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	Scriptname WhereAmI extends Quest
</p>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	Actor Property Player auto
</p>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	Function Fragment_0()<br>
	    MiscUtil.PrintConsole(Player.GetParentCell() + " " + Player.GetParentCell().GetName())<br>
	    Stop()<br>
	EndFunction
</p>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	 
</p>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	<strong>The batch file</strong>
</p>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	StartQuest 0WhereAmI
</p>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	 
</p>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	<strong>Example output</strong>
</p>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	Cell &lt;SolitudeExterior01 (0000927B)&gt;
</p>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	 
</p>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	 
</p>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	As another example, I have a personal mod with some non-respawning containers.  Sometimes I like to drop one at the PC's position.  I used to do that with a batch file and the PlaceAtMe command with a hard-coded Form ID.  That works until I start a new game with a different mod list and the mod index for the container changes.  I added a simple quest to that mod that passes the container ID to a script.  The script spawns a new instance of the container at the PC's position, and for good measure rotates it 90 degrees (it looks better that way).  The script also moves it 25 units in the direction the PC is facing, so I don't end up awkwardly standing on it; this also lets me place the container closer to a wall, cliff, or tree than my character can approach.
</p>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	 
</p>

<p style="background-color:#1c1c1c; color:#bcbcbc; font-size:14px; text-align:start">
	It's a little extra work up front, but it lets me conveniently do things that console commands alone can't accomplish.
</p>
]]></description><guid isPermaLink="false">15987</guid><pubDate>Sun, 27 Feb 2022 21:03:00 +0000</pubDate></item></channel></rss>
