$give @s written_book[item_model="minecraft:scroll",custom_name='{"italic":false,"text":"Upgrade","color":"gold"}',written_book_content={title:"Upgrade",author:"You",pages:['["",{"text":"   UPGRADE\\n","font":"minecraft:book_1","color":"gold","bold":false},{"text":"----choose one----\\n","bold":false,"italic":true},{"text":"$(name_1)\\n","color":"$(text_color_1)","bold":false,"italic":false,"hoverEvent":{"action":"show_text","value":[{"text":"$(description_1)","italic":false}]},"clickEvent":{"action":"run_command","value":"/function main:characters/$(character)/upgrades/level/1/grant/$(upgrade_1)"}},{"text":"$(name_2)\\n","color":"$(text_color_2)","bold":false,"italic":false,"hoverEvent":{"action":"show_text","value":[{"text":"$(description_2)","italic":false}]},"clickEvent":{"action":"run_command","value":"/function main:characters/$(character)/upgrades/level/1/grant/$(upgrade_2)"}}]']}] 1
