local scroll_teleport = --Scorpion boss, Dungeon Master,
   'size[6,6]'..
   'no_prepend[]'..
   'bgcolor[#080808BB;true]'..
   'background[0,0;6,6;stations_scroll_bg.png]'..
   'hypertext[0,.2;6.5,1;;<center><style color=black size=32>~~ Teleport Powder ~~</style></center>]'..
   'hypertext[0.75,.75;5,1;;<left><style color=black size=20>Required to run the /tpr and /tphr commands.</style></left>]'..
   'item_image_button[1,1.5;1,1;default:mese_crystal_fragment;1;]'..
   'item_image_button[1,2.5;1,1;flowers:mushroom_red;2;]'..
   'item_image_button[1,3.5;1,1;zombies:tooth;3;]'..
   'item_image_button[1,4.5;1,1;epic:float_crystal_shard 4;4;]'..
   'item_image_button[2,1.5;1,1;stations:coal_dust;5;]'..
   'item_image_button[2,2.5;1,1;default:blueberries;6;]'..
   'item_image_button[4,1.5;1,1;stations:mortar;mortar;]'..
   'item_image_button[4,4;1,1;epic:teleport_powder;output;]'
   --Required to use the Teleport commands

local scroll_healing = --Pyramid treasure, Dungeon Master
   'size[6,6]'..
   'no_prepend[]'..
   'bgcolor[#080808BB;true]'..
   'background[0,0;6,6;stations_scroll_bg.png]'..
   'hypertext[0,.2;6.5,1;;<center><style color=black size=32>~~ Healing Powder ~~</style></center>]'..
   'hypertext[0.75,.75;5,1;;<left><style color=black size=20>Use this for a quick health boost. Bystanders will also get a small boost.</style></left>]'..
   'item_image_button[1,1.5;1,1;epic:bloodstone_powder 2;1;]'..
   'item_image_button[1,2.5;1,1;flowers:mushroom_brown;2;]'..
   'item_image_button[1,3.5;1,1;farming:coffee_beans 2;3;]'..
   'item_image_button[4,1.5;1,1;stations:mortar;mortar;]'..
   'item_image_button[4,4;1,1;epic:healing_powder;output;]'
   --Using will instantly provide the user with 20 HP, and bystanders get a boost as well.

local scroll_bloodstone_powder = --Pyramid treasure
   'size[6,6]'..
   'no_prepend[]'..
   'bgcolor[#080808BB;true]'..
   'background[0,0;6,6;stations_scroll_bg.png]'..
   'hypertext[0,.2;6.5,1;;<center><style color=black size=32>~~ Bloodstone Powder ~~</style></center>]'..
   'hypertext[0.75,.75;5,1;;<left><style color=black size=20>Used in recipes.</style></left>]'..
   'item_image_button[1,1.5;1,1;epic:bloodstone_shard;1;]'..
   'item_image_button[4,1.5;1,1;stations:mortar;mortar;]'..
   'item_image_button[4,4;1,1;epic:bloodstone_powder 3;output;]'

local scroll_anti_fire = --Goblins,
   'size[6,6]'..
   'no_prepend[]'..
   'bgcolor[#080808BB;true]'..
   'background[0,0;6,6;stations_scroll_bg.png]'..
   'hypertext[0,.2;6.5,1;;<center><style color=black size=32>~~ Anti Fire Powder ~~</style></center>]'..
   'hypertext[0.75,.75;5,1;;<left><style color=black size=20>Place to form fire lanes. When it burns it will extinguish surrounding flames.</style></left>]'..
   'item_image_button[1,1.5;1,1;earthbuild:quicklime 4;1;]'..
   'item_image_button[1,2.5;1,1;epic:ash;2;]'..
   'item_image_button[1,3.5;1,1;epic:salt;3;]'..
   'item_image_button[4,1.5;1,1;stations:mortar;mortar;]'..
   'item_image_button[4,4;1,1;epic:fire_extinguishing_powder;output;]'
   --Place on the ground to form fire lanes. When it burns it extinguishes surrounding flames.

local scroll_wood_ash = --Goblins,
   'size[6,6]'..
   'no_prepend[]'..
   'bgcolor[#080808BB;true]'..
   'background[0,0;6,6;stations_scroll_bg.png]'..
   'hypertext[0,.2;6.5,1;;<center><style color=black size=32>~~ Wood Ash ~~</style></center>]'..
   'hypertext[0.75,.75;5,1;;<left><style color=black size=20>Used in other recipes.</style></left>]'..
   'item_image_button[1,1.5;1,1;epic:wood_ash;1;]'..
   'item_image_button[4,1.5;1,1;stations:mortar;mortar;]'..
   'item_image_button[4,4;1,1;epic:ash;output;]'

local scroll_chitin = --Pyramid treasure
   'size[6,6]'..
   'no_prepend[]'..
   'bgcolor[#080808BB;true]'..
   'background[0,0;6,6;stations_scroll_bg.png]'..
   'hypertext[0,.2;6.5,1;;<center><style color=black size=32>~~ Chitin ~~</style></center>]'..
   'hypertext[0.75,.75;5,1;;<left><style color=black size=20>Used as a binder in various crystal recipes.</style></left>]'..
   'item_image_button[1,1.5;1,1;scorpion:shell;1;]'..
   'item_image_button[4,1.5;1,1;stations:mortar;mortar;]'..
   'item_image_button[4,4;1,1;stations:chitin 4;output;]'

local scroll_sulfur_dust = --Goblins,
   'size[6,6]'..
   'no_prepend[]'..
   'bgcolor[#080808BB;true]'..
   'background[0,0;6,6;stations_scroll_bg.png]'..
   'hypertext[0,.2;6.5,1;;<center><style color=black size=32>~~ Sulfur Dust ~~</style></center>]'..
   'hypertext[0.75,.75;5,1;;<left><style color=black size=20>Used in other recipes.</style></left>]'..
   'item_image_button[1,1.5;1,1;epic:sulfur_lump;1;]'..
   'item_image_button[4,1.5;1,1;stations:mortar;mortar;]'..
   'item_image_button[4,4;1,1;epic:sulfur_dust 4;output;]'

local scroll_gunpowder = --Zombies, Pyramid treasure, Goblins,
   'size[6,6]'..
   'no_prepend[]'..
   'bgcolor[#080808BB;true]'..
   'background[0,0;6,6;stations_scroll_bg.png]'..
   'hypertext[0,.2;6.5,1;;<center><style color=black size=32>~~ Gunpowder ~~</style></center>]'..
   'hypertext[0.75,.75;5,1;;<left><style color=black size=20>Used to make explosives.</style></left>]'..
   'item_image_button[1,1.5;1,1;epic:potassium_nitrate 4;1;]'..
   'item_image_button[1,2.5;1,1;stations:coal_dust;2;]'..
   'item_image_button[1,3.5;1,1;epic:sulfur_dust;3;]'..
   'item_image_button[4,1.5;1,1;stations:mortar;mortar;]'..
   'item_image_button[4,4;1,1;tnt:gunpowder 6;output;]'

local scroll_poison = --Pyramid treasure,
   'size[6,6]'..
   'no_prepend[]'..
   'bgcolor[#080808BB;true]'..
   'background[0,0;6,6;stations_scroll_bg.png]'..
   'hypertext[0,.2;6.5,1;;<center><style color=black size=32>~~ Poison ~~</style></center>]'..
   'hypertext[0.75,.75;5,1;;<left><style color=black size=20>When animals eat this they die.</style></left>]'..
   'item_image_button[1,1.5;1,1;flowers:mushroom_red;1;]'..
   'item_image_button[1,2.5;1,1;flowers:tulip_black;2;]'..
   'item_image_button[1,3.5;1,1;default:leaves;3;]'..
   'item_image_button[4,1.5;1,1;stations:mortar;mortar;]'..
   'item_image_button[4,4;1,1;epic:poison;output;]'

local scroll_coffee_grounds = --gnomes,
   'size[6,6]'..
   'no_prepend[]'..
   'bgcolor[#080808BB;true]'..
   'background[0,0;6,6;stations_scroll_bg.png]'..
   'hypertext[0,.2;6.5,1;;<center><style color=black size=32>~~ Coffee Grounds ~~</style></center>]'..
   'hypertext[0.75,.75;5,1;;<left><style color=black size=20>Used to create wood stain.</style></left>]'..
   'item_image_button[1,1.5;1,1;farming:coffee_beans;1;]'..
   'item_image_button[4,1.5;1,1;stations:mortar;mortar;]'..
   'item_image_button[4,4;1,1;stations:coffee_grounds 4;output;]'

local all_scrolls = {
   {'teleport', 'Teleport powder', scroll_teleport},
   {'healing', 'Healing powder', scroll_healing},
   {'bloodstone_powder', 'Bloodstone powder', scroll_bloodstone_powder},
   {'anti_fire', 'Anti fire powder', scroll_anti_fire},
   {'wood_ash', 'Wood Ash', scroll_wood_ash},
   {'chitin', 'Chitin', scroll_chitin},
   {'sulfur_dust', 'Sulfur Dust', scroll_sulfur_dust},
   {'gunpowder', 'Gunpowder', scroll_gunpowder},
   {'poison', 'Poison', scroll_poison},
   {'coffee_grounds', 'Coffee Grounds', scroll_coffee_grounds},
}

for i in ipairs (all_scrolls) do
   local string = all_scrolls[i][1]
   local name = all_scrolls[i][2]
   local form = all_scrolls[i][3]

   minetest.register_craftitem('stations:scroll_'..string, {
      description = name..' recipe',
      inventory_image = 'stations_scroll.png',
      groups = {not_in_creative_inventory=1},
      on_use = function(itemstack, user, pointed_thing)
         local player_name = user:get_player_name()
         minetest.show_formspec(player_name, 'stations:scroll_'..string, form)
         end
   })

   minetest.register_craft({
      type = 'fuel',
      recipe = 'stations:scroll_'..string,
      burntime = 1,
   })
end
