-- spawnable items shelter etc --entity_number1 = 45 --shelter --entity_number2 = 30 --workbench --entity_number3 = 30 --stove -- globals local U = require "scriptbank\\utillib" -- change the values in this list to match the entity Ids on your map g_makeAbleEntities = {['Axe'] = 7, ['Hammer'] = 13, ['Dagger'] = 0, ['Bow'] = 0, ['Pistol'] = 0, ['Rifle'] = 0, ['pAmmo'] = 0, ['rAmmo'] = 0 } g_exp = 0 g_featherscollected = 0 g_shelter = 0 g_workbench = 0 g_cooker = 0 g_furnace = 0 g_lathe = 0 local tSize = 2 -- Buttons Arrays local MainButtons = {} local RecipeButtons = {} local Cursor = nil function survival_inventory_init(e) Include( "utillib.lua" ) if GetDeviceWidth() > 1600 then tSize = 1 end if GetDeviceWidth() > 2200 then tSize = 3 end -- Option Buttons as Button 1 - whatever local use = LoadImage( "scriptbank\\ss1\\use.png" ) MainButtons = {['iIron'] = { x = 3, y = 59, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option1.png" )) }, ['iLead'] = { x = 14, y = 59, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option2.png" )) }, ['iCopper'] = { x = 25, y = 59, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option3.png" )) }, ['exit'] = { x = 47, y = 69, w = 6, h = 15, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_ok.png" )) }, ['lathe'] = { x = 70, y = 38, w = 4, h = 2, s = CreateSprite( use ) }, ['furnace'] = { x = 70, y = 50, w = 4, h = 2, s = CreateSprite( use ) }, ['exp'] = { x = 80, y = 3, w = 12, h = 5, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option7.png" )) }, -- Menu icons ['tools'] = { x = 52, y = 18, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option8.png" )) }, ['weapons'] = { x = 52, y = 30, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option9.png" )) }, ['bldgs'] = { x = 52, y = 43, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option10.png" )) }, ['food'] = { x = 52, y = 57, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option11.png" )) }, ['fibers'] = { x = 3, y = 18, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option12.png" )) }, ['water'] = { x = 3, y = 26, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\flask.png" )) }, ['flint'] = { x = 3, y = 34, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option14.png" )) }, ['wood'] = { x = 3, y = 42, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option15.png" )) }, ['meat'] = { x = 14, y = 26, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option16.png" )) }, ['hides'] = { x = 27, y = 26, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option17.png" )) }, ['nails'] = { x = 38, y = 26, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\nails.png" )) }, -- Menu icons end -- Use Buttons ['hammer'] = { x = 70, y = 19, w = 4, h = 2, s = CreateSprite( use ) }, ['axe'] = { x = 92, y = 19, w = 4, h = 2, s = CreateSprite( use ) }, ['dagger'] = { x = 70, y = 29, w = 4, h = 2, s = CreateSprite( use ) }, ['bow'] = { x = 92, y = 29, w = 4, h = 2, s = CreateSprite( use ) }, ['arrow'] = { x = 92, y = 33, w = 4, h = 2, s = CreateSprite( use ) }, ['byPie'] = { x = 70, y = 56, w = 4, h = 2, s = CreateSprite( use ) }, ['mxpie'] = { x = 92, y = 56, w = 4, h = 2, s = CreateSprite( use ) }, ['mtPie'] = { x = 70, y = 60, w = 4, h = 2, s = CreateSprite( use ) }, ['mtSoup'] = { x = 92, y = 60, w = 4, h = 2, s = CreateSprite( use ) }, ['shelter'] = { x = 70, y = 44, w = 4, h = 2, s = CreateSprite( use ) }, ['stove'] = { x = 92, y = 42, w = 4, h = 2, s = CreateSprite( use ) }, ['wkbench'] = { x = 92, y = 46, w = 4, h = 2, s = CreateSprite( use ) }, ['tubers'] = { x = 15, y = 18, w = 3, h = 3, s = CreateSprite( LoadImage( "scriptbank\\ss1\\tubers.png" )) }, ['berries'] = { x = 26, y = 18, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\berries.png" )) }, ['iron'] = { x = 14, y = 34, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\iron.png" )) }, ['copper'] = { x = 26, y = 34, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\copper.png" )) }, ['lead'] = { x = 38, y = 34, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\lead.png" )) }, ['planks'] = { x = 14, y = 42, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\planks.png" )) }, ['logs'] = { x = 26, y = 42, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\logs.png" )) }, ['resin'] = { x = 38, y = 42, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\resin.png" )) }, ['chems'] = { x = 3, y = 50, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\chems.png" )) }, ['chems2'] = { x = 14, y = 50, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\chems2.png" )) }, ['chems3'] = { x = 26, y = 50, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\chems3.png" )) }, ['steel'] = { x = 38, y = 59, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\isteel.png" )) }, ['splate'] = { x = 38, y = 50, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\splate.png" )) }, ['hndgun'] = { x = 57, y = 73, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\pistol.png" )) }, ['lnggun'] = { x = 57, y = 80, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\rifle.png" )) }, ['ammo1'] = { x = 77, y = 73, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\ammo.png" )) }, ['ammo2'] = { x = 77, y = 80, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\ammo.png" )) }, ['pistol'] = { x = 70, y = 74, w = 4, h = 2, s = CreateSprite( use ) }, ['pAmmo'] = { x = 92, y = 74, w = 4, h = 2, s = CreateSprite( use ) }, ['rifle'] = { x = 70, y = 82, w = 4, h = 2, s = CreateSprite( use ) }, ['rAmmo'] = { x = 92, y = 82, w = 4, h = 2, s = CreateSprite( use ) }, ['title'] = { x = 39, y = 0, w = 20, h = 10, s = CreateSprite( LoadImage( "scriptbank\\ss1\\title.png" )) }, ['shrooms'] = { x = 37, y = 18, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\mushroom.png" )) }, ['bandage'] = { x = 5, y = 73, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\dressing.png" )) }, ['medkit'] = { x = 5, y = 80, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\medikit.png" )) }, ['pill1'] = { x = 25, y = 73, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\pill1.png" )) }, ['pill2'] = { x = 25, y = 80, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\pill2.png" )) }, ['dressing'] = { x = 18, y = 74, w = 4, h = 2, s = CreateSprite( use ) }, ['mediKit'] = { x = 18, y = 82, w = 4, h = 2, s = CreateSprite( use ) }, ['antidote'] = { x = 37, y = 74, w = 4, h = 2, s = CreateSprite( use ) }, ['booster'] = { x = 37, y = 82, w = 4, h = 2, s = CreateSprite( use ) }, ['recipes'] = { x = 4, y = 3, w = 13, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\recipies.png" )) } } RecipeButtons = { ['recipes'] = { x = 10, y = 10, w = 80, h = 80, s = CreateSprite( LoadImage( "scriptbank\\ss1\\recipes.png" )) } } -- MouseCursor Cursor = CreateSprite( LoadImage ( "scriptbank\\ss1\\cursor.png" )) SetSpriteSize ( Cursor, 2.5, 2.5 ) SetSpritePosition( Cursor, 200, 200 ) for _, v in pairs( MainButtons ) do SetSpriteSize ( v.s, v.w , v.h ) SetSpritePosition ( v.s, 200, 200 ) end for _, v in pairs( RecipeButtons ) do SetSpriteSize ( v.s, v.w , v.h ) SetSpritePosition ( v.s, 200, 200 ) end end local MouseActive = false local pressed = false local MouseDown = false local function ShowMouseCoords() -- for if you need to know them Prompt ("X :"..g_MouseX.." Y:"..g_MouseY) end local function MainMenuActivated() for _, v in pairs( MainButtons ) do SetSpritePosition ( v.s, v.x, v.y ) end end local function RecipeMenuActivated() for _, v in pairs( RecipeButtons ) do SetSpritePosition ( v.s, v.x, v.y ) end end local currMenu = 'Main' local function HideSprites() if currMenu == 'Main' then for _, v in pairs( MainButtons ) do SetSpritePosition ( v.s, 200, 200 ) end elseif currMenu == 'recipes' then for _, v in pairs( RecipeButtons ) do SetSpritePosition ( v.s, 200, 200 ) end end end local function MouseDeactivated() DeactivateMouse() MouseActive = false SetSpritePosition( Cursor, 200, 200 ) SetPlayerWeapons(1) HideSprites() end local mainMenuText = { [ 'Fibers' ] = { x = 8, y = 20 }, [ 'Tubers' ] = { x = 19, y = 20 }, [ 'Berries' ] = { x = 32, y = 20 }, [ 'Shrooms' ] = { x = 42, y = 20 }, [ 'Wood' ] = { x = 8, y = 44 }, [ 'Flints' ] = { x = 8, y = 36 }, [ 'Resin' ] = { x = 43, y = 44 }, -- Metal Ores [ 'Iron' ] = { x = 19, y = 36 }, [ 'Copper' ] = { x = 32, y = 36 }, [ 'Lead' ] = { x = 43, y = 36 }, -- Chemicals [ 'Sulphur' ] = { x = 8, y = 52 }, ['Saltpeter'] = { x = 19, y = 52 }, [ 'Carbon' ] = { x = 32, y = 52 }, -- Meds [ 'Bandages' ] = { x = 10, y = 75 }, [ 'Medipacks' ] = { x = 10, y = 83 }, [ 'Antidote' ] = { x = 30, y = 75 }, [ 'Boosters' ] = { x = 30, y = 83 }, -- Weapons / Tools [ 'Hammers Crafted' ] = { x = 57, y = 20 }, [ "Axes Crafted" ] = { x = 79, y = 20 }, [ 'Daggers Crafted' ] = { x = 57, y = 30 }, [ 'Bows Crafted' ] = { x = 79, y = 30 }, [ 'Arrows Crafted' ] = { x = 79, y = 34 }, [ 'Pistols' ] = { x = 64, y = 75 }, [ 'Rifles' ] = { x = 64, y = 83 }, [ 'Pistol Ammo' ] = { x = 82, y = 75 }, [ 'Rifle Ammo' ] = { x = 82, y = 83 }, -- General Constructables [ 'Planks' ] = { x = 19, y = 44 }, [ 'Logs' ] = { x = 32, y = 44 }, [ 'Nails' ] = { x = 43, y = 28 }, [ 'S Plate' ] = { x = 43, y = 52 }, [ 'Flask' ] = { x = 8, y = 27 }, -- metal ingots [ 'iIngot' ] = { x = 8, y = 61 }, [ 'lIngot' ] = { x = 19, y = 61 }, [ 'cIngot' ] = { x = 30, y = 61 }, [ 'sIngot' ] = { x = 43, y = 61 }, -- other stuff [ 'Water' ] = { x = 8, y = 29 }, [ 'Hides' ] = { x = 32, y = 28 }, [ 'Meat' ] = { x = 19, y = 28 }, -- menu text food [ 'Berry pies crafted' ] = { x = 57, y = 57 }, [ 'Mixed pie crafted' ] = { x = 79, y = 57 }, [ 'Meat Pies crafted' ] = { x = 57, y = 61 }, [ 'Meat soup crafted' ] = { x = 79, y = 61 } } local function ShowMainMenu( foraged ) Panel( 0, 0, 100, 88) -- background Panel( 37, 1, 61, 10) -- Top Panel( 1, 13, 49.5, 68) -- left Panel( 49.5, 13, 99, 68) -- right Panel( 55, 69, 99, 86) -- right bottom Panel( 1, 69, 45, 86) -- left bottom Panel( 78, 1, 98, 10) -- survival exp Panel( 1, 1, 21, 10) -- survival exp local function doTextGreen( x, y, name, value ) TextColor( x, y, tSize, name .. " " .. math.floor( value ), 10, 255, 10 ) end local function doTextRed( x, y, name) TextColor( x, y, tSize, name, 200, 10, 10 ) end local function doTextForaged (x, y, name ) local f = foraged[ name ] if f ~= nil then doTextGreen( x, y, name, f.amount ) else doTextRed( x, y, name ) end end --menu text plants for name, loc in pairs( mainMenuText ) do doTextForaged( loc.x, loc.y, name ) end --menu text experience doTextGreen( 91, 6, '', g_exp ) -- !!! still TODO items !!! --menu text housing doTextGreen( 57, 45, "Shelters Crafted", g_shelter ) doTextGreen( 79, 43, "Stove Crafted", g_cooker ) doTextGreen( 79, 47, "Workbench Crafted", g_workbench ) doTextGreen( 57, 51, "Furnace Crafted", g_furnace ) doTextGreen( 57, 39, "Lathe Crafted", g_lathe ) end local function ShowRecipesMenu() -- Text stuff for Recipes in here end local function HandleMouseClicks( foraged ) U.SetList( foraged ) local bt_clicked = 'none' if currMenu == 'Main' then -- Handle Your mouse click events here for k, v in pairs( MainButtons ) do if g_MouseX > v.x and g_MouseX < v.x + v.w and g_MouseY > v.y and g_MouseY < v.y + v.h then bt_clicked = k break end end if bt_clicked == 'none' then return end --PromptDuration( bt_clicked , 2000 ) -- Handle your bt_clicked events here: bt_clicked option chosen if bt_clicked == 'iIron' then -- Button 1 clicked PromptDuration ( "Iron Ingot", 3000 ) elseif bt_clicked == 'iLead' then PromptDuration ( "Lead Ingot", 3000 ) elseif bt_clicked == 'iCopper' then PromptDuration ( "Copper Ingot", 3000 ) elseif bt_clicked == 'exit' then MouseDeactivated() elseif bt_clicked == 'lathe' then PromptDuration ( "Lathe", 3000 ) elseif bt_clicked == 'furnace' then PromptDuration ( "Furnace", 3000 ) elseif bt_clicked == 'exp' then PromptDuration ( "Experience", 3000 ) -- lines below are to tell GG what to actually do when the buttons are pressed e.g copy and paste a section and edit to suit -- use buttons elseif bt_clicked == 'hammer' and U.HaveEnough( 'Wood', 2 ) and U.HaveEnough( 'Fibers', 2 ) and U.HaveEnough( 'Flints', 2 ) then AddPlayerWeapon( g_makeAbleEntities[ 'Hammer' ] ) U.ChangeAmount( 'Wood', -2 ) -- take items from inventory U.ChangeAmount( 'Fibers', -2 ) -- take items from inventory U.ChangeAmount( 'Flints', -2 ) -- take items from inventory U.ChangeAmount( 'Hammers Crafted', 1 ) g_exp = g_exp + 10 -- adds exp N.B you can change this to what you want depending on the complexity of each item PromptDuration ( "You Crafted a Hammer", 3000 ) elseif bt_clicked == 'axe' and U.HaveEnough( 'Wood', 2 ) and U.HaveEnough( 'Fibers', 2 ) and U.HaveEnough( 'Flints', 2 ) then AddPlayerWeapon( g_makeAbleEntities[ 'Axe' ] ) U.ChangeAmount( 'Wood', -2 ) -- take items from inventory U.ChangeAmount( 'Fibers', -2 ) -- take items from inventory U.ChangeAmount( 'Flints', -2 ) -- take items from inventory U.ChangeAmount( 'Axes Crafted', 1 ) g_exp = g_exp + 10 -- adds exp PromptDuration ( "You Crafted an Axe", 3000 ) elseif bt_clicked == 'dagger' and U.HaveEnough( 'Wood', 2 ) and U.HaveEnough( 'Fibers', 2 ) and U.HaveEnough( 'Flints', 2 ) then AddPlayerWeapon( g_makeAbleEntities[ 'Dagger' ] ) U.ChangeAmount( 'Wood', -2 ) -- take items from inventory U.ChangeAmount( 'Fibers', -2 ) -- take items from inventory U.ChangeAmount( 'Flints', -2 ) -- take items from inventory U.ChangeAmount( 'Daggers Crafted', 1 ) g_exp = g_exp + 10 -- adds exp PromptDuration ( "You Crafted a Dagger", 3000 ) elseif bt_clicked == 'bow' and U.HaveEnough( 'Wood', 2 ) and U.HaveEnough( 'Fibers', 2 ) and U.HaveEnough( 'Flints', 2 ) then AddPlayerWeapon( g_makeAbleEntities[ 'Bow' ] ) U.ChangeAmount( 'Wood', -2 ) -- take items from inventory U.ChangeAmount( 'Fibers', -2 ) -- take items from inventory U.ChangeAmount( 'Flints', -2 ) -- take items from inventory U.ChangeAmount( 'Bows Crafted', 1 ) -- adds crafted item to inventory for exp g_exp = g_exp + 10 -- adds exp PromptDuration ( "You Crafted a Bow", 3000 ) elseif bt_clicked == 'arrow' and U.HaveEnough( 'Wood', 2 ) and U.HaveEnough( 'Fibers', 2 ) and U.HaveEnough( 'Flints', 2 ) then AddPlayerAmmo( g_makeAbleEntities[ 'Arrow' ] ) U.ChangeAmount( 'Wood', -2 ) -- take items from inventory U.ChangeAmount( 'Fibers', -2 ) -- take items from inventory U.ChangeAmount( 'Flints', -2 ) -- take items from inventory U.ChangeAmount( 'Arrows Crafted', 1) -- adds crafted item to inventory for exp g_exp = g_exp + 10 -- adds exp PromptDuration ( "You Crafted 10 Arrows", 3000 ) elseif bt_clicked == 'byPie' and U.HaveEnough( 'Berry Pie', 1 ) then U.ChangeAmount( 'Berry Pie', -1 ) -- subtract item SetPlayerHealth( g_PlayerHealth + 21 ) AddPlayerHealth( 40 ) g_exp = g_exp + 10 -- adds exp PromptDuration ( "Eat Berry Pie", 3000 ) elseif bt_clicked == 'mxpie' and U.HaveEnough( 'Mixed pie crafted', 1 ) then U.ChangeAmount( 'Mixed pie crafted', -1 ) -- subtract item from inventory SetPlayerHealth( g_PlayerHealth + 11 ) AddPlayerHealth ( 40 ) g_exp = g_exp + 10 -- adds exp PromptDuration ( "Meat,berry,shroom & Tuber Pie", 3000 ) elseif bt_clicked == 'mtPie' and U.HaveEnough( 'Meat Pies crafted', 1 ) then U.ChangeAmount( 'Meat Pies crafted', -1 ) -- subtract item from inventory SetPlayerHealth( g_PlayerHealth + 41 ) AddPlayerHealth ( 40 ) g_exp = g_exp + 10 --adds exp PromptDuration ( "You Eat Meat & Berry Pie", 3000 ) elseif bt_clicked == 'mtSoup' and U.HaveEnough( 'Meat soup crafted', 1 ) then U.ChangeAmount( 'Meat soup crafted', -1 ) -- subtract item from inventory SetPlayerHealth( g_PlayerHealth + 31 ) AddPlayerHealth( 40 ) g_exp = g_exp + 10 --adds exp PromptDuration ( "You eat Meat Soup", 3000 ) elseif bt_clicked == 'shelter' and U.HaveEnough( 'Wood', 2 ) and U.HaveEnough( 'Fibers', 2 ) then U.ChangeAmount( 'Wood', -2 ) --take items from inventory U.ChangeAmount( 'Fibers', -2 ) --take items from inventory g_shelter = g_shelter + 1 -- add shelter to inventory g_exp = g_exp + 50 -- adds exp PromptDuration ( "You have crafted a shelter", 3000 ) elseif bt_clicked == 'stove' and U.HaveEnough( 'Wood', 2 ) and U.HaveEnough( 'Flints', 2 ) then U.ChangeAmount( 'Wood', - 2 ) --take items from inventory U.ChangeAmount( 'Flints', - 2 ) --take items from inventory g_cooker = g_cooker + 1 -- add fire to inventory g_exp = g_exp + 50 -- adds exp PromptDuration ( "You have crafted a cooker", 3000 ) elseif bt_clicked == 'wkbench' and U.HaveEnough( 'Wood', 2 ) and U.HaveEnough( 'Flints', 2 ) and U.HaveEnough( 'Iron', 4 ) then U.ChangeAmount( 'Wood', -2 ) --take items from inventory U.ChangeAmount( 'Flints', -2 ) --take items from inventory U.ChangeAmount( 'Iron', -4 ) --take items from inventory g_workbench = g_workbench + 1 g_exp = g_exp + 100 -- adds exp PromptDuration ( "You have crafted a Workbench", 3000 ) elseif bt_clicked == 'pistol' and U.HaveEnough( 'Pistols', 1 ) then AddPlayerWeapon( makeAbleEntities[ 'Pistol' ] ) U.ChangeAmount( 'Pistols', -1 ) PromptDuration ( "Pistol Used", 3000) elseif bt_clicked == 'pAmmo' and U.HaveEnough( 'Pistol Ammo', 1 ) then AddPlayerAmmo( makeAbleEntities[ 'pAmmo' ] ) U.ChangeAmount( 'Pistol Ammo', -1 ) PromptDuration ( "Pistol Ammo Used", 3000 ) elseif bt_clicked == 'rifle' and U.HaveEnough( 'Rifles', 1 ) then AddPlayerWeapon( makeAbleEntities[ 'Rifle' ] ) U.ChangeAmount( 'Rifles', -1 ) PromptDuration ( "Rifle Used", 3000 ) elseif bt_clicked == 'rAmmo' and U.HaveEnough( 'Rifle Ammo', 1 ) then AddPlayerAmmo( makeAbleEntities[ 'rAmmo' ] ) U.ChangeAmount( 'Rifle Ammo', -1 ) PromptDuration ( "Rifle Ammo Used", 3000 ) elseif bt_clicked == 'dressing' and U.HaveEnough( 'Bandages', 1 ) then AddPlayerHealth( 50 ) U.ChangeAmount( 'Bandages', -1 ) PromptDuration ( "Dressing Used", 3000 ) elseif bt_clicked == 'mediKit' and U.HaveEnough( 'Medipacks', 1 ) then AddPlayerHealth( 100 ) U.ChangeAmount( 'Medipacks', -1 ) PromptDuration ( "Medikit Used", 3000 ) elseif bt_clicked == 'antidote' and U.HaveEnough( 'Antidote', 1 ) then U.ChangeAmount( 'Antidote', -1 ) PromptDuration ( "Antidote Used", 3000 ) elseif bt_clicked == 'booster' and U.HaveEnough( 'Boosters', 1 ) then U.ChangeAmount( 'Boosters', -1 ) PromptDuration ( "Booster Used", 3000 ) elseif bt_clicked == 'recipes' then -- change menu HideSprites() currMenu = 'recipes' RecipeMenuActivated() end elseif currMenu == 'recipes' then -- Recipe stuff in here for k, v in pairs( RecipeButtons ) do if g_MouseX > v.x and g_MouseX < v.x + v.w and g_MouseY > v.y and g_MouseY < v.y + v.h then bt_clicked = k break end end if bt_clicked == 'none' then return end if bt_clicked == 'recipes' then HideSprites() currMenu = 'Main' MainMenuActivated() end end end function survival_inventory_main( e ) local baseOsT = nil local weaponId = nil function survival_inventory_main( e ) local T = os.time() if baseOsT == nil then baseOsT = T end TextColor(3, 94, tSize + 2, os.date("You have survived for %X", T - baseOsT) , 252, 3, 47) if string.lower(GetInKey()) == "i" then if not pressed then pressed = true if MouseActive then MouseActive = false MouseDeactivated() else MouseActive = true ActivateMouse() currMenu = 'Main' MainMenuActivated() end end else pressed = false end if MouseActive then local foraged = g_foraged if weaponId == nil then weaponId = GetPlayerWeaponID() end SetPlayerWeapons(0) SetSpritePosition ( Cursor , g_MouseX ,g_MouseY ) if g_MouseClick == 1 then if not MouseDown then MouseDown = true HandleMouseClicks( foraged ) end else MouseDown = false end if currMenu == 'Main' then ShowMainMenu( foraged ) elseif currMenu == 'Recipes' then ShowRecipesMenu() end else DeactivateMouse() end end end