Created
December 15, 2023 00:33
-
-
Save Mr-Ojii/f9806fd3498bd3a5120f89bc08fa9c86 to your computer and use it in GitHub Desktop.
1秒ごとに...テキストを表示します
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--書き方あってるのか全く分からんが、とりあえず動いてるからヨシ! | |
--バグがあったらすみません | |
--[[ | |
These codes are licensed under CC0. | |
http://creativecommons.org/publicdomain/zero/1.0/deed.ja | |
]] | |
obs = obslua | |
source_name = "" | |
prefix = "" | |
count_text = 0 | |
function set_text() | |
local source = obs.obs_get_source_by_name(source_name) | |
if source ~= nil then | |
local settings = obs.obs_data_create() | |
local text = prefix; | |
for i = 1, count_text do | |
text = text.."." | |
end | |
count_text = (count_text + 1) % 4 | |
obs.obs_data_set_string(settings, "text", text) | |
obs.obs_source_update(source, settings) | |
obs.obs_data_release(settings) | |
obs.obs_source_release(source) | |
end | |
end | |
function script_description() | |
return "テキストソースに...と表示します" | |
end | |
function script_properties() | |
local props = obs.obs_properties_create() | |
local p = obs.obs_properties_add_list(props, "source", "Text Source", obs.OBS_COMBO_TYPE_EDITABLE, obs.OBS_COMBO_FORMAT_STRING) | |
local sources = obs.obs_enum_sources() | |
if sources ~= nil then | |
for _, source in ipairs(sources) do | |
source_id = obs.obs_source_get_unversioned_id(source) | |
if source_id == "text_gdiplus" or source_id == "text_ft2_source" then | |
local name = obs.obs_source_get_name(source) | |
obs.obs_property_list_add_string(p, name, name) | |
end | |
end | |
end | |
obs.source_list_release(sources) | |
obs.obs_properties_add_text(props, "prefix", "Prefix", obs.OBS_TEXT_DEFAULT) | |
return props | |
end | |
function script_update(settings) | |
source_name = obs.obs_data_get_string(settings, "source") | |
prefix = obs.obs_data_get_string(settings, "prefix") | |
end | |
function script_load(settings) | |
obs.timer_add(set_text, 1000) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment