#look at all these GROSS nbt checks

#inventory buttons
tag @s[tag=hasSlot18] remove hasSlot18
tag @s[nbt={Inventory:[{Slot:18b,tag:{Tags:["slot18"]}}]}] add hasSlot18
clear @s[gamemode=!creative,tag=!hasSlot18] magenta_dye{CustomModelData:1000001}
clear @s[gamemode=!creative,tag=!hasSlot18] pink_dye{CustomModelData:1000001}
execute if entity @s[tag=!hasSlot18,tag=!noInventory,tag=!freecam] run item replace entity @s inventory.9 with magenta_dye{Tags:["slot18"],CustomModelData:1000001,display:{Name:'{"text":"Freecam: OFF","color":"yellow","italic":"false"}',Lore:['{"text":"Click to toggle!","color":"white"}']}} 1
execute if entity @s[tag=!hasSlot18,tag=!noInventory,tag=freecam] run item replace entity @s inventory.9 with pink_dye{Tags:["slot18"],CustomModelData:1000001,display:{Name:'{"text":"Freecam: ON","color":"yellow","italic":"false"}',Lore:['{"text":"Click to toggle!","color":"white"}']}} 1

tag @s[tag=hasSlot20] remove hasSlot20
tag @s[nbt={Inventory:[{Slot:20b,tag:{Tags:["slot20"]}}]}] add hasSlot20
clear @s[gamemode=!creative,tag=!hasSlot20] gray_dye{CustomModelData:1000002}
clear @s[gamemode=!creative,tag=!hasSlot20] lime_dye{CustomModelData:1000002}
execute if entity @s[tag=!hasSlot20,tag=!noInventory,tag=!zoom6] run item replace entity @s inventory.11 with gray_dye{Tags:["slot20"],CustomModelData:1000002,display:{Name:'{"text":"Zoom level 6","color":"white","italic":"false"}',Lore:['{"text":"Click to set!","color":"white"}']}} 1
execute if entity @s[tag=!hasSlot20,tag=!noInventory,tag=zoom6] run item replace entity @s inventory.11 with lime_dye{Tags:["slot20"],CustomModelData:1000002,display:{Name:'{"text":"Zoom level 6","color":"yellow","italic":"false"}',Lore:['{"text":"Click to set!","color":"white"}']}} 1

tag @s[tag=hasSlot21] remove hasSlot21
tag @s[nbt={Inventory:[{Slot:21b,tag:{Tags:["slot21"]}}]}] add hasSlot21
clear @s[gamemode=!creative,tag=!hasSlot21] gray_dye{CustomModelData:1000003}
clear @s[gamemode=!creative,tag=!hasSlot21] lime_dye{CustomModelData:1000003}
execute if entity @s[tag=!hasSlot21,tag=!noInventory,tag=!zoom5] run item replace entity @s inventory.12 with gray_dye{Tags:["slot21"],CustomModelData:1000003,display:{Name:'{"text":"Zoom level 5","color":"white","italic":"false"}',Lore:['{"text":"Click to set!","color":"white"}']}} 1
execute if entity @s[tag=!hasSlot21,tag=!noInventory,tag=zoom5] run item replace entity @s inventory.12 with lime_dye{Tags:["slot21"],CustomModelData:1000003,display:{Name:'{"text":"Zoom level 5","color":"yellow","italic":"false"}',Lore:['{"text":"Click to set!","color":"white"}']}} 1

tag @s[tag=hasSlot22] remove hasSlot22
tag @s[nbt={Inventory:[{Slot:22b,tag:{Tags:["slot22"]}}]}] add hasSlot22
clear @s[gamemode=!creative,tag=!hasSlot22] gray_dye{CustomModelData:1000004}
clear @s[gamemode=!creative,tag=!hasSlot22] lime_dye{CustomModelData:1000004}
execute if entity @s[tag=!hasSlot22,tag=!noInventory,tag=!zoom4] run item replace entity @s inventory.13 with gray_dye{Tags:["slot22"],CustomModelData:1000004,display:{Name:'{"text":"Zoom level 4 (default)","color":"white","italic":"false"}',Lore:['{"text":"Click to set!","color":"white"}']}} 1
execute if entity @s[tag=!hasSlot22,tag=!noInventory,tag=zoom4] run item replace entity @s inventory.13 with lime_dye{Tags:["slot22"],CustomModelData:1000004,display:{Name:'{"text":"Zoom level 4 (default)","color":"yellow","italic":"false"}',Lore:['{"text":"Click to set!","color":"white"}']}} 1

