{"id":21082275,"url":"https://github.com/olsonpm/starbound_quest-scope-hook","last_synced_at":"2025-06-17T05:02:21.997Z","repository":{"id":80606807,"uuid":"117631903","full_name":"olsonpm/starbound_quest-scope-hook","owner":"olsonpm","description":null,"archived":false,"fork":false,"pushed_at":"2018-01-17T01:00:10.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-07T21:02:24.782Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/olsonpm.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-16T04:38:45.000Z","updated_at":"2018-01-16T04:38:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"d65e10e1-0833-4654-9bc2-ee93f0c71fa3","html_url":"https://github.com/olsonpm/starbound_quest-scope-hook","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/olsonpm/starbound_quest-scope-hook","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olsonpm%2Fstarbound_quest-scope-hook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olsonpm%2Fstarbound_quest-scope-hook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olsonpm%2Fstarbound_quest-scope-hook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olsonpm%2Fstarbound_quest-scope-hook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/olsonpm","download_url":"https://codeload.github.com/olsonpm/starbound_quest-scope-hook/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olsonpm%2Fstarbound_quest-scope-hook/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260294416,"owners_count":22987618,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T20:13:30.502Z","updated_at":"2025-06-17T05:02:21.900Z","avatar_url":"https://github.com/olsonpm.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Starbound - Quest Scope Hook\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n#### Table of Contents\n- [What is it?](#what-is-it)\n- [Why create it?](#why-create-it)\n- [How to install it?](#how-to-install-it)\n- [How it works](#how-it-works)\n- [Notes](#notes)\n- [Todo ideas](#todo-ideas)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n### What is it?\nThis mod enables dependent mods to write functions which will run during the\ninit and update [Lua Hooks](https://github.com/olsonpm/starbound_lua-hooks)\nof an everlasting invisible quest.  Your function will thus have access to\nglobals such as [`player`](https://starbounder.org/Modding:Lua/Tables/Player)\nwhich are available in quest contexts, which is the purpose of this mod.\n\n\n### Why create it?\nI'm new to modding, but this seemed to be the easiest way for me to keep track\nof whether a player contained an item in their inventory.  Because\n`player_primary.lua` doesn't have access to the [`player`](https://starbounder.org/Modding:Lua/Tables/Player)\nglobal, I use this mod in my [Health Monitor](https://github.com/olsonpm/starbound_health-monitor)\nto poll the inventory and send a message to the player if the health monitor is\nadded or removed.  It can then stop or start the low health effect accordingly.\n\n\n### How to install it\n[Like this](https://github.com/olsonpm/starbound_health-monitor/blob/master/docs/how-to-install.md)\n\n\n### How to use it\nThis mod makes use of my [Lua Hooks](https://github.com/olsonpm/starbound_lua-hooks)\nmod to expose hooks, so first you'll need to add an init script as explained on\nthat repo.\n\nAssume the following\n1. you have a mod named `my-mod`\n2. you patched the `initscripts.json` to add a script `my-init-script.lua`\n3. you want to print \"quest init ran!\" when the invisible quest runs `init()`\n4. and you want to print \"quest update ran!\" when the invisible quest runs `update()`\n\nYou would achieve 3 \u0026 4 by writing:\n\n```lua\n-- /mods/my-mod/my-init-script.lua\n\n\n--\n-- just some convenience variables\n--\nlocal questScopeHooks = luaHooks.questScopeHook[\"/quests/scripts/questscopehook.lua\"]\n\nlocal functionsToRun = {\n  onQuestInit = questScopeHooks.onInit,\n  onQuestUpdate = questScopeHooks.onUpdate\n}\n\n\n--\n-- now for the functions we want to call (assumptions 3 \u0026 4)\n--\nlocal willRunOnQuestInit = function()\n  sb.logInfo(\"quest init ran!\")\nend\n\n-- this will spew a lot of lines in starbound.log!\nlocal willRunOnQuestUpdate = function()\n  sb.logInfo(\"quest update ran!\")\nend\n\n\n--\n-- and finally insert the functions into the hooks\n--\ntable.insert(functionsToRun.onQuestInit, willRunOnQuestInit)\ntable.insert(functionsToRun.onQuestUpdate, willRunOnQuestUpdate)\n```\n\n\n### Notes\n\n- I didn't know what `dt` value to put for the quest so I arbitrarily coded it\nto 30.  If you feel this should be a different value then you should file an\nissue so I can understand why.  I'm open to changing it.\n\n- Currently this only exposes the `init()` and `update()` methods of the quest.\nIf you want more to be added just file an issue.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folsonpm%2Fstarbound_quest-scope-hook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Folsonpm%2Fstarbound_quest-scope-hook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folsonpm%2Fstarbound_quest-scope-hook/lists"}