DtlTraders/denizen/support
Introduction
As many of us knows Denizens are a major extension for Citizens 2.0, so it's obvious to add new Commands if there is an ability to do so :)
So far I've added only two commands to use Denizens with dtlTraders.
TRADER_TRANSACTION [START/CANCEL] (SELL/BUY)
TRADER_PATTERN [SET/REMOVE] (PAT:pattern_name)
But with these two commands you can make already some interesting things :)
Description
Trader Transaction Command
The first command is used to open the trade window (START), or to close it (CANCEL). It's needed to use this command to open the traders window, because if a NPC got bot traits (trader and denizen), the traders r.click trigger is unused, so a Denizen script is only able to open the traders window.
TRADER_TRANSACTION [START/CANCEL] (SELL/BUY)
The SELL or BUY argument is needed when you are starting a transaction, it will then show first the buy or sell tab.
Trader Pattern Command
This command can be used to change the traders prices and items in stock by using defined patterns.
TRADER_PATTERN [SET/REMOVE] (PAT:pattern_name)
I think both arguments are obvious. But to be sure, a trader can have only 1 pattern at the time, and the SET argument needs the PAT: argument.
Small Example
The trader has the old_prices pattern set.
"Trade": Type: Interact Requirements: Mode: None Steps: 1: Click Trigger: Script: - CHAT "Wait, i will just sort my goods." - WAIT 1 - CHAT "Here we go! Just look around I've got the best wood in this area!" - TRADER_TRANSACTION START SELL - WAIT 4 - CHAT "Looks like my boos has changed the prices..." - TRADER_PATTERN SET PAT:new_prices - WAIT 7 - CHAT "I was just joking..." - TRADER_PATTERN SET PAT:old_prices - WAIT 4 - CHAT "Ohh... i need to go for a while see you later." - TRADER_TRANSACTION CANCEL
So here you got a simple example how to make a transaction more dynamic, but however all messages said by the trader may be behind the inventory window, and without ITEM_BOUGHT and similar triggers it's still not so flexible, but we got still a lot of work :)
Btw if you close the window while the Script is running it will still run. So be aware!