execute if score .duration dialog matches ..0 run scoreboard players add .number dialog 1
$execute if score .duration dialog matches ..0 run function main:dialog/id/$(folder)$(id)
execute if score .room_count room matches 9.. run function main:dialog/commands/boss/check

execute unless entity @a[tag=dialog_free_chat] if score .number dialog matches 1.. run tellraw @a ["\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"]
execute if entity @a[tag=!dialog_no_skip] if score .number dialog matches 1.. run tellraw @a [{"bold":true,"clickEvent":{"action":"run_command","value":"/function main:dialog/next"},"color":"#15170d","text":"      ","font":"minecraft:default"}]
execute if entity @a[tag=!dialog_no_skip] if score .number dialog matches 1.. run tellraw @a [{"bold":true,"clickEvent":{"action":"run_command","value":"/function main:dialog/next"},"color":"#4e5c24","text":"\uFD02","font":"minecraft:ui"}]
execute if entity @a[tag=!dialog_no_skip] if score .number dialog matches 1.. run tellraw @a [{"bold":true,"clickEvent":{"action":"run_command","value":"/function main:dialog/next"},"color":"#15170d","text":"      ","font":"minecraft:default"}]
execute if entity @a[tag=!dialog_no_skip] if score .number dialog matches 1.. run tellraw @a [{"bold":false,"clickEvent":{"action":"run_command","value":"/function main:dialog/next"},"color":"white","text":"or Press","font":"minecraft:default"},{"bold":false,"clickEvent":{"action":"run_command","value":"/function main:dialog/next"},"color":"gold","text":" CTRL","font":"minecraft:default"}]
execute if entity @a[tag=!dialog_no_skip] if score .number dialog matches 1.. run tellraw @a [{"bold":true,"clickEvent":{"action":"run_command","value":"/function main:dialog/stop"},"color":"#4e5c24","text":"      ","font":"minecraft:default"}]
execute if entity @a[tag=!dialog_no_skip] if score .number dialog matches 1.. run tellraw @a [{"bold":true,"clickEvent":{"action":"run_command","value":"/function main:dialog/stop"},"color":"#4e5c24","text":"\uFD01","font":"minecraft:ui"}]
execute if entity @a[tag=!dialog_no_skip] if score .number dialog matches 1.. run tellraw @a [{"bold":true,"clickEvent":{"action":"run_command","value":"/function main:dialog/stop"},"color":"#4e5c24","text":"      ","font":"minecraft:default"}]
execute if entity @a[tag=!dialog_no_skip] if score .number dialog matches 1.. run tellraw @a [{"bold":false,"clickEvent":{"action":"run_command","value":"/function main:dialog/stop"},"color":"white","text":"or Press","font":"minecraft:default"},{"bold":false,"clickEvent":{"action":"run_command","value":"/function main:dialog/stop"},"color":"red","text":" CTRL + SPACEBAR","font":"minecraft:default"}]

execute if entity @a[tag=!dialog_no_skip] unless score .spacebar dialog matches 1.. if entity @a[predicate=main:movement/ctrl] run function main:dialog/next
execute if entity @a[tag=!dialog_no_skip] unless score .ctrl dialog matches 1.. if entity @a[predicate=main:movement/ctrl,predicate=main:movement/jump] run function main:dialog/stop