tag @s[tag=hasSlot23] remove hasSlot23
tag @s[nbt={Inventory:[{Slot:23b,tag:{Tags:["slot23"]}}]}] add hasSlot23
clear @s[gamemode=!creative,tag=!hasSlot23] gray_dye{CustomModelData:1000005}
clear @s[gamemode=!creative,tag=!hasSlot23] lime_dye{CustomModelData:1000005}
execute if entity @s[tag=!hasSlot23,tag=!noInventory,tag=!zoom3] run item replace entity @s inventory.14 with gray_dye{Tags:["slot23"],CustomModelData:1000005,display:{Name:'{"text":"Zoom level 3","color":"white","italic":"false"}',Lore:['{"text":"Click to set!","color":"white"}']}} 1
execute if entity @s[tag=!hasSlot23,tag=!noInventory,tag=zoom3] run item replace entity @s inventory.14 with lime_dye{Tags:["slot23"],CustomModelData:1000005,display:{Name:'{"text":"Zoom level 3","color":"yellow","italic":"false"}',Lore:['{"text":"Click to set!","color":"white"}']}} 1

tag @s[tag=hasSlot24] remove hasSlot24
tag @s[nbt={Inventory:[{Slot:24b,tag:{Tags:["slot24"]}}]}] add hasSlot24
clear @s[gamemode=!creative,tag=!hasSlot24] gray_dye{CustomModelData:1000006}
clear @s[gamemode=!creative,tag=!hasSlot24] lime_dye{CustomModelData:1000006}
execute if entity @s[tag=!hasSlot24,tag=!noInventory,tag=!zoom2] run item replace entity @s inventory.15 with gray_dye{Tags:["slot24"],CustomModelData:1000006,display:{Name:'{"text":"Zoom level 2","color":"white","italic":"false"}',Lore:['{"text":"Click to set!","color":"white"}']}} 1
execute if entity @s[tag=!hasSlot24,tag=!noInventory,tag=zoom2] run item replace entity @s inventory.15 with lime_dye{Tags:["slot24"],CustomModelData:1000006,display:{Name:'{"text":"Zoom level 2","color":"yellow","italic":"false"}',Lore:['{"text":"Click to set!","color":"white"}']}} 1

tag @s[tag=hasSlot25] remove hasSlot25
tag @s[nbt={Inventory:[{Slot:25b,tag:{Tags:["slot25"]}}]}] add hasSlot25
clear @s[gamemode=!creative,tag=!hasSlot25] gray_dye{CustomModelData:1000007}
clear @s[gamemode=!creative,tag=!hasSlot25] lime_dye{CustomModelData:1000007}
execute if entity @s[tag=!hasSlot25,tag=!noInventory,tag=!zoom1] run item replace entity @s inventory.16 with gray_dye{Tags:["slot25"],CustomModelData:1000007,display:{Name:'{"text":"Zoom level 1","color":"white","italic":"false"}',Lore:['{"text":"Click to set!","color":"white"}']}} 1
execute if entity @s[tag=!hasSlot25,tag=!noInventory,tag=zoom1] run item replace entity @s inventory.16 with lime_dye{Tags:["slot25"],CustomModelData:1000007,display:{Name:'{"text":"Zoom level 1","color":"yellow","italic":"false"}',Lore:['{"text":"Click to set!","color":"white"}']}} 1

tag @s[tag=hasSlot26] remove hasSlot26
tag @s[nbt={Inventory:[{Slot:26b,tag:{Tags:["slot26"]}}]}] add hasSlot26
clear @s[gamemode=!creative,tag=!hasSlot26] yellow_dye{CustomModelData:1234567}
execute if entity @s[tag=!hasSlot26,tag=!noInventory,tag=!alternate_controls] run item replace entity @s inventory.17 with yellow_dye{Tags:["slot26"],CustomModelData:1234567,display:{Name:'{"text":"Controls: As seen by camera","color":"yellow","italic":"false"}',Lore:['{"text":"Click to change!","color":"white"}']}} 1
execute if entity @s[tag=!hasSlot26,tag=!noInventory,tag=alternate_controls] run item replace entity @s inventory.17 with yellow_dye{Tags:["slot26"],CustomModelData:1234567,display:{Name:'{"text":"Controls: As seen by bulldozer","color":"yellow","italic":"false"}',Lore:['{"text":"Click to change!","color":"white"}']},HideFlags:1,Enchantments:[{}]} 1

#handle inputs
execute if entity @s[tag=!hasSlot18,tag=hasSlot26] run function bd:control/inventory_inputs/toggle_freecam
execute if entity @s[tag=hasSlot26,tag=!hasSlot20] run function bd:control/inventory_inputs/set_zoom_6
execute if entity @s[tag=hasSlot26,tag=!hasSlot21] run function bd:control/inventory_inputs/set_zoom_5
execute if entity @s[tag=hasSlot26,tag=!hasSlot22] run function bd:control/inventory_inputs/set_zoom_4
execute if entity @s[tag=hasSlot26,tag=!hasSlot23] run function bd:control/inventory_inputs/set_zoom_3
execute if entity @s[tag=hasSlot26,tag=!hasSlot24] run function bd:control/inventory_inputs/set_zoom_2
execute if entity @s[tag=hasSlot26,tag=!hasSlot25] run function bd:control/inventory_inputs/set_zoom_1
execute if entity @s[tag=!hasSlot26,tag=hasSlot18,tag=hasSlot20,tag=hasSlot21,tag=hasSlot22,tag=hasSlot23,tag=hasSlot24,tag=hasSlot25] run function bd:control/inventory_inputs/toggle_control_scheme