Date: 2018/11/05 03:18:21 UTC-08:00
Type: Denizen Script
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
Sticker:
type: item
debug: false
material: paper
display name: <gray>Sticker
lore:
- <&f>Right click <&6><&l><>><&r><&f> to reveal the sticker
Sticker_world:
type: world
debug: true
#----------------------------------------------------------------------------#
# #
# CONFIG #
# #
#----------------------------------------------------------------------------#
config:
colors:
# f = white; b = aqua; d = light purple
# - "<&f>"
- "<&b>"
# - "<&d>"
lore:
- "<def[player]> thinks this is a game"
#----------------------------------------------------------------------------#
# #
# SCRIPT #
# #
#----------------------------------------------------------------------------#
events:
on player right clicks with Sticker:
#----------------------------------------------------------------------------#
# CLICK WITH EMPTY CARD #
#----------------------------------------------------------------------------#
- wait 1t
# if you have a stack of stickers and a full inventory, it will prevent from running
- if "<context.item.lore.get[1].is[==].to[<parse:<script[sticker].yaml_key[lore].get[1]>>]>" {
- ^if <player.inventory.empty_slots> == 0 {
- narrate "<&c>Not enough invemtory space"
- queue clear
}
- ^define slot <player.item_in_hand.slot>
- wait 1t
- ^define Sticker <context.item>
- ^define Player <player.name>
- ^define color <parse:<script.yaml_key[config.colors].random>>
- ^define lore <parse:<script.yaml_key[config.lore].random>>
- ^adjust <def[Sticker]> "lore:<&sp>|%color%%lore%|<gray>------------------------------|<gray>1. <&lb>Right click<&rb> with sticker in hand|<gray>2. <&lb>Right click<&rb> with desired item in hand|<gray>3. Enjoy your personalised item!|<gray>------------------------------|<&4>Warning! <gray>If the chosen item already|<gray>has lore on it, the old lore WILL be|<gray>overwritten by lore from the card!|<dark_gray>Don<&sq>t use on quest items, etc.|<gray>------------------------------|" save:FullSticker
- ^take <player.item_in_hand> qty:1
- ^if <def[slot]> != i@air {
- ^define slot <player.inventory.first_empty>
}
- ^give <entry[FullSticker].result> to:<player.inventory> slot:<def[slot]> qty:1
} else {
#----------------------------------------------------------------------------#
# CLICK WITH FULL CARD #
#----------------------------------------------------------------------------#
- flag player StickerTimer:<player.item_in_hand.lore.get[2]> duration:5s
- title "subtitle:Ready to imbue <player.flag[StickerTimer]><&r> to an item"
}
#----------------------------------------------------------------------------#
# CLICK WITH ITEM #
#----------------------------------------------------------------------------#
on player right clicks with item:
- ^if !<player.has_flag[StickerTimer]> {
- queue clear
}
- ^if <context.item.scriptname.is[==].to[Sticker]||false> {
- queue clear
}
- ^if <context.item.scriptname.split[_].get[1].is[==].to[UI]||false> {
- title "subtitle:<&c>You cannot put stickers on unique items"
- queue clear
}
- determine cancelled passively
- take iteminhand qty:1
- wait 1t
- ^define slot <player.item_in_hand.slot>
- ^define item <context.item>
- ^define Lore <player.flag[StickerTimer]>
- ^if <context.item.has_display> {
- define Name <context.item.display>
} else {
- define Name <context.item.formatted>
}
- title title:Congratulations! "subtitle:%lore% <&f>applied to %Name%"
### OHRANITEV MOREBITNEGA PREJSNJEGA VECVRSTICNEGA LORA, ZAMENJA SAMO 1 VRSTICO ###
- if <context.item.has_lore> {
# TOLE JE KODA, KI DODAJA NEOMEJENO STICKERJEV!!!!
- ^adjust <def[Item]> lore:<context.item.lore.insert[<def[lore]>].at[1]> save:LoreItem
# TOLE JE KODA, KI ZAMENJA 1. VRSTICO LORA!!!!
# - ^adjust <def[Item]> lore:<context.item.lore.replace[<context.item.lore.get[1]>].with[<def[lore]>]> save:LoreItem
} else {
- ^adjust <def[Item]> lore:%lore% save:LoreItem
}
- ^if <def[slot]> != i@air {
- ^define slot <player.inventory.first_empty>
}
- ^give <entry[LoreItem].result> qty:1 slot:<def[slot]>
- ^take <player.inventory.list_contents.filter[lore.get[2].contains_any[%lore%]].get[1]> qty:1
- wait 1t
- flag player StickerTimer:!