Skip to content

item-trigger: support multiple conditions#50

Merged
lethosor merged 4 commits intoDFHack:masterfrom
AtomicChicken:item-trigger-updates
Apr 3, 2018
Merged

item-trigger: support multiple conditions#50
lethosor merged 4 commits intoDFHack:masterfrom
AtomicChicken:item-trigger-updates

Conversation

@AtomicChicken
Copy link
Copy Markdown
Member

A significant rewrite allowing the user to specify any combination of itemType, material and contaminant.
Previously, only one of the above could be used at a time, which greatly restricted the script's flexibility and limited its usefulness to modders.

Also fixed the outdated(?) creature/plant material token format demonstrated in the -help printout, and added a few more examples.

A significant rewrite allowing the user to specify any combination of itemType, material and contaminant.
Previously, only one of the above could be used at a time, which greatly restricted the script's flexibility and limited its usefulness to modders.

Also fixed the outdated(?) creature/plant material token format demonstrated in the -help printout, and added a few more examples.
function checkMode(triggerArgs,table)
local mode = table.mode
for _,argArray in ipairs(triggerArgs) do
if argArray[""..mode..""] then
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tostring(mode) or ""..mode should work

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

INORGANIC:IRON
CREATURE_MAT:DWARF:BRAIN
PLANT_MAT:MUSHROOM_HELMET_PLUMP:DRINK
CREATURE:DWARF:BRAIN
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not familiar with this script... does this break backwards compatibility?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose so? The issue is that dfhack.matinfo.decode(item):getToken() returns strings in the format displayed above, which is incongruous with the format previously documented in this script's -help printout. Specifying something like "-material CREATURE_MAT:DWARF:BRAIN" shouldn't have worked at all in recent versions (tested it as far back as 0.43.05 to check), and the fact that this has gone unreported for so long indicates that the script probably hasn't seen much use in this regard.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I missed that part in the PR description, and thought you had actually changed the format here. I really don't know much about the modtools scripts, so thanks for putting in the time to work on them.

replaced ""..mode.."" with tostring(mode), as per lethosor's feedback.
@lethosor lethosor merged commit 7d7dd8a into DFHack:master Apr 3, 2018
lethosor added a commit to lethosor/dfhack that referenced this pull request Apr 3, 2018
@AtomicChicken AtomicChicken deleted the item-trigger-updates branch April 16, 2018 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants