Date: 2018/06/04 16:11:20 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
rtd_gui_task:
type: task
debug: false
speed: 0
prefix: '&ss1&ss2&ss1&ss5&ss2&ss0&ss2&ss0&ss0&ss5&ss1&ss8&ss2&ss5&ss0&ss7&ss2&ss1&ss0&ss9&ssr'
script:
- inventory open 'd:in@generic[title=<script.yaml_key[prefix].unescaped><&6><&l>Lottery GUI;size=27]'
- wait 1t
- repeat 50 {
- define rng '<util.random.decimal>'
# 10% chance
- if <def[rng]> < 0.1 {
- define item 'i@stone[display_name=&sseLucky Stone;lore=&ss6Whippity whoopity, you now have a suspic]'
}
# 25% chance
else if <def[rng]> < 0.35 {
- define item '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 item '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 item '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 item 'i@beacon[display_name=&sscShiny Thing;lore=&ssfIt&sqs pretty &coo]'
}
# 5% chance
else if <def[rng]> < 0.85 {
- define item '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 item 'i@totem[display_name=&ssfCool Shiny Thing;lore=&ss7It&sqs not actually shiny&dot||&ssc&sslPRANKED]'
}
# Don't reopen the inventory if we don't have to
- if <def[item]> != <def[prev_item]||i@air> {
- 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[item]>]'
}
# To use for the if statement above
- define prev_item '<def[item]>'
# Because exponential waiting times are fun
- wait <el@2.71828182846.power[<def[value].mul[0.125].sub[3]>].round_up>t
}
- wait 1s
- narrate '<&a>CONGRATULATIONS! You got a <&f><def[item].display||<def[item].formatted.to_titlecase>><&a>! Now go have fun and do something creative.'
- give <def[item]>
- flag player can_close_inv
- inventory close
# Stops the player from prematurely closing the inventory
rtd_gui_evts:
type: world
debug: false
events:
on player closes inventory:
- if <context.inventory.title.escaped.starts_with[&ss1&ss2&ss1&ss5&ss2&ss0&ss2&ss0&ss0&ss5&ss1&ss8&ss2&ss5&ss0&ss7&ss2&ss1&ss0&ss9&ssr]> {
- if !<player.has_flag[can_close_inv]> {
- determine cancelled
}
- flag player can_close_inv:!
}