Date: 2018/06/20 20:49:27 UTC-07: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
rng_gui_task:
type: task
debug: false
speed: 0
prefix: '&ss0&ss4&ss8&ss5&ssr'
script:
- inventory open 'd:in@generic[title=<script.yaml_key[prefix].unescaped><&6><&l>Lottery GUI;size=27]'
# Build a starting list of random items!
# Note: You might need to adjust how many times the list building loops. I might have counted
# too little.
- define disp_list li@
- repeat 59 {
- define rng '<util.random.decimal>'
# The following is just an RNG example. You can implement your own random item logic here.
# 10% chance
- if <def[rng]> < 0.1 {
- define disp_list '<def[disp_list].include[i@stone[display_name=&sseLucky Stone;lore=&ss6Whippity whoopity, you now have a suspic]]>'
}
# 25% chance
else if <def[rng]> < 0.35 {
- define disp_list '<def[disp_list].include[i@wood_sword[display_name=&ssbEarth Shatterer
&ss7(&ss6****&ss7*);lore=&ss7This isn&sqt anything special&dot|&ss7Just has a cool name&dot]]>'
}
# 20% chance
else if <def[rng]> < 0.55 {
- define disp_list '<def[disp_list].include[i@diamond_chestplate[display_name=&ssaToy Chestplate;lore=&ss7It&sqs
not fighting material˙nbt_attributes=generic.armor/chest/0/1]]>'
}
# 15% chance
else if <def[rng]> < 0.7 {
- define disp_list '<def[disp_list].include[i@dirt[display_name=&ssfsuspic&sqs scripting skills;lore=&ssaIt&sqs
so bad it doesn&sqt deserve to be capitalized&dot]]>'
}
# 10% chance
else if <def[rng]> < 0.8 {
- define disp_list '<def[disp_list].include[i@beacon[display_name=&sscShiny Thing;lore=&ssfIt&sqs pretty &coo]]>'
}
# 5% chance
else if <def[rng]> < 0.85 {
- define disp_list '<def[disp_list].include[i@human_skull[skull_skin=f7069c8a-9283-4da8-aae2-fcdde5fd3d17;display_name=&ssfsuspic&sqs
head;lore=&ss7Yes, this is my Minecraft account&sqs actual head skin&dot]]>'
}
# 15% chance
else {
- define disp_list '<def[disp_list].include[i@totem[display_name=&ssfCool Shiny Thing;lore=&ss7It&sqs not
actually shiny&dot||&ssc&sslPRANKED]]>'
}
}
# ...and then we spin!
- repeat 50 {
- inventory open 'd:in@generic[title=<script.yaml_key[prefix].unescaped><&6><&l>Lottery
GUI;size=27;contents=li@i@air|i@air|i@air|i@air|i@air|i@air|i@air|i@air|i@air|i@air|i@air|i@air|i@air|<def[disp_list].separated_by[|].reverse.get[<def[value]>].to[<def[value].add[8]>]>]'
- wait <util.e.power[<def[value].mul[0.125].sub[3]>].round_up>t
}
- wait 1s
- narrate '<&a>CONGRATULATIONS! You got a <&f><player.open_inventory.slot[14].display||<player.open_inventory.slot[14].formatted.to_titlecase>><&a>!
Now go have fun and do something creative.'
- give <player.open_inventory.slot[14]>
- flag player can_close_inv
- inventory close
rtd_gui_evts:
type: world
debug: false
events:
on player closes inventory:
- if <context.inventory.title.escaped.starts_with[&ss0&ss4&ss8&ss5&ssr]> {
- if !<player.has_flag[can_close_inv]> {
- determine cancelled
}
- flag player can_close_inv:!
}