diff --git a/README.md b/README.md index 8104ef5..730054a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ # obs-overlay -toward a universal overlay \ No newline at end of file +toward a universal overlay + +## how 2 twitchery: + +1. import the script, add this thing to a scene +1. it will add a group and an image source for all the events it wants to show a reaction to in that group, and a text control for text. +1. you can replace any source you like with any type, this will check by name at the last moment. +1. set the settings you like on your sources. Which sounds like a nightmare? but you want to pick your individual media per thing, so eh. +1. when the setting "event to show right now" is set, it will cut it and do its thing - so if you're triggering twitch stuff via obs-websocket or whatever, just set this text. \ No newline at end of file diff --git a/lua-twitchery.lua b/lua-twitchery.lua deleted file mode 100644 index 72d52c0..0000000 --- a/lua-twitchery.lua +++ /dev/null @@ -1,6 +0,0 @@ -obs = obslua -bit = require("bit") - -source_def = {} -source_def.id = "lua_twitchery_source" -source_def.output_flags = bit.bor(obs.OBS_SOURCE_VIDEO, obs.OBS_SOURCE_CUSTOM_DRAW) \ No newline at end of file diff --git a/placeholder.png b/placeholder.png new file mode 100644 index 0000000..cb49285 Binary files /dev/null and b/placeholder.png differ diff --git a/twitchery.lua b/twitchery.lua new file mode 100644 index 0000000..d28cf13 --- /dev/null +++ b/twitchery.lua @@ -0,0 +1,121 @@ +obs = obslua +bit = require("bit") + +source_def = {} +source_def.id = "lua_twitchery_source" +source_def.type = obs.OBS_SOURCE_TYPE_INPUT +source_def.output_flags = bit.bor(obs.OBS_SOURCE_VIDEO, + obs.OBS_SOURCE_AUDIO, + obs.OBS_SOURCE_CUSTOM_DRAW) +-- source_def.icon_type = obs.OBS_ICON_TYPE_CUSTOM -- not implemented yet +defaultProps = obs.obs_properties_create() + +-- TODO: proper names, all events +twitchevents = {"tier 1 sub", "tier 2 sub", "tier 3 sub", "follow", "custom reward"} + +print("boy i love languages that ACTIVELY RESIST being debugged vvvvvv") +tableTest = {} +print(tableTest) +print("im already mad ^^^^^^") + +source_def.get_name = function() + return "twitchery controller" +end + +source_def.get_properties = function(data, type_data) + -- TODO + print("getting properties") + print("data:") + print(data) + print("type_data:") + print(type_data) +end + +-- get_defaults: SSSSSets the defaults. >_< +source_def.get_defaults = function(settings) + print("setting (not getting!) defaults") + print(settings) + obs.obs_data_set_default_string(settings, "active event", "") + return settings +end + +source_def.create = function(settings, source) + local data = {} + + local currentScene = obs.obs_scene_from_source(obs.obs_frontend_get_current_scene()) + + --data.group = obs.obs_scene_add_group(currentScene, "twitchery stuff") + --put self in + -- obs.obs_sceneitem_group_add_item(data.group, source) + + print("who knows if I work, what is debugging?") + --print(data.group) + print("settings:") + print(settings) + print("source:") + print(source) + -- obs.obs_sceneitem_get_sourc + --for all twitch respondable events; add item + --for i = 0, table.getn(twitchevents) do + -- print(twitchevents[i + 1]) + -- local anImage = obs.gs_image_file() + -- obs.obs_source_create("image_source", twitchevents[i + 1], nil, nil) + -- image_source_load(anImage, script_path() .. "placeholder.png") + --end + -- text_gdiplus + return data +end + +source_def.destroy = function(data) + -- TODO +end + +source_def.video_render = function(data, effect) + -- TODO +end + +source_def.get_width = function(data) + return 1920 +end + +source_def.get_height = function(data) + return 1080 +end + +source_def.update = function(data, settings) + local fff = obs.obs_data_get_string(settings, "active event") + print(fff) +end + +function script_description() + return "something to acknowledge twitch stuff." +end + +function update(data, settings) + print("updating!") + print(data) + print("settings:") + print(settings) +end + +obs.obs_register_source(source_def) + + +function image_source_load(image, file) + obs.obs_enter_graphics() + obs.gs_image_file_free(image) + obs.obs_leave_graphics() + + obs.gs_image_file_init(image, file) + + obs.obs_enter_graphics() + obs.gs_image_file_init_texture(image) + obs.obs_leave_graphics() + + if not image.loaded then + print("failed to load texture " .. file) + end +end + +-- FYI, your path back to built-ins: +-- C:\Program Files\obs-studio\data\obs-plugins\frontend-tools\scripts \ No newline at end of file