Documentation for Vjek's scripts

develop
PeridexisErrant 2015-09-04 17:13:21 +10:00
parent 0a63afa977
commit f242872963
10 changed files with 103 additions and 60 deletions

@ -81,6 +81,7 @@ acwatkins acwatkins
Wes Malone wesQ3
Michon van Dooren MaienM
Seth Woodworth sethwoodworth
Vjek
======================= ==================== ===========================
And these are the cool people who made **Stonesense**.

@ -28,6 +28,8 @@ DFHack Future
view-item-info: adds information and customisable descriptions to item viewscreens
warn-starving: check for starving, thirsty, or very drowsy units and pause with warning if any are found
points: set number of points available at embark screen
Vjek's script collection: armoks-blessing, brainwash, elevate-mental,
elevate-physical, make-legendary, pref0adjust, rejuvenate
New tweaks
embark-profile-name: Allows the use of lowercase letters when saving embark profiles
kitchen-keys: Fixes DF kitchen meal keybindings

@ -2380,6 +2380,13 @@ directory.
Don't forget to `enable stockpiles` and create the `stocksettings` directory in
the DF folder before trying to use this plugin.
modtools/*
==========
Scripts which provide tools for modders, often with changes to the raw files.
Not intended to be called manually by end-users.
adaptation
==========
View or set level of cavern adaptation for the selected unit or the whole fort.
@ -2391,6 +2398,13 @@ add-thought
Adds a thought or emotion to the selected unit. Can be used by other scripts,
or the gui invoked by running ``add-thought gui`` with a unit selected.
armoks-blessing
===============
Runs the equivalent of rejuvenate, elevate_physical, elevate_mental, and brainwash
on all dwarves currently on the map. This is an extreme change, which sets every
stat to an ideal - legendary skills, great traits, and easy-to-satisfy preferences.
Use in moderation; it's as 'cheaty' as DFHack gets.
autofarm
========
Automatically handle crop selection in farm plots based on current plant stocks.
@ -2424,6 +2438,12 @@ If the name of the patch has no extension or directory separators, the
script uses ``hack/patches/<df-version>/<name>.dif``, thus auto-selecting
the version appropriate for the currently loaded executable.
brainwash
=========
Modify the personality traits of the selected dwarf to match an 'ideal'
personality - as stable and reliable as possible. This makes dwarves very
stable, preventing tantrums even after months of misery.
burial
======
Sets all unowned coffins to allow burial. ``burial -pets`` also allows burial
@ -2492,6 +2512,17 @@ drain-aquifer
=============
Remove all 'aquifer' tag from the map blocks. Irreversible.
elevate-mental
==============
Set all mental attributes of a dwarf to 2600, which is very high.
Other numbers can be passed as an argument: ``elevate-mental 100``
for example would make the dwarf very stupid indeed.
elevate-physical
================
As for elevate-mental, but for physical traits. High is good for soldiers,
while having an ineffective hammerer can be useful too...
exterminate
===========
Kills any unit of a given race.
@ -2644,6 +2675,13 @@ There are the following ways to invoke this command:
Parses and executes the lua statement like the interactive interpreter would.
make-legendary
==============
Makes the selected dwarf legendary in one skill, a group of skills, or all
skills. View groups with ``make-legendary classes``, or all skills with
``make-legendary list``. Use ``make-legendary MINING`` when you need something
dug up, or ``make-legendary all`` when only perfection will do.
make-monarch
============
Make the selected unit King or Queen of your civilisation.
@ -2682,6 +2720,18 @@ position
Reports the current time: date, clock time, month, and season. Also reports
location: z-level, cursor position, window size, and mouse location.
pref-adjust
===========
A two-stage script: ``pref-adjust clear`` removes preferences from all dwarves,
and ``pref-adjust`` inserts an 'ideal' set which is easy to satisfy::
Feb Idashzefon likes wild strawberries for their vivid red color, fisher berries
for their round shape, prickle berries for their precise thorns, plump helmets
for their rounded tops, prepared meals, plants, drinks, doors, thrones, tables and
beds. When possible, she prefers to consume wild strawberries, fisher berries,
prickle berries, plump helmets, strawberry wine, fisher berry wine, prickle berry
wine, and dwarven wine.
putontable
==========
Makes item appear on the table, like in adventure mode shops. Arguments: '-a'
@ -2696,6 +2746,11 @@ region-pops
===========
Show or modify the populations of animals in the region. Use ``region-pops`` for details.
rejuvenate
==========
Set the age of the selected dwarf to 20 years. Useful if valuable citizens are
getting old, or there are too many babies around...
remove-stress
=============
Sets stress to -1,000,000; the normal range is 0 to 500,000 with very stable or

@ -1,11 +1,9 @@
-- Adjust all attributes, personality, age and skills of all dwarves in play
-- place in /hack/scripts/ for ease of use
-- without arguments, all attributes, age & personalities are adjusted
-- arguments allow for skills to be adjusted as well
-- WARNING: USING THIS SCRIPT WILL ADJUST ALL DWARVES IN PLAY!
-- by vjek, version 5, 20140816, for DF(hack) 40.08
-- Praise Armok!
-- ---------------------------------------------------------------------------
-- by vjek
function rejuvenate(unit)
if unit==nil then
@ -193,4 +191,4 @@ else
print ("No skillname supplied, no skills will be adjusted. Pass argument 'list' to see a skill list, 'classes' to show skill classes, or use 'all' if you want all skills legendary.")
end
adjust_all_dwarves(skillname)
adjust_all_dwarves(skillname)

@ -1,9 +1,6 @@
-- This script will brainwash a dwarf, modifying their personality
-- usage is: target a unit in DF, and execute this script in dfhack
-- via ' lua /path/to/script '
-- by vjek, version 5, 20140816, for DF(hack) 40.08
-- Praise Armok!
-- for a in `awk -F= '{ print $2 }' input.txt`; do echo -n $a,; done
-- by vjek
function brainwash_unit(profile)
local i,unit_name
@ -61,4 +58,4 @@ else
print ("baseline will reset all personality traits to a default / the average.")
print ("stepford amplifies all good qualities to an excessive degree.")
print ("wrecked amplifies all bad qualities to an excessive degree.")
end
end

@ -1,8 +1,7 @@
-- This script will elevate all the mental attributes of a unit
-- usage is: target a unit in DF, and execute this script in dfhack
-- all physical attributes will be set to whatever the max value is
-- by vjek, version 5, 20140816, for DF(hack) 40.08
-- Praise Armok!
-- by vjek
function ElevateMentalAttributes(value)
unit=dfhack.gui.getSelectedUnit()

@ -1,8 +1,7 @@
-- This script will elevate all the physical attributes of a unit
-- usage is: target a unit in DF, and execute this script in dfhack
-- all physical attributes will be set to whatever the max value is
-- by vjek, version 5, 20140816, for DF(hack) 40.08
-- Praise Armok!
-- by vjek
function ElevatePhysicalAttributes(value)
unit=dfhack.gui.getSelectedUnit()

@ -1,10 +1,8 @@
-- This script will modify a skill or the skills of a single unit
-- usage is: target a unit in DF, and execute this script in dfhack
-- via ' lua /path/to/script skillname '
-- the skill will be increased to 20 (Legendary +5)
-- arguments 'list', 'classes' and 'all' added
-- by vjek, version 4, 20141016, for DF(hack) 40.08
-- Praise Armok!
-- by vjek
-- this function will return the number of elements, starting at zero.
-- useful for counting things where #foo doesn't work
@ -129,4 +127,4 @@ else
return
end
make_legendary(skillname)
make_legendary(skillname)

@ -1,16 +1,15 @@
-- Adjust all preferences of all dwarves in play
-- place in /hack/scripts/ for ease of use
-- all preferences are cleared, then set
-- WARNING: USING THIS SCRIPT WILL ADJUST ALL DWARVES IN PLAY!
-- by vjek, version 4, 20141016, for DF(hack) 40.08
-- Praise Armok!
-- by vjek
-- ---------------------------------------------------------------------------
function brainwash_unit(unit)
if unit==nil then
print ("No unit available! Aborting with extreme prejudice.")
return
end
if unit==nil then
print ("No unit available! Aborting with extreme prejudice.")
return
end
local pss_counter=31415926
@ -63,31 +62,31 @@ function clear_preferences(v)
unit=v
local prefs=unit.status.current_soul.preferences
for index,pref in ipairs(prefs) do
pref:delete()
end
for index,pref in ipairs(prefs) do
pref:delete()
end
prefs:resize(0)
end
-- ---------------------------------------------------------------------------
function clearpref_all_dwarves()
for _,v in ipairs(df.global.world.units.active) do
if v.race == df.global.ui.race_id then
print("Clearing Preferences for "..dfhack.TranslateName(dfhack.units.getVisibleName(v)))
clear_preferences(v)
end
end
for _,v in ipairs(df.global.world.units.active) do
if v.race == df.global.ui.race_id then
print("Clearing Preferences for "..dfhack.TranslateName(dfhack.units.getVisibleName(v)))
clear_preferences(v)
end
end
end
-- ---------------------------------------------------------------------------
function adjust_all_dwarves()
for _,v in ipairs(df.global.world.units.active) do
if v.race == df.global.ui.race_id then
print("Adjusting "..dfhack.TranslateName(dfhack.units.getVisibleName(v)))
brainwash_unit(v)
end
end
for _,v in ipairs(df.global.world.units.active) do
if v.race == df.global.ui.race_id then
print("Adjusting "..dfhack.TranslateName(dfhack.units.getVisibleName(v)))
brainwash_unit(v)
end
end
end
-- ---------------------------------------------------------------------------
-- main script operation starts here
-- ---------------------------------------------------------------------------
clearpref_all_dwarves()
adjust_all_dwarves()
adjust_all_dwarves()

@ -1,29 +1,24 @@
-- This script will make any "old" dwarf 20 years old
-- usage is: target a unit in DF, and execute this script in dfhack
-- via ' lua /path/to/script '
-- the target will be changed to 20 years old
-- by vjek, version 5, 20141016, for DF(hack) 40.08
-- Paise Armok!
-- by vjek
function rejuvenate()
local current_year,newbirthyear
unit=dfhack.gui.getSelectedUnit()
local current_year,newbirthyear
unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor! Aborting with extreme prejudice.")
return
end
if unit==nil then print ("No unit under cursor! Aborting.") return end
current_year=df.global.cur_year
newbirthyear=current_year - 20
if unit.relations.birth_year < newbirthyear then
unit.relations.birth_year=newbirthyear
end
if unit.relations.old_year < current_year+100 then
unit.relations.old_year=current_year+100
end
print (dfhack.TranslateName(dfhack.units.getVisibleName(unit)).." is now 20 years old and will live at least 100 years")
current_year=df.global.cur_year
newbirthyear=current_year - 20
if unit.relations.birth_year < newbirthyear then
unit.relations.birth_year=newbirthyear
end
if unit.relations.old_year < current_year+100 then
unit.relations.old_year=current_year+100
end
print (dfhack.TranslateName(dfhack.units.getVisibleName(unit)).." is now 20 years old and will live at least 100 years")
end
rejuvenate()
rejuvenate()