- D1 Meta Docs - Denizen Script -
Home Page / Pi to one million places / Contact mcmonkey / Donate / Paste Scripts / Denizen Help /
You are browsing as a guest.
Login | Register


Click here to create your own public paste ~ ~ click to duplicate and edit this paste


TitleUntitled Paste
TypeDenizen Script
Date2014/09/20 22:07:02 UTC-07:00
ByAnthony
OtherEdit of paste #9887 - click here to see edit details
Paste
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
24400
################################################################################
#
#                          M a s t e r C h e f   N P C 
#                           Feed those hungry denizens
#
#
#   Author: |Anthony|
#   Version: 0.1
#   dScript Version: 0.9.5-b1522
#

#
################################################################################
#
MasterChefNPC:
  type: assignment
  debug: false

  actions:
    on assignment:
      - run locally assignment instantly
    on spawn:
      - run locally spawn instantly
    on despawn:
      - run locally despawn instantly
    on click:
      - run locally click instantly
    on damage:
      - run locally damage instantly
    on chat:
      - inject locally chat instantly

  assignment:
    - trigger name:chat state:true
    - trigger name:click state:true
    - trigger name:proximity state:false
    - trigger name:damage state:true
    - vulnerable state:false
    - lookclose true range:5 realistic
#    - flag npc respawn_location:<npc.location>
#    - flag npc Pathfind.FidgetPathMaterial:<npc.location.standing_on.material.name>
#    - flag npc Pathfind.FidgetHeight:1
    - inject locally spawn instantly


  spawn:
    - chat "Alright, time to start work..." no_target
#    - run s@Fidget id:<npc.id>_fidgetQueue


  despawn:
    - chat "Phew... I<&sq>m glad to be done work for the day!" no_target


  damage:
    - chat "Why would you do that?" no_target


  click:
    - if <npc.has_flag[following]> {
      - if <npc.flag[following].as_player.is[==].to[<player>]> {
        - follow stop
        - if <queue.exists[Following_<npc.id>]> queue queue:Following_<npc.id> stop
        - chat "Ok. I<&sq>ll wait right here..."
        - flag npc following:!
        - queue stop
        }
        else {
        - chat "I<&sq>m a little busy right now..."
        - queue stop
        }
      }
      else {
      - flag npc following:<player>
      - run locally follow id:Following_<npc.id>
      }

  follow:
    - if !<npc.flag[following].as_player.is_online> {
      - flag npc following:!
      - follow stop
      - queue stop
      }
    - follow target:<npc.flag[following].as_player>
    - wait 5s
    - inject locally follow

  chat:
    - if <npc.has_flag[following]> {
      - chat "I<&sq>m a little busy right now following <npc.flag[following].as_player.name>..."
      - queue stop
      }
    - define options li@fridge|grill|sink|prep
    - define equipment '<c.message.split[ ].get[1].escaped>'
    - define range '<c.message.split[ ].get[2].escaped||15>'
    - if !<def[range].is[MATCHES].to[number]> {
      - chat "Hey, that<&sq> s not a number!"
      }
    - if '<def[options].contains[%equipment%]>' {
      - inject locally find%equipment% instantly
      }
      else {
      - chat "I don<&sq>t know anything about that."
      - queue stop
      }
    - if <def[locations].is_empty> {
      - chat "I couldn<&sq>t find the %equipment%."
      - queue stop
      }
    - chat "I found <def[locations].size.as_int> %equipment%."
    - ~walk <npc> <def[locations].random.as_location> 'speed:0.6' 'radius:2.0'
    - chat "Ok, I made it to the %equipment%."



  findFridge:
  # The Fridge is 2 ironblocks tall with a stone button on the front of the top block
    - define ironBlocks <npc.location.find.blocks[iron_block].within[%range%]||null>
    - if <def[ironBlocks].is[!=].to[null]>
      && !<def[ironBlocks].is_empty> {
      - define locations li@
      - foreach %ironBlocks% {
        - define iron '%value%'
        - if <def[iron].below.material.is[!=].to[m@iron_block]||true> foreach next

        - define east '<def[iron].add[1,0,0]>'
        - define west '<def[iron].add[-1,0,0]>'
        - define north '<def[iron].add[0,0,1]>'
        - define south '<def[iron].add[0,0,-1]>'
        - define cardinals li@east|west|north|south

        - foreach %cardinals% {
          - define location '<def[%value%]>'

          - if <def[location].material.name.is[==].to[m@stone_button]>
            && <def[location].sub[0,1,0].material.name.is[==].to[m@air]>
            && <def[location].sub[0,2,0].material.is_solid> {
            - define locations <def[locations].include[<def[location].below>]>
            }
          }
        }
      }


  findGrill:
  # The Grill is a trapdoor over fire
    - define fireBlocks <npc.location.find.blocks[m@fire].within[%range%]||null>
    - if <def[fireBlocks].is[!=].to[null]>
      && !<def[fireBlocks].is_empty> {
      - define locations li@
      - foreach %fireBlocks% {
        - define fire '%value%'
        - if <def[fire].above.material.is[!=].to[trap_door]||true> foreach next

        - define east '<def[fire].add[1,0,0]>'
        - define west '<def[fire].add[-1,0,0]>'
        - define north '<def[fire].add[0,0,1]>'
        - define south '<def[fire].add[0,0,-1]>'
        - define cardinals li@east|west|north|south

        - foreach %cardinals% {
          - define location '<def[%value%]>'

          - if <def[location].material.is[==].to[m@air]>
            && <def[location].above.material.is[==].to[m@air]>
            && <def[location].below.material.is_solid> {
            - define locations <def[locations].include[%location%]>
            }
          }
        }
      }


  findSink:
  # The sink is a Cauldron full of water with a tripwire hook above
    - define cauldronBlocks <npc.location.find.blocks[cauldron,3].within[%range%]||null>
    - if <def[cauldronBlocks].is[!=].to[null]>
      && !<def[cauldronBlocks].is_empty> {
      - define locations li@
      - foreach %cauldronBlocks% {
        - define cauldron '%value%'
        - if <def[cauldron].above.material.is[!=].to[m@tripwire_hook]||true> foreach next

        - define east '<def[cauldron].add[1,0,0]>'
        - define west '<def[cauldron].add[-1,0,0]>'
        - define north '<def[cauldron].add[0,0,1]>'
        - define south '<def[cauldron].add[0,0,-1]>'
        - define cardinals li@east|west|north|south

        - foreach %cardinals% {
          - define location '<def[%value%]>'

          - if <def[location].material.is[==].to[m@air]>
            && <def[location].above.material.is[==].to[m@air]>
            && <def[location].below.material.is_solid> {
            - define locations <def[locations].include[%location%]>
            }
          }
        }
      }


  findPrep:
  # The Prep station is the top half stone slab
    - define prepBlocks <npc.location.find.blocks[stone_slab_up].within[%range%]||null>
    - if <def[prepBlocks].is[!=].to[null]>
      && !<def[prepBlocks].is_empty> {
      - define locations li@
      - foreach %prepBlocks% {
        - define prep '%value%'
        - if <def[prep].above.material.is[!=].to[m@air]||true> foreach next

        - define east '<def[prep].add[1,0,0]>'
        - define west '<def[prep].add[-1,0,0]>'
        - define north '<def[prep].add[0,0,1]>'
        - define south '<def[prep].add[0,0,-1]>'
        - define cardinals li@east|west|north|south

        - foreach %cardinals% {
          - define location '<def[%value%]>'

          - if <def[location].material.is[==].to[m@air]>
            && <def[location].above.material.is[==].to[m@air]>
            && <def[location].below.material.is_solid> {
            - define locations <def[locations].include[%location%]>
            }
          }
        }
      }


  findOven:
  # The oven is a furnace


  findStove:
  # The Stove is a furnace with a stone pressure plate on top









RawRaw



Pastes made: 72031