Denizen/0.7/Interact Scripts: Difference between revisions
No edit summary |
|||
(8 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
For more up-to-date information and full details on specific features (individual commands or tags, for example), check the [https://one.denizenscript.com/denizen/cmds/ Meta Documentation]. | |||
If you want a full tutorial to help get you set up, check out the [https://one.denizenscript.com/denizen/cmds/denizen/vids Tutorial Videos] on youtube or the [https://guide.denizenscript.com/ Beginner's Guide] text website. | |||
If you need quick help, visit our [https://discord.gg/Q6pZGSR Discord group]. | |||
<br><br><br> | |||
<span style="font-family:natalya-alternate-one; font-size:300%; margin-right:-7px; margin-left:-10px;">This wiki is outdated, please view the tutorial videos/guide, meta documentation, or Discord group (all linked above) for up-to-date information!</span> | |||
<s> | |||
== Interact Scripts == | == Interact Scripts == | ||
<div style="margin-right:2.0em; padding:10px; font-family:museo-sans; font-size:110%;"> | <div style="margin-right:2.0em; padding:10px; font-family:museo-sans; font-size:110%;"> | ||
Line 41: | Line 54: | ||
<pre> | <pre> | ||
"A Hint in the Sky": | "A Hint in the Sky": | ||
Type: Interact | |||
Requirements: | Requirements: | ||
Mode: None | Mode: None | ||
Line 60: | Line 74: | ||
<pre> | <pre> | ||
"Night-time Helper": | "Night-time Helper": | ||
Type: Interact | |||
Requirements: | Requirements: | ||
Mode: All | Mode: All | ||
Line 122: | Line 137: | ||
<code>[] indicates required field.</code> | <code>[] indicates required field.</code> | ||
{{Denizen | {{Denizen Requirement Type Color |white| | ||
ALL | ALL | ||
| Requires all requirements listed to be met. | | Requires all requirements listed to be met. | ||
}} | }} | ||
{{Denizen | {{Denizen Requirement Type Color |white| | ||
ANY | ANY # | ||
| Requires the specified number of requirements to be met out of the total of requirements. | | Requires the specified number of requirements to be met out of the total of requirements. | ||
}} | }} | ||
{{Denizen | {{Denizen Requirement Type Color |white| | ||
NONE | NONE | ||
| No requirements need to be met. There is also no need to have a <tt>LIST</tt> node if using <tt>NONE</tt>. | | No requirements need to be met. There is also no need to have a <tt>LIST</tt> node if using <tt>NONE</tt>. | ||
}} | }} | ||
</div> | </div> | ||
=====Requirements===== | =====Requirements===== | ||
<div style="margin-right:2.0em; padding:10px; font-family:museo-sans; font-size:110%;"> | <div style="margin-right:2.0em; padding:10px; font-family:museo-sans; font-size:110%;"> | ||
Denizen has a large assortment of Requirements at your disposal. For a complete list, and information on those requirements, | Denizen has a large assortment of Requirements at your disposal. For a complete list, and information on those requirements, | ||
see: [[Denizen/Interact Scripts/Interact Requirements]] | see: [[Denizen/0.7/Interact Scripts/Interact Requirements]] | ||
Remember, requirements are also easily extensible by plugin programmers, or maybe even you!<br> | Remember, requirements are also easily extensible by plugin programmers, or maybe even you!<br> | ||
See: [[Denizen/Interact Scripts/Custom Interact Requirements]] | See: [[Denizen/0.7/Interact Scripts/Custom Interact Requirements]] | ||
</div> | </div> | ||
Line 163: | Line 177: | ||
Click Trigger: | Click Trigger: | ||
Script: | Script: | ||
- CHAT | - CHAT "What's your name, stranger?" | ||
Chat Trigger: | Chat Trigger: | ||
'1': | '1': | ||
Trigger: My name is /<PLAYER>/. | Trigger: My name is /<PLAYER>/. | ||
Script: | Script: | ||
- CHAT | - CHAT "Ah ha, your name sounds familiar!" | ||
- CHAT | - CHAT "Are you from around this area?" | ||
- ZAP | - ZAP | ||
'2': | '2': | ||
Line 179: | Line 193: | ||
Trigger: /Yes/, I grew up in Harbortown! | Trigger: /Yes/, I grew up in Harbortown! | ||
Script: | Script: | ||
- CHAT | - CHAT "I thought so, welcome back! | ||
Have you heard about Tom the Taylor? | Have you heard about Tom the Taylor? | ||
Isn't that just horrible? | Isn't that just horrible?" | ||
- ZAP 3 | - ZAP 3 | ||
'2': | '2': | ||
Trigger: /No/, you must be mistaken. | Trigger: /No/, you must be mistaken. | ||
Script: | Script: | ||
- CHAT | - CHAT "Oh, sorry about that." | ||
- CHAT | - CHAT "Hey, if you're looking for some work, | ||
Bill the Baker is understaffed! | Bill the Baker is understaffed! | ||
This is the bakery's busy season. | This is the bakery's busy season." | ||
- ZAP 4 | - ZAP 4 | ||
'3': | '3': | ||
Click Trigger: | Click Trigger: | ||
Script: | Script: | ||
- CHAT | - CHAT "I wonder if Tom the Taylor is doing any better." | ||
- NARRATE | - NARRATE "Perhaps you should check on Tom the Taylor." | ||
'4': | '4': | ||
Click Trigger: | Click Trigger: | ||
Script: | Script: | ||
- CHAT | - CHAT "Oh, nice to see you again <PLAYER>!" | ||
- CHAT | - CHAT "Have you stopped by the bakery?" | ||
</pre> | </pre> | ||
</div> | </div> | ||
*For a list of the available Triggers see [[Denizen/0.7/Interact_Scripts/Triggers|Triggers]] | |||
*For a list of the available Commands see [[Denizen/0.7/Interact_Scripts/Commands|Commands]] | |||
==Assigning== | ==Assigning== | ||
See [[Denizen/Assignments#Interact_Assignment]] | See [[Denizen/0.7/Assignments#Interact_Assignment]] | ||
</div> | </div> | ||
[[Category:Denizen 0.7]]</s> |
Latest revision as of 16:11, 24 March 2020
For more up-to-date information and full details on specific features (individual commands or tags, for example), check the Meta Documentation.
If you want a full tutorial to help get you set up, check out the Tutorial Videos on youtube or the Beginner's Guide text website.
If you need quick help, visit our Discord group.
This wiki is outdated, please view the tutorial videos/guide, meta documentation, or Discord group (all linked above) for up-to-date information!
Interact Scripts
Scripts are defined in the plugins/Denizen/scripts/ folder. Any .yml file in that directory will be loaded into Denizen. For example purposes on this website, reference to script.yml is made, but again, jimbobjoe.yml or 'skeeter the cat.yml' would work just the same..
General layout of an Interact Script
This small 'outline' below shows the general layout of an Interact Script. Remember: SPACING is INCREDIBLY important with YML. If you are receiving a SnakeYML
error in your console when working with any YML file, 99% of the time it is because of bad spacing or a missing ':' colon. YAML tutorials can be intimidating, but this small tutorial on the Essentials wiki is pretty useful for basic YAML, which is the extent of which Denizens uses.
'Name of script': # Name Node Type: Interact # Type Node Requirements: # Requirements Node Mode: ... List: - ... - ... Steps: # Steps Node 1: # Step Node Some Trigger: # Trigger Node Trigger: ... Script: # Script Node - ... - ... Another Trigger: Script: - ... - ...
For information on what goes in Requirements and Steps, keep reading. What is show above is just a an outline of the correct spacing, not a valid script! Let's take a look at a few small scripts, below.
A few small scripts
...just to get a small look of some basic ways to use scripts. The rest of this document will go into detail about the specifics of each part. Some of the functionality described may require additional reading.
This scripts below is a neat little way to leave a hint. Upon a Player coming into proximity, this script will trigger the NPC looking at a target while holding a small conversation with the player.
"A Hint in the Sky": Type: Interact Requirements: Mode: None Steps: 1: Proximity Trigger: Script: - ^COOLDOWN 15 - LOOK CLOSE - ^CHAT "Look up there! What could that possibly be used for?" - LOOK BOOKMARK:upthere DURATION:10 - WAIT 1 - CHAT "If only I could figure out how to make it, I can't find any stairs!"
Below is a script for a nice fellow who will help an adventurer out in the night-time. Keep in mind that Interact Scripts only define one set of rules for a Denizen NPC... player-interaction. Imagine this next script combined with some activities that make the Denizen NPC scope out and wander an area in some woods.
"Night-time Helper": Type: Interact Requirements: Mode: All List: - TIME NIGHT Steps: 1: Click Trigger: Script: - ^ZAP DURATION:60 - ENGAGE DURATION: 5 - LOOK CLOSE DURATION:5 - CHAT "It's dark out here, man!" - CHAT "You really gotta watch out for those Zombies... they're all over the place!" 2: Click Trigger: Script: - ^COOLDOWN 3600 - LOOK CLOSE DURATION:5 - CHAT "You again, eh? Hey man.. you need some torches?" - WAIT 1 - GIVE TORCH QTY:12
Scripts can also start a story-line of adventures, all activated by scripts working together, thanks to the FLAG, FAIL, and FINISH commands. This small script below could be the start of a Quest, with two different outcomes, if utilized properly.
Name Node
This node is pretty self-explanatory, but here are some things to keep in mind.
- Names, just like nodes are case-sensitive!
'This script name'
is different than'THIS SCRIPT NAME'
. - Names that contain spaces should have single or double quotes around it. ie:
"This script":
or'This script':
is acceptable. - If the name includes a single quote in it, you must use double quotes around it, or 'escape' the quote with another quote. ie:
"John's Script":
or'John''s Script':
Type Node
Let's Denizen and you to easily know the type of script. For interact scripts, as explained in this section, use TYPE: INTERACT
. For reference, there are also TASK scripts and ACTIVITY scripts, which are covered in their appropriate sections.
Requirements Node
This node sets the rules for the player to qualify for the script. There are a couple different options that you should know when using requirements. For example:
Requirements:
Mode: All
List:
- TIME Night
- MONEY 1000000
- STORMY
This would be a difficult script to obtain, for sure. To trigger, the time must be night-time, the player would need one million units of currency, and the weather must be storming, but it shows the flexibility of requirements. First is the 'Mode'. Currently there are three different types. Second is the requirement type, with arguments if applicable.
Requirements Mode
[] indicates required field.
ALL |
Requires all requirements listed to be met.
|
ANY # |
Requires the specified number of requirements to be met out of the total of requirements.
|
NONE |
No requirements need to be met. There is also no need to have a LIST node if using NONE.
|
Requirements
Denizen has a large assortment of Requirements at your disposal. For a complete list, and information on those requirements, see: Denizen/0.7/Interact Scripts/Interact Requirements
Remember, requirements are also easily extensible by plugin programmers, or maybe even you!
See: Denizen/0.7/Interact Scripts/Custom Interact Requirements
Steps Node
Each script can have multiple steps, each with multiple triggers. A player can only ever be on 1 step for a script. When a script is selected to run, a query is made to the Denizen saves to see if the Player has completed any steps. If no entry is found, the player starts on Step 1.
Here's an example of s script making good use of steps. Note the ZAP command is what moves a player from one step to the next, it is NOT automatic!
'Welcome to Harbortown': Type: Interact Requirements: Mode: NONE Steps: '1': Click Trigger: Script: - CHAT "What's your name, stranger?" Chat Trigger: '1': Trigger: My name is /<PLAYER>/. Script: - CHAT "Ah ha, your name sounds familiar!" - CHAT "Are you from around this area?" - ZAP '2': Click Trigger: Script: - HINT Chat Trigger: '1': Trigger: /Yes/, I grew up in Harbortown! Script: - CHAT "I thought so, welcome back! Have you heard about Tom the Taylor? Isn't that just horrible?" - ZAP 3 '2': Trigger: /No/, you must be mistaken. Script: - CHAT "Oh, sorry about that." - CHAT "Hey, if you're looking for some work, Bill the Baker is understaffed! This is the bakery's busy season." - ZAP 4 '3': Click Trigger: Script: - CHAT "I wonder if Tom the Taylor is doing any better." - NARRATE "Perhaps you should check on Tom the Taylor." '4': Click Trigger: Script: - CHAT "Oh, nice to see you again <PLAYER>!" - CHAT "Have you stopped by the bakery?"
Assigning
See Denizen/0.7/Assignments#Interact_Assignment