FANDOM


What is new (August 17th)

  • Should now handle structures as well as other quotes that have state based variants.
  • Should work smoothly with DST (You need to be in the scripts folder for DST, which is the folder that contains speech*.lua files)
  • Some bug fixes.
  • Instructions below have been updated a bit, make sue you read them again.

Usage

So, We now have the new Quotes template, allowing all character quotes to exist on the page, instead of having to select one. I've written a simple (and stupid) powershell script to auto generate the template text for any given item, including Wigfrid umlauts. Here is how it works (For Windows & Steam):

  1. Open Powershell by searching for powershell in the start menu.
  2. Open steam, From Don't Starve properties, local files tab, you'll have the "Browse Local Files" option.
  3. This will open windows explorer with the root folder of Don't Starve. Copy the location.
  4. In Powershell type this:cd "<paste the path from above>\data\DLC0002\scripts"
    • You paste to powershell by right mouse click. If you select contents in the window and right click that will copy selected content.
  5. Copy the entire script from the code section below.
  6. Once you've done these steps, you can get quotes by repeating the next two steps.
  7. Get-DSQuotes itemprefab
    • If some quotes are not found it would mean There are multiple conditional quotes for the same object/situation. The script does its best to handle them, but that may not be enough. You'll need to open one of the speech files, find what is the specific identifier to be used, then use that as a second parameter
    • example: Get-DSQuotes homesign burnt
    • When the second parameter is not specified, it is assumed to be "generic", which will work most of the time, but not always.
  8. Always validate what the script outputs before putting it on a page. There are ambiguities in the files, and quotes may be found for things that do not exactly match what you need them for. Unfortunately it is difficult to make the script handle all the cases without investing significantly more time into to (time that I don't have). So if you don't get the correct result, either find the strings manually, or just leave it be. I may be able to get the quotes for those case quickly with quick hacks to the script.
  9. Copy the output, paste to the page, and specify a character for the choose value.

For example:

Get-DSQuotes bonestew

Gives you:

{{Quotes
|wolfgang=Is stew full of strong meat.
|wilson=A stew to put some meat on my bones.
|willow=Just add fire to food and voila!
|woodie=Sticks to your ribs.
|maxwell=Leave no scrap unused.
|wendy=They died. And then I put them in a stew.
|woodlegs=Good fer th'scurvy.
|wickerbottom=Not quite how mum used to make, but it smells superb!
|webber=Smells like Sunday supper.
|warly=Warms my soul!
|wx78=NUTRITION ACQUIRED
|walani=It looks like a pretty hearty meal.
|wigfrid=Deliciöus!
|choose=
}}

Script

Here is the code. You should be able to simply paste this entire thing to Powershell window. If you feel comfortable, feel free to modify the script to match specific cases. If you make bigger changes or bug fixes that would benefit everyone, let me know, so I can update it here as well.

function Get-DSQuoteFromFile
{
param([string]$QuoteIdentifier, [string]$file, [bool]$umlaut, [string] $secondIdentifier);
if (-not $(test-path $file)) {return $null;};
$fileContent = get-content $file
$searchstring1 = '^'+$quoteidentifier.ToUpperInvariant() + '\s*=';
$searchstring2 = '^'+$quoteidentifier.ToUpperInvariant() + '\s*=\s*\".*\",';
$searchstring3 = '^'+$secondidentifier.ToUpperInvariant() + '\s*=\s*\".*\",';
$linesremaining = 0;
$fewlines = $filecontent |%{$_.trim()} |? {if ($_ -match $searchstring1){ $linesremaining=10}; return $linesremaining-- -gt 0}
if ($fewlines -eq $null) {write-Warning "Quote Not Found for primary"; return $null;}
if ($fewlines[0] -match $searchstring2)
{
#single quote
$line = $fewlines[0]
}
else
{
$line = $fewlines | ?{$_ -match $searchstring3}
}
if ($line -eq $null) {write-Warning "Quote Not Found for secondary"; return $null;}
Write-Debug "found line: $line"
if ($line -is [array])
{
$line = $line[0];
}
$start = $line.IndexOf('"');
$end = $line.LastIndexOf('",');
$quote = $line.Substring($start+1, $end - $start -1);
$quote = $quote.replace('\"','"');
if (-not $umlaut)
{
return $quote;
}
else
{
return $quote.Replace("O","Ö").Replace("o","ö");
}
}

function Get-DSQuotes
{
param([string]$QuoteIdentifier, [string] $secondIdentifier = "GENERIC");
$personFileMap = @{
"maxwell"="speech_maxwell.lua";
"walani"="speech_walani.lua";
"warly"="speech_warly.lua";
"wigfrid"="speech_wathgrithr.lua";
"webber"="speech_webber.lua";
"wendy"="speech_wendy.lua";
"wickerbottom"="speech_wickerbottom.lua";
"willow"="speech_willow.lua";
"wilson"="speech_wilson.lua";
"wolfgang"="speech_wolfgang.lua";
"woodie"="speech_woodie.lua";
"woodlegs"="speech_woodlegs.lua";
"wx78"="speech_wx78.lua";
}

Write-Output "{{Quotes"
foreach ($char in $personFileMap.Keys)
{
Write-Debug "Output for: $char from file $($personFileMap[$char])"
$quote = $(Get-DSQuoteFromFile -QuoteIdentifier $QuoteIdentifier -file $personFileMap[$char] -umlaut $($char -eq "wigfrid") -secondIdentifier $secondIdentifier)
if ($quote -ne $null)
{
Write-Output "|$char=$quote"
}
}
Write-Output "|choose="
Write-Output "}}"
}

Comment if you encounter problems.

Community content is available under CC-BY-SA unless otherwise noted.