Denizen/Types of Scripts: Difference between revisions

From Citizens Wiki
No edit summary
No edit summary
Line 53: Line 53:


Task scripts are run from within other scripts.
Task scripts are run from within other scripts.
= Book Scripts =
<pre>myfancybook:
    type: book
    title: My Fancy Book
    author: NotNotch
    text:
    - This is my book. There are many like it, but this one is mine!
    - Many <n>new <n> lines!
    - <p>Paragraphs, <p>too!
mybookgiver:
    type: assignment
    actions:
        on assignment:
        - trigger name:click state:true
        on click:
        - chat "Here, a book for you!"
        - give myfancybook</pre>
Book scripts hold information on a complex book item.
Each - line in the text: category is a new page.
After defining a book in a script, you can give it to a player in any runnable script using - give (bookname)

Revision as of 08:30, 11 August 2013

In Denizen, there are multiple different types of scripts each made to fill a different purpose. When writing a script, you will need to use several of these, so they're important to know!

(Note: Page under construction! There's a lot more than just what's listed here!)

Types: interact, book, item, entity, task, assignment, procedure, world, format, inventory


Assignment Script

MyAssignmentScript:
    type: Assigment
    actions:
        on assigment:
        - announce "<npc.name> has been assigned!"

The assignment script is the first script any NPC needs - it lists everything the NPC does!

One of the most important uses is the "on assignment:" action, which is run when the script is assigned to an NPC, in which you normally enable triggers, and run other important commands.

You can link interact scripts by adding:

    Interact Scripts:
    - 10 MyInteractScript
    - 20 MyOtherInteractScript

Interact Scripts

MyInteractScript:
    type: Interact
    Requirements:
        Mode: None
        List:
    Steps:
        '1':
            Proximity trigger:
                Entry:
                    Script:
                    - CHAT "Hi there, <player.name>!"

Interact scripts control what the NPC does when a player fires triggers such as proximity, click, chat, or damage.

Item scripts

Item scripts hold data on custom items.


World Scripts

World scripts run world events.

Task Scripts

Task scripts are run from within other scripts.

Book Scripts

myfancybook:
    type: book
    title: My Fancy Book
    author: NotNotch
    text:
    - This is my book. There are many like it, but this one is mine!
    - Many <n>new <n> lines!
    - <p>Paragraphs, <p>too!

mybookgiver:
    type: assignment
    actions:
        on assignment:
        - trigger name:click state:true
        on click:
        - chat "Here, a book for you!"
        - give myfancybook

Book scripts hold information on a complex book item.

Each - line in the text: category is a new page.

After defining a book in a script, you can give it to a player in any runnable script using - give (bookname)