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 Wes Malone wesQ3
Michon van Dooren MaienM Michon van Dooren MaienM
Seth Woodworth sethwoodworth Seth Woodworth sethwoodworth
Vjek
======================= ==================== =========================== ======================= ==================== ===========================
And these are the cool people who made **Stonesense**. 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 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 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 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 New tweaks
embark-profile-name: Allows the use of lowercase letters when saving embark profiles embark-profile-name: Allows the use of lowercase letters when saving embark profiles
kitchen-keys: Fixes DF kitchen meal keybindings kitchen-keys: Fixes DF kitchen meal keybindings

@ -2380,6 +2380,13 @@ directory.
Don't forget to `enable stockpiles` and create the `stocksettings` directory in Don't forget to `enable stockpiles` and create the `stocksettings` directory in
the DF folder before trying to use this plugin. 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 adaptation
========== ==========
View or set level of cavern adaptation for the selected unit or the whole fort. 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, 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. 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 autofarm
======== ========
Automatically handle crop selection in farm plots based on current plant stocks. 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 script uses ``hack/patches/<df-version>/<name>.dif``, thus auto-selecting
the version appropriate for the currently loaded executable. 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 burial
====== ======
Sets all unowned coffins to allow burial. ``burial -pets`` also allows 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. 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 exterminate
=========== ===========
Kills any unit of a given race. 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. 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-monarch
============ ============
Make the selected unit King or Queen of your civilisation. 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 Reports the current time: date, clock time, month, and season. Also reports
location: z-level, cursor position, window size, and mouse location. 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 putontable
========== ==========
Makes item appear on the table, like in adventure mode shops. Arguments: '-a' 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. 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 remove-stress
============= =============
Sets stress to -1,000,000; the normal range is 0 to 500,000 with very stable or 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 -- 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 -- without arguments, all attributes, age & personalities are adjusted
-- arguments allow for skills to be adjusted as well -- arguments allow for skills to be adjusted as well
-- WARNING: USING THIS SCRIPT WILL ADJUST ALL DWARVES IN PLAY! -- WARNING: USING THIS SCRIPT WILL ADJUST ALL DWARVES IN PLAY!
-- by vjek, version 5, 20140816, for DF(hack) 40.08 -- by vjek
-- Praise Armok!
-- ---------------------------------------------------------------------------
function rejuvenate(unit) function rejuvenate(unit)
if unit==nil then if unit==nil then

@ -1,9 +1,6 @@
-- This script will brainwash a dwarf, modifying their personality -- This script will brainwash a dwarf, modifying their personality
-- usage is: target a unit in DF, and execute this script in dfhack -- usage is: target a unit in DF, and execute this script in dfhack
-- via ' lua /path/to/script ' -- by vjek
-- 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
function brainwash_unit(profile) function brainwash_unit(profile)
local i,unit_name local i,unit_name
@ -61,4 +58,4 @@ else
print ("baseline will reset all personality traits to a default / the average.") print ("baseline will reset all personality traits to a default / the average.")
print ("stepford amplifies all good qualities to an excessive degree.") print ("stepford amplifies all good qualities to an excessive degree.")
print ("wrecked amplifies all bad 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 -- This script will elevate all the mental attributes of a unit
-- usage is: target a unit in DF, and execute this script in dfhack -- 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 -- all physical attributes will be set to whatever the max value is
-- by vjek, version 5, 20140816, for DF(hack) 40.08 -- by vjek
-- Praise Armok!
function ElevateMentalAttributes(value) function ElevateMentalAttributes(value)
unit=dfhack.gui.getSelectedUnit() unit=dfhack.gui.getSelectedUnit()

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

@ -1,10 +1,8 @@
-- This script will modify a skill or the skills of a single unit -- 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 -- 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) -- the skill will be increased to 20 (Legendary +5)
-- arguments 'list', 'classes' and 'all' added -- arguments 'list', 'classes' and 'all' added
-- by vjek, version 4, 20141016, for DF(hack) 40.08 -- by vjek
-- Praise Armok!
-- this function will return the number of elements, starting at zero. -- this function will return the number of elements, starting at zero.
-- useful for counting things where #foo doesn't work -- useful for counting things where #foo doesn't work

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

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