forked from midnight-studios/obs-lua
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ScoreBoard.lua
1861 lines (1769 loc) · 79 KB
/
ScoreBoard.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--[[
----------------------------------------------------------
Open Broadcaster Software®️
OBS > Tools > Scripts
@midnight-studios
Stopwatch
----------------------------------------------------------
]]
--Globals
obs = obslua
gversion = "0.1"
luafile = "ScoreBoard.lua"
obsurl = "score-board.1448/"
icon="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFIAAAApCAYAAACmyX6ZAAAACXBIWXMAAC4jAAAuIwF4pT92AAAFyGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDIgNzkuMTY0NDYwLCAyMDIwLzA1LzEyLTE2OjA0OjE3ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgMjEuMiAoV2luZG93cykiIHhtcDpDcmVhdGVEYXRlPSIyMDIyLTAxLTEwVDEzO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RGdSy70S3sUtQP8YigW+Rr8HY28Sab/eg152noOOI6W0h/XJxI9OldmBBcKjqAF8xTROwp4T7if84+u9BT0gLiT6wtxlYM1pG30XmpKB3OM7/V6OXOdLkipG5tBrbsbD6R1GG7ZFwMGo9cDtzKybGmbAdeJnV4bBZ6P/xkuB95FPjgP+6EW/UQJxvnAAAAAElFTkSuQmCC"
desc = [[
<hr/><center><h2>ScoreBoard</h2>( Version: %s )</center>
<br><center><img width=84 height=41 src=']] .. icon .. [['/></center>
<br><center><a href="https://github.com/midnight-studios/obs-lua/blob/main/]] .. luafile ..[[">Find it on GitHub</a></center>
<br><p>Score Board for your stream. Setup Hotkeys to the point you need.</p><p>Find help on the <a href="https://obsproject.com/forum/resources/]] .. obsurl ..[[">OBS Forum Thread</a>.</p><hr/>]]
script_props = nil
script_settings = nil
font_normal = "#ffffff"
font_dimmed = "#bfbbbf"
font_1 = "#bfbbbf"
font_2 = "#bfbbbf"
font_3 = "#bfbbbf"
font_4 = "#bfbbbf"
font_5 = "#bfbbbf"
text_sources = {}
source_name_hotkey = true
p_h_a_value = 0
p_h_b_value = 0
p_h_c_value = 0
p_h_d_value = 0
p_h_e_value = 0
p_v_a_value = 0
p_v_b_value = 0
p_v_c_value = 0
p_v_d_value = 0
p_v_e_value = 0
p_s_a_value = 0
p_s_b_value = 0
p_s_c_value = 0
p_s_d_value = 0
p_s_e_value = 0
p_h_a_int = 1
p_h_b_int = 1
p_h_c_int = 1
p_h_d_int = 1
p_h_e_int = 1
p_v_a_int = 1
p_v_b_int = 1
p_v_c_int = 1
p_v_d_int = 1
p_v_e_int = 1
p_s_a_int = 1
p_s_b_int = 1
p_s_c_int = 1
p_s_d_int = 1
p_s_e_int = 1
p_h_a_source = ""
p_h_b_source = ""
p_h_c_source = ""
p_h_d_source = ""
p_h_e_source = ""
p_v_a_source = ""
p_v_b_source = ""
p_v_c_source = ""
p_v_d_source = ""
p_v_e_source = ""
p_s_a_source = ""
p_s_b_source = ""
p_s_c_source = ""
p_s_d_source = ""
p_s_e_source = ""
p_h_a_1_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_h_b_1_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_h_c_1_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_h_d_1_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_h_e_1_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_v_a_1_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_v_b_1_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_v_c_1_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_v_d_1_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_v_e_1_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_s_a_1_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_s_b_1_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_s_c_1_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_s_d_1_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_s_e_1_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_h_a_0_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_h_b_0_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_h_c_0_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_h_d_0_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_h_e_0_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_v_a_0_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_v_b_0_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_v_c_0_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_v_d_0_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_v_e_0_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_s_a_0_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_s_b_0_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_s_c_0_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_s_d_0_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
p_s_e_0_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
reset_scoreboard_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
--[[
----------------------------------------------------------
-- Use this to create a Script Log Output used in testing
----------------------------------------------------------
]]
local function log( name, msg )
if msg ~= nil then
msg = " > " .. tostring( msg )
else
msg = ""
end
obs.script_log( obs.LOG_DEBUG, name .. msg )
end
--[[
----------------------------------------------------------
-- Get the name of this script
----------------------------------------------------------
]]
function filename()
local str = debug.getinfo(2).source:sub(2)
return str:match("^.*/(.*).lua$") or str
end
--[[
----------------------------------------------------------
A function named script_description returns the description shown to
the user
----------------------------------------------------------
]]
function script_description()
return string.format( desc, tostring( gversion ) )
end
--[[
----------------------------------------------------------
Function to set the source text
----------------------------------------------------------
]]
function set_text( source_name, text )
if source_name == 'Select' or source_name == 'select'then
return
end
--[[
Increments the source reference counter,
use obs_source_release() to release it when complete.
]]
local source = obs.obs_get_source_by_name( source_name )
if source ~= nil then
local settings = obs.obs_source_get_settings( source )
obs.obs_data_set_string( settings, "text", text )
end
obs.obs_source_update( source, settings )
obs.obs_data_release( settings )
obs.obs_source_release( source )
end
--[[
--------------------------------------------------------------------
--------------------------------------------------------------------
]]
function pairsByKeys(t, f)
local a = {}
for n in pairs(t) do table.insert(a, n) end
table.sort(a, f)
local i = 0 -- iterator variable
local iter = function () -- iterator function
i = i + 1
if a[i] == nil then return nil
else return a[i], t[a[i]]
end
end
return iter
end
--[[
--------------------------------------------------------------------
custom function: helper
----------------------------------------------------------
]]
function in_table( tbl, value )
local found = false
for k, v in pairs( tbl ) do
if value == v then
found = true
break
end
end
return found
end
--[[
--------------------------------------------------------------------
custom function: helper
----------------------------------------------------------
]]
function tablelength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
--[[
--------------------------------------------------------------------
custom function: helper
----------------------------------------------------------
]]
function remove_duplicates( tbl )
local hash = {}
local res = {}
for _,v in ipairs( tbl ) do
if ( not hash[v] ) then
res[#res+1] = v -- you could print here instead of saving to result table if you wanted
hash[v] = true
end
end
return res
end
--[[
----------------------------------------------------------
Callback on list modification
----------------------------------------------------------
]]
function property_onchange( props, property, settings )
local prop_name = obs.obs_property_name( property )
local prop_val = obs.obs_data_get_string( settings, prop_name )
local prop = obs.obs_properties_get( props, prop_name )
local temp_table = {}
-- Retrieves value selected in list
p_h_a_source = obs.obs_data_get_string( settings, "p_h_a_source" )
p_h_b_source = obs.obs_data_get_string( settings, "p_h_b_source" )
p_h_c_source = obs.obs_data_get_string( settings, "p_h_c_source" )
p_h_d_source = obs.obs_data_get_string( settings, "p_h_d_source" )
p_h_e_source = obs.obs_data_get_string( settings, "p_h_e_source" )
p_v_a_source = obs.obs_data_get_string( settings, "p_v_a_source" )
p_v_b_source = obs.obs_data_get_string( settings, "p_v_b_source" )
p_v_c_source = obs.obs_data_get_string( settings, "p_v_c_source" )
p_v_d_source = obs.obs_data_get_string( settings, "p_v_d_source" )
p_v_e_source = obs.obs_data_get_string( settings, "p_v_e_source" )
p_s_a_source = obs.obs_data_get_string( settings, "p_s_a_source" )
p_s_b_source = obs.obs_data_get_string( settings, "p_s_b_source" )
p_s_c_source = obs.obs_data_get_string( settings, "p_s_c_source" )
p_s_d_source = obs.obs_data_get_string( settings, "p_s_d_source" )
p_s_e_source = obs.obs_data_get_string( settings, "p_s_e_source" )
text_sources["p_h_a_source"] = p_h_a_source
text_sources["p_h_b_source"] = p_h_b_source
text_sources["p_h_c_source"] = p_h_c_source
text_sources["p_h_d_source"] = p_h_d_source
text_sources["p_h_e_source"] = p_h_e_source
text_sources["p_v_a_source"] = p_v_a_source
text_sources["p_v_b_source"] = p_v_b_source
text_sources["p_v_c_source"] = p_v_c_source
text_sources["p_v_d_source"] = p_v_d_source
text_sources["p_v_e_source"] = p_v_e_source
text_sources["p_s_a_source"] = p_s_a_source
text_sources["p_s_b_source"] = p_s_b_source
text_sources["p_s_c_source"] = p_s_c_source
text_sources["p_s_d_source"] = p_s_d_source
text_sources["p_s_e_source"] = p_s_e_source
-- Retrieves property reference
local p_h_a_prop = obs.obs_properties_get( props, "p_h_a_source" )
local p_h_b_prop = obs.obs_properties_get( props, "p_h_b_source" )
local p_h_c_prop = obs.obs_properties_get( props, "p_h_c_source" )
local p_h_d_prop = obs.obs_properties_get( props, "p_h_d_source" )
local p_h_e_prop = obs.obs_properties_get( props, "p_h_e_source" )
local p_v_a_prop = obs.obs_properties_get( props, "p_v_a_source" )
local p_v_b_prop = obs.obs_properties_get( props, "p_v_b_source" )
local p_v_c_prop = obs.obs_properties_get( props, "p_v_c_source" )
local p_v_d_prop = obs.obs_properties_get( props, "p_v_d_source" )
local p_v_e_prop = obs.obs_properties_get( props, "p_v_e_source" )
local p_s_a_prop = obs.obs_properties_get( props, "p_s_a_source" )
local p_s_b_prop = obs.obs_properties_get( props, "p_s_b_source" )
local p_s_c_prop = obs.obs_properties_get( props, "p_s_c_source" )
local p_s_d_prop = obs.obs_properties_get( props, "p_s_d_source" )
local p_s_e_prop = obs.obs_properties_get( props, "p_s_e_source" )
local p_h_a_int_prop = obs.obs_properties_get( props, "p_h_a_int")
local p_h_b_int_prop = obs.obs_properties_get( props, "p_h_b_int")
local p_h_c_int_prop = obs.obs_properties_get( props, "p_h_c_int")
local p_h_d_int_prop = obs.obs_properties_get( props, "p_h_d_int")
local p_h_e_int_prop = obs.obs_properties_get( props, "p_h_e_int")
local p_v_a_int_prop = obs.obs_properties_get( props, "p_v_a_int")
local p_v_b_int_prop = obs.obs_properties_get( props, "p_v_b_int")
local p_v_c_int_prop = obs.obs_properties_get( props, "p_v_c_int")
local p_v_d_int_prop = obs.obs_properties_get( props, "p_v_d_int")
local p_v_e_int_prop = obs.obs_properties_get( props, "p_v_e_int")
local p_s_a_int_prop = obs.obs_properties_get( props, "p_s_a_int")
local p_s_b_int_prop = obs.obs_properties_get( props, "p_s_b_int")
local p_s_c_int_prop = obs.obs_properties_get( props, "p_s_c_int")
local p_s_d_int_prop = obs.obs_properties_get( props, "p_s_d_int")
local p_s_e_int_prop = obs.obs_properties_get( props, "p_s_e_int")
local p_h_a_s = ( p_h_a_source ~= "select" and p_h_a_source ~= "" )
local p_h_b_s = ( p_h_b_source ~= "select" and p_h_b_source ~= "" )
local p_h_c_s = ( p_h_c_source ~= "select" and p_h_c_source ~= "" )
local p_h_d_s = ( p_h_d_source ~= "select" and p_h_d_source ~= "" )
local p_h_e_s = ( p_h_e_source ~= "select" and p_h_e_source ~= "" )
local p_v_a_s = ( p_v_a_source ~= "select" and p_v_a_source ~= "" )
local p_v_b_s = ( p_v_b_source ~= "select" and p_v_b_source ~= "" )
local p_v_c_s = ( p_v_c_source ~= "select" and p_v_c_source ~= "" )
local p_v_d_s = ( p_v_d_source ~= "select" and p_v_d_source ~= "" )
local p_v_e_s = ( p_v_e_source ~= "select" and p_v_e_source ~= "" )
local p_s_a_s = ( p_s_a_source ~= "select" and p_s_a_source ~= "" )
local p_s_b_s = ( p_s_b_source ~= "select" and p_s_b_source ~= "" )
local p_s_c_s = ( p_s_c_source ~= "select" and p_s_c_source ~= "" )
local p_s_d_s = ( p_s_d_source ~= "select" and p_s_d_source ~= "" )
local p_s_e_s = ( p_s_e_source ~= "select" and p_s_e_source ~= "" )
obs.obs_property_set_visible( p_h_b_prop, ( p_h_a_s ))
obs.obs_property_set_visible( p_h_c_prop, ( p_h_a_s and p_h_b_s ))
obs.obs_property_set_visible( p_h_d_prop, ( p_h_a_s and p_h_b_s and p_h_c_s ))
obs.obs_property_set_visible( p_h_e_prop, ( p_h_a_s and p_h_b_s and p_h_c_s and p_h_d_s ))
obs.obs_property_set_visible( p_v_b_prop, ( p_v_a_s ))
obs.obs_property_set_visible( p_v_c_prop, ( p_v_a_s and p_v_b_s ))
obs.obs_property_set_visible( p_v_d_prop, ( p_v_a_s and p_v_b_s and p_v_c_s ))
obs.obs_property_set_visible( p_v_e_prop, ( p_v_a_s and p_v_b_s and p_v_c_s and p_v_d_s ))
obs.obs_property_set_visible( p_s_b_prop, ( p_s_a_s ))
obs.obs_property_set_visible( p_s_c_prop, ( p_s_a_s and p_s_b_s ))
obs.obs_property_set_visible( p_s_d_prop, ( p_s_a_s and p_s_b_s and p_s_c_s ))
obs.obs_property_set_visible( p_s_e_prop, ( p_s_a_s and p_s_b_s and p_s_c_s and p_s_d_s ))
obs.obs_property_set_visible( p_h_b_int_prop, ( p_h_a_s ))
obs.obs_property_set_visible( p_h_c_int_prop, ( p_h_a_s and p_h_b_s ))
obs.obs_property_set_visible( p_h_d_int_prop, ( p_h_a_s and p_h_b_s and p_h_c_s ))
obs.obs_property_set_visible( p_h_e_int_prop, ( p_h_a_s and p_h_b_s and p_h_c_s and p_h_d_s ))
obs.obs_property_set_visible( p_v_b_int_prop, ( p_v_a_s ))
obs.obs_property_set_visible( p_v_c_int_prop, ( p_v_a_s and p_v_b_s ))
obs.obs_property_set_visible( p_v_d_int_prop, ( p_v_a_s and p_v_b_s and p_v_c_s ))
obs.obs_property_set_visible( p_v_e_int_prop, ( p_v_a_s and p_v_b_s and p_v_c_s and p_v_d_s ))
obs.obs_property_set_visible( p_s_b_int_prop, ( p_s_a_s ))
obs.obs_property_set_visible( p_s_c_int_prop, ( p_s_a_s and p_s_b_s ))
obs.obs_property_set_visible( p_s_d_int_prop, ( p_s_a_s and p_s_b_s and p_s_c_s ))
obs.obs_property_set_visible( p_s_e_int_prop, ( p_s_a_s and p_s_b_s and p_s_c_s and p_s_d_s ))
-- Prevent sources being used in more than one item
for key, value in pairs ( text_sources ) do
if value ~= "" and value ~= "select" and key ~= prop_name then
temp_table[key] = value
end
end
if in_table( temp_table, prop_val ) then
obs.obs_data_set_string( settings, prop_name, 'select' ) -- Don't allow timer and caution note text source to be the same
end
-- IMPORTANT: returns true to trigger refresh of the properties
return true
end
--[[
----------------------------------------------------------
A function named script_properties defines the properties that the user
can change for the entire script module itself
----------------------------------------------------------
]]
function script_properties()
local temp_table = text_sources
local props = obs.obs_properties_create()
local group_props_h = obs.obs_properties_create()
local group_props_v = obs.obs_properties_create()
local group_props_s = obs.obs_properties_create()
local sources = obs.obs_enum_sources()
obs.obs_properties_add_group( props, "_group_h", "Home", obs.OBS_GROUP_NORMAL, group_props_h )
obs.obs_properties_add_group(props, "_group_v", "Visitors", obs.OBS_GROUP_NORMAL, group_props_v)
obs.obs_properties_add_group(props, "_group_s", "Summary", obs.OBS_GROUP_NORMAL, group_props_s)
--[[
----------------------------------------------------------
Home Score Item 1
----------------------------------------------------------
]]
local p_h_a = obs.obs_properties_add_list( group_props_h, "p_h_a_source", "<font color=".. font_1 .."><i>1</i></font>", obs.OBS_COMBO_TYPE_LIST, obs.OBS_COMBO_FORMAT_STRING )
obs.obs_property_set_long_description( p_h_a, "\nSelect a text source, that will be used.\n" )
obs.obs_property_list_add_string( p_h_a, "Select", "select" )
list = {}
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 )
list[name] = name
end
end
obs.bfree(source)
for key, value in pairsByKeys(list) do
--[[
add item to property list
]]
obs.obs_property_list_add_string( p_h_a, value, value )
end
end
--[[
----------------------------------------------------------
Home Score Item 2
----------------------------------------------------------
]]
local p_h_b = obs.obs_properties_add_list( group_props_h, "p_h_b_source", "<font color=".. font_2 .."><i>2</i></font>", obs.OBS_COMBO_TYPE_LIST, obs.OBS_COMBO_FORMAT_STRING )
obs.obs_property_set_long_description( p_h_b, "\nSelect a text source, that will be used.\n" )
obs.obs_property_list_add_string( p_h_b, "Select", "select" )
list = {}
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 )
list[name] = name
end
end
obs.bfree(source)
for key, value in pairsByKeys(list) do
--[[
add item to property list
]]
obs.obs_property_list_add_string( p_h_b, value, value )
end
end
--[[
----------------------------------------------------------
Home Score Item 3
----------------------------------------------------------
]]
local p_h_c = obs.obs_properties_add_list( group_props_h, "p_h_c_source", "<font color=".. font_3 .."><i>3</i></font>", obs.OBS_COMBO_TYPE_LIST, obs.OBS_COMBO_FORMAT_STRING )
obs.obs_property_set_long_description( p_h_c, "\nSelect a text source, that will be used.\n" )
obs.obs_property_list_add_string( p_h_c, "Select", "select" )
list = {}
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 )
list[name] = name
end
end
obs.bfree(source)
for key, value in pairsByKeys(list) do
--[[
add item to property list
]]
obs.obs_property_list_add_string( p_h_c, value, value )
end
end
--[[
----------------------------------------------------------
Home Score Item 4
----------------------------------------------------------
]]
local p_h_d = obs.obs_properties_add_list( group_props_h, "p_h_d_source", "<font color=".. font_4 .."><i>4</i></font>", obs.OBS_COMBO_TYPE_LIST, obs.OBS_COMBO_FORMAT_STRING )
obs.obs_property_set_long_description( p_h_d, "\nSelect a text source, that will be used.\n" )
obs.obs_property_list_add_string( p_h_d, "Select", "select" )
list = {}
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 )
list[name] = name
end
end
obs.bfree(source)
for key, value in pairsByKeys(list) do
--[[
add item to property list
]]
obs.obs_property_list_add_string( p_h_d, value, value )
end
end
--[[
----------------------------------------------------------
Home Score Item 5
----------------------------------------------------------
]]
local p_h_e = obs.obs_properties_add_list( group_props_h, "p_h_e_source", "<font color=".. font_5 .."><i>5</i></font>", obs.OBS_COMBO_TYPE_LIST, obs.OBS_COMBO_FORMAT_STRING )
obs.obs_property_set_long_description( p_h_e, "\nSelect a text source, that will be used.\n" )
obs.obs_property_list_add_string( p_h_e, "Select", "select" )
list = {}
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 )
list[name] = name
end
end
obs.bfree(source)
for key, value in pairsByKeys(list) do
--[[
add item to property list
]]
obs.obs_property_list_add_string( p_h_e, value, value )
end
end
--[[
----------------------------------------------------------
Visitor Score Item 1
----------------------------------------------------------
]]
local p_v_a = obs.obs_properties_add_list( group_props_v, "p_v_a_source", "<font color=".. font_1 .."><i>1</i></font>", obs.OBS_COMBO_TYPE_LIST, obs.OBS_COMBO_FORMAT_STRING )
obs.obs_property_set_long_description( p_v_a, "\nSelect a text source, that will be used.\n" )
obs.obs_property_list_add_string( p_v_a, "Select", "select" )
list = {}
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 )
list[name] = name
end
end
obs.bfree(source)
for key, value in pairsByKeys(list) do
--[[
add item to property list
]]
obs.obs_property_list_add_string( p_v_a, value, value )
end
end
--[[
----------------------------------------------------------
Visitor Score Item 2
----------------------------------------------------------
]]
local p_v_b = obs.obs_properties_add_list( group_props_v, "p_v_b_source", "<font color=".. font_2 .."><i>2</i></font>", obs.OBS_COMBO_TYPE_LIST, obs.OBS_COMBO_FORMAT_STRING )
obs.obs_property_set_long_description( p_v_b, "\nSelect a text source, that will be used.\n" )
obs.obs_property_list_add_string( p_v_b, "Select", "select" )
list = {}
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 )
list[name] = name
end
end
obs.bfree(source)
for key, value in pairsByKeys(list) do
--[[
add item to property list
]]
obs.obs_property_list_add_string( p_v_b, value, value )
end
end
--[[
----------------------------------------------------------
Visitor Score Item 3
----------------------------------------------------------
]]
local p_v_c = obs.obs_properties_add_list( group_props_v, "p_v_c_source", "<font color=".. font_3 .."><i>3</i></font>", obs.OBS_COMBO_TYPE_LIST, obs.OBS_COMBO_FORMAT_STRING )
obs.obs_property_set_long_description( p_v_c, "\nSelect a text source, that will be used.\n" )
obs.obs_property_list_add_string( p_v_c, "Select", "select" )
list = {}
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 )
list[name] = name
end
end
obs.bfree(source)
for key, value in pairsByKeys(list) do
--[[
add item to property list
]]
obs.obs_property_list_add_string( p_v_c, value, value )
end
end
--[[
----------------------------------------------------------
Visitor Score Item 4
----------------------------------------------------------
]]
local p_v_d = obs.obs_properties_add_list( group_props_v, "p_v_d_source", "<font color=".. font_4 .."><i>4</i></font>", obs.OBS_COMBO_TYPE_LIST, obs.OBS_COMBO_FORMAT_STRING )
obs.obs_property_set_long_description( p_v_d, "\nSelect a text source, that will be used.\n" )
obs.obs_property_list_add_string( p_v_d, "Select", "select" )
list = {}
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 )
list[name] = name
end
end
obs.bfree(source)
for key, value in pairsByKeys(list) do
--[[
add item to property list
]]
obs.obs_property_list_add_string( p_v_d, value, value )
end
end
--[[
----------------------------------------------------------
Visitor Score Item 5
----------------------------------------------------------
]]
local p_v_e = obs.obs_properties_add_list( group_props_v, "p_v_e_source", "<font color=".. font_4 .."><i>5</i></font>", obs.OBS_COMBO_TYPE_LIST, obs.OBS_COMBO_FORMAT_STRING )
obs.obs_property_set_long_description( p_v_e, "\nSelect a text source, that will be used.\n" )
obs.obs_property_list_add_string( p_v_e, "Select", "select" )
list = {}
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 )
list[name] = name
end
end
obs.bfree(source)
for key, value in pairsByKeys(list) do
--[[
add item to property list
]]
obs.obs_property_list_add_string( p_v_e, value, value )
end
end
--[[
----------------------------------------------------------
Summary Score Item 1
----------------------------------------------------------
]]
local p_s_a = obs.obs_properties_add_list( group_props_s, "p_s_a_source", "<font color=".. font_1 .."><i>1</i></font>", obs.OBS_COMBO_TYPE_LIST, obs.OBS_COMBO_FORMAT_STRING )
obs.obs_property_set_long_description( p_s_a, "\nSelect a text source, that will be used.\n" )
obs.obs_property_list_add_string( p_s_a, "Select", "select" )
list = {}
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 )
list[name] = name
end
end
obs.bfree(source)
for key, value in pairsByKeys(list) do
--[[
add item to property list
]]
obs.obs_property_list_add_string( p_s_a, value, value )
end
end
--[[
----------------------------------------------------------
Summary Score Item 2
----------------------------------------------------------
]]
local p_s_b = obs.obs_properties_add_list( group_props_s, "p_s_b_source", "<font color=".. font_2 .."><i>2</i></font>", obs.OBS_COMBO_TYPE_LIST, obs.OBS_COMBO_FORMAT_STRING )
obs.obs_property_set_long_description( p_s_b, "\nSelect a text source, that will be used.\n" )
obs.obs_property_list_add_string( p_s_b, "Select", "select" )
list = {}
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 )
list[name] = name
end
end
obs.bfree(source)
for key, value in pairsByKeys(list) do
--[[
add item to property list
]]
obs.obs_property_list_add_string( p_s_b, value, value )
end
end
--[[
----------------------------------------------------------
Summary Score Item 3
----------------------------------------------------------
]]
local p_s_c = obs.obs_properties_add_list( group_props_s, "p_s_c_source", "<font color=".. font_3 .."><i>3</i></font>", obs.OBS_COMBO_TYPE_LIST, obs.OBS_COMBO_FORMAT_STRING )
obs.obs_property_set_long_description( p_s_c, "\nSelect a text source, that will be used.\n" )
obs.obs_property_list_add_string( p_s_c, "Select", "select" )
list = {}
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 )
list[name] = name
end
end
obs.bfree(source)
for key, value in pairsByKeys(list) do
--[[
add item to property list
]]
obs.obs_property_list_add_string( p_s_c, value, value )
end
end
--[[
----------------------------------------------------------
Summary Score Item 4
----------------------------------------------------------
]]
local p_s_d = obs.obs_properties_add_list( group_props_s, "p_s_d_source", "<font color=".. font_4 .."><i>4</i></font>", obs.OBS_COMBO_TYPE_LIST, obs.OBS_COMBO_FORMAT_STRING )
obs.obs_property_set_long_description( p_s_d, "\nSelect a text source, that will be used.\n" )
obs.obs_property_list_add_string( p_s_d, "Select", "select" )
list = {}
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 )
list[name] = name
end
end
obs.bfree(source)
for key, value in pairsByKeys(list) do
--[[
add item to property list
]]
obs.obs_property_list_add_string( p_s_d, value, value )
end
end
--[[
----------------------------------------------------------
Summary Score Item 5
----------------------------------------------------------
]]
local p_s_e = obs.obs_properties_add_list( group_props_s, "p_s_e_source", "<font color=".. font_4 .."><i>5</i></font>", obs.OBS_COMBO_TYPE_LIST, obs.OBS_COMBO_FORMAT_STRING )
obs.obs_property_set_long_description( p_s_e, "\nSelect a text source, that will be used.\n" )
obs.obs_property_list_add_string( p_s_e, "Select", "select" )
list = {}
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 )
list[name] = name
end
end
obs.bfree(source)
for key, value in pairsByKeys(list) do
--[[
add item to property list
]]
obs.obs_property_list_add_string( p_s_e, value, value )
end
end
obs.obs_properties_add_int_slider( group_props_h, "p_h_a_int", "1", 1, 100, 1 )
obs.obs_properties_add_int_slider( group_props_h, "p_h_b_int", "2", 1, 100, 1 )
obs.obs_properties_add_int_slider( group_props_h, "p_h_c_int", "3", 1, 100, 1 )
obs.obs_properties_add_int_slider( group_props_h, "p_h_d_int", "4", 1, 100, 1 )
obs.obs_properties_add_int_slider( group_props_h, "p_h_e_int", "5", 1, 100, 1 )
obs.obs_properties_add_int_slider( group_props_v, "p_v_a_int", "1", 1, 100, 1 )
obs.obs_properties_add_int_slider( group_props_v, "p_v_b_int", "2", 1, 100, 1 )
obs.obs_properties_add_int_slider( group_props_v, "p_v_c_int", "3", 1, 100, 1 )
obs.obs_properties_add_int_slider( group_props_v, "p_v_d_int", "4", 1, 100, 1 )
obs.obs_properties_add_int_slider( group_props_v, "p_v_e_int", "5", 1, 100, 1 )
obs.obs_properties_add_int_slider( group_props_s, "p_s_a_int", "1", 1, 100, 1 )
obs.obs_properties_add_int_slider( group_props_s, "p_s_b_int", "2", 1, 100, 1 )
obs.obs_properties_add_int_slider( group_props_s, "p_s_c_int", "3", 1, 100, 1 )
obs.obs_properties_add_int_slider( group_props_s, "p_s_d_int", "4", 1, 100, 1 )
obs.obs_properties_add_int_slider( group_props_s, "p_s_e_int", "5", 1, 100, 1 )
obs.source_list_release( sources )
obs.obs_properties_add_button( props, "reset_button", "Reset Scoreboard", reset_button_clicked )
obs.obs_properties_add_bool( props, "source_name_hotkey", "Source Name Hotkey" )
--Sets callback upon modification of the list Basically an Event Listener
obs.obs_property_set_modified_callback( p_h_a, property_onchange )
obs.obs_property_set_modified_callback( p_h_b, property_onchange )
obs.obs_property_set_modified_callback( p_h_c, property_onchange )
obs.obs_property_set_modified_callback( p_h_d, property_onchange )
obs.obs_property_set_modified_callback( p_h_e, property_onchange )
obs.obs_property_set_modified_callback( p_v_a, property_onchange )
obs.obs_property_set_modified_callback( p_v_b, property_onchange )
obs.obs_property_set_modified_callback( p_v_c, property_onchange )
obs.obs_property_set_modified_callback( p_v_d, property_onchange )
obs.obs_property_set_modified_callback( p_v_e, property_onchange )
obs.obs_property_set_modified_callback( p_s_a, property_onchange )
obs.obs_property_set_modified_callback( p_s_b, property_onchange )
obs.obs_property_set_modified_callback( p_s_c, property_onchange )
obs.obs_property_set_modified_callback( p_s_d, property_onchange )
obs.obs_property_set_modified_callback( p_s_e, property_onchange )
-- Calls the callback once to set-up current visibility
obs.obs_properties_apply_settings( props, script_settings )
script_props = props
return props
end
--[[
----------------------------------------------------------
A function named script_update will be called when settings are changed
----------------------------------------------------------
]]
-- Called upon settings initialization and modification
function script_update( settings )
p_h_a_source = obs.obs_data_get_string( settings, "p_h_a_source" )
p_h_b_source = obs.obs_data_get_string( settings, "p_h_b_source" )
p_h_c_source = obs.obs_data_get_string( settings, "p_h_c_source" )
p_h_d_source = obs.obs_data_get_string( settings, "p_h_d_source" )
p_h_e_source = obs.obs_data_get_string( settings, "p_h_e_source" )
p_v_a_source = obs.obs_data_get_string( settings, "p_v_a_source" )
p_v_b_source = obs.obs_data_get_string( settings, "p_v_b_source" )
p_v_c_source = obs.obs_data_get_string( settings, "p_v_c_source" )
p_v_d_source = obs.obs_data_get_string( settings, "p_v_d_source" )
p_v_e_source = obs.obs_data_get_string( settings, "p_v_e_source" )
p_s_a_source = obs.obs_data_get_string( settings, "p_s_a_source" )
p_s_b_source = obs.obs_data_get_string( settings, "p_s_b_source" )
p_s_c_source = obs.obs_data_get_string( settings, "p_s_c_source" )
p_s_d_source = obs.obs_data_get_string( settings, "p_s_d_source" )
p_s_e_source = obs.obs_data_get_string( settings, "p_s_e_source" )
p_h_a_int = obs.obs_data_get_int( settings, "p_h_a_int" )
p_h_b_int = obs.obs_data_get_int( settings, "p_h_b_int" )
p_h_c_int = obs.obs_data_get_int( settings, "p_h_c_int" )
p_h_d_int = obs.obs_data_get_int( settings, "p_h_d_int" )
p_h_e_int = obs.obs_data_get_int( settings, "p_h_e_int" )
p_v_a_int = obs.obs_data_get_int( settings, "p_v_a_int" )
p_v_b_int = obs.obs_data_get_int( settings, "p_v_b_int" )
p_v_c_int = obs.obs_data_get_int( settings, "p_v_c_int" )
p_v_d_int = obs.obs_data_get_int( settings, "p_v_d_int" )
p_v_e_int = obs.obs_data_get_int( settings, "p_v_e_int" )
p_s_a_int = obs.obs_data_get_int( settings, "p_s_a_int" )
p_s_b_int = obs.obs_data_get_int( settings, "p_s_b_int" )
p_s_c_int = obs.obs_data_get_int( settings, "p_s_c_int" )
p_s_d_int = obs.obs_data_get_int( settings, "p_s_d_int" )
p_s_e_int = obs.obs_data_get_int( settings, "p_s_e_int" )
set_text( p_h_a_source, p_h_a_value )
set_text( p_h_b_source, p_h_b_value )
set_text( p_h_c_source, p_h_c_value )
set_text( p_h_d_source, p_h_d_value )
set_text( p_h_e_source, p_h_e_value )
set_text( p_v_a_source, p_v_a_value )
set_text( p_v_b_source, p_v_b_value )
set_text( p_v_c_source, p_v_c_value )
set_text( p_v_d_source, p_v_d_value )
set_text( p_v_e_source, p_v_e_value )
set_text( p_s_a_source, p_s_a_value )
set_text( p_s_b_source, p_s_b_value )
set_text( p_s_c_source, p_s_c_value )
set_text( p_s_d_source, p_s_d_value )
set_text( p_s_e_source, p_s_e_value )
source_name_hotkey = obs.obs_data_get_bool( settings, "source_name_hotkey" )
-- Keep track of current settings
script_settings = settings
end
--[[
----------------------------------------------------------
A function named script_defaults will be called to set the default settings
----------------------------------------------------------
]]
function script_defaults( settings )
obs.obs_data_set_default_string( settings, "p_h_a_source", "Select")
obs.obs_data_set_default_string( settings, "p_h_b_source", "Select")
obs.obs_data_set_default_string( settings, "p_h_c_source", "Select")
obs.obs_data_set_default_string( settings, "p_h_d_source", "Select")
obs.obs_data_set_default_string( settings, "p_h_e_source", "Select")
obs.obs_data_set_default_string( settings, "p_v_a_source", "Select")
obs.obs_data_set_default_string( settings, "p_v_b_source", "Select")
obs.obs_data_set_default_string( settings, "p_v_c_source", "Select")
obs.obs_data_set_default_string( settings, "p_v_d_source", "Select")
obs.obs_data_set_default_string( settings, "p_v_e_source", "Select")
obs.obs_data_set_default_string( settings, "p_s_a_source", "Select")
obs.obs_data_set_default_string( settings, "p_s_b_source", "Select")
obs.obs_data_set_default_string( settings, "p_s_c_source", "Select")
obs.obs_data_set_default_string( settings, "p_s_d_source", "Select")
obs.obs_data_set_default_string( settings, "p_s_e_source", "Select")
obs.obs_data_set_default_int( settings, "p_h_a_int", 1 )
obs.obs_data_set_default_int( settings, "p_h_b_int", 1 )
obs.obs_data_set_default_int( settings, "p_h_c_int", 1 )
obs.obs_data_set_default_int( settings, "p_h_d_int", 1 )
obs.obs_data_set_default_int( settings, "p_h_e_int", 1 )
obs.obs_data_set_default_int( settings, "p_v_a_int", 1 )
obs.obs_data_set_default_int( settings, "p_v_b_int", 1 )
obs.obs_data_set_default_int( settings, "p_v_c_int", 1 )
obs.obs_data_set_default_int( settings, "p_v_d_int", 1 )
obs.obs_data_set_default_int( settings, "p_v_e_int", 1 )
obs.obs_data_set_default_int( settings, "p_s_a_int", 1 )
obs.obs_data_set_default_int( settings, "p_s_b_int", 1 )
obs.obs_data_set_default_int( settings, "p_s_c_int", 1 )
obs.obs_data_set_default_int( settings, "p_s_d_int", 1 )
obs.obs_data_set_default_int( settings, "p_s_e_int", 1 )
obs.obs_data_set_default_bool( settings, "source_name_hotkey", true )
end
--[[
----------------------------------------------------------
A function named script_save will be called when the script is saved
NOTE: This function is usually used for saving extra data ( such as in this
case, a hotkey's save data ). Settings set via the properties are saved
automatically.
----------------------------------------------------------
]]
function script_save( settings )
local reset_scoreboard_hotkey_save_array = obs.obs_hotkey_save( reset_scoreboard_hotkey_id )
obs.obs_data_set_array( settings, "reset_scoreboard_hotkey", reset_scoreboard_hotkey_save_array )
obs.obs_data_array_release( reset_scoreboard_hotkey_save_array )
local p_h_a_1_hotkey_save_array = obs.obs_hotkey_save( p_h_a_1_hotkey_id )
local p_h_b_1_hotkey_save_array = obs.obs_hotkey_save( p_h_b_1_hotkey_id )
local p_h_c_1_hotkey_save_array = obs.obs_hotkey_save( p_h_c_1_hotkey_id )
local p_h_d_1_hotkey_save_array = obs.obs_hotkey_save( p_h_d_1_hotkey_id )
local p_h_e_1_hotkey_save_array = obs.obs_hotkey_save( p_h_e_1_hotkey_id )
local p_v_a_1_hotkey_save_array = obs.obs_hotkey_save( p_v_a_1_hotkey_id )
local p_v_b_1_hotkey_save_array = obs.obs_hotkey_save( p_v_b_1_hotkey_id )
local p_v_c_1_hotkey_save_array = obs.obs_hotkey_save( p_v_c_1_hotkey_id )
local p_v_d_1_hotkey_save_array = obs.obs_hotkey_save( p_v_d_1_hotkey_id )
local p_v_e_1_hotkey_save_array = obs.obs_hotkey_save( p_v_e_1_hotkey_id )
local p_s_a_1_hotkey_save_array = obs.obs_hotkey_save( p_s_a_1_hotkey_id )
local p_s_b_1_hotkey_save_array = obs.obs_hotkey_save( p_s_b_1_hotkey_id )
local p_s_c_1_hotkey_save_array = obs.obs_hotkey_save( p_s_c_1_hotkey_id )
local p_s_d_1_hotkey_save_array = obs.obs_hotkey_save( p_s_d_1_hotkey_id )
local p_s_e_1_hotkey_save_array = obs.obs_hotkey_save( p_s_e_1_hotkey_id )
local p_h_a_0_hotkey_save_array = obs.obs_hotkey_save( p_h_a_0_hotkey_id )
local p_h_b_0_hotkey_save_array = obs.obs_hotkey_save( p_h_b_0_hotkey_id )
local p_h_c_0_hotkey_save_array = obs.obs_hotkey_save( p_h_c_0_hotkey_id )
local p_h_d_0_hotkey_save_array = obs.obs_hotkey_save( p_h_d_0_hotkey_id )
local p_h_e_0_hotkey_save_array = obs.obs_hotkey_save( p_h_e_0_hotkey_id )
local p_v_a_0_hotkey_save_array = obs.obs_hotkey_save( p_v_a_0_hotkey_id )
local p_v_b_0_hotkey_save_array = obs.obs_hotkey_save( p_v_b_0_hotkey_id )
local p_v_c_0_hotkey_save_array = obs.obs_hotkey_save( p_v_c_0_hotkey_id )
local p_v_d_0_hotkey_save_array = obs.obs_hotkey_save( p_v_d_0_hotkey_id )
local p_v_e_0_hotkey_save_array = obs.obs_hotkey_save( p_v_e_0_hotkey_id )
local p_s_a_0_hotkey_save_array = obs.obs_hotkey_save( p_s_a_0_hotkey_id )
local p_s_b_0_hotkey_save_array = obs.obs_hotkey_save( p_s_b_0_hotkey_id )
local p_s_c_0_hotkey_save_array = obs.obs_hotkey_save( p_s_c_0_hotkey_id )
local p_s_d_0_hotkey_save_array = obs.obs_hotkey_save( p_s_d_0_hotkey_id )
local p_s_e_0_hotkey_save_array = obs.obs_hotkey_save( p_s_e_0_hotkey_id )
obs.obs_data_set_array( settings, "p_h_a_1_hotkey", p_h_a_1_hotkey_save_array )
obs.obs_data_set_array( settings, "p_h_b_1_hotkey", p_h_b_1_hotkey_save_array )
obs.obs_data_set_array( settings, "p_h_c_1_hotkey", p_h_c_1_hotkey_save_array )
obs.obs_data_set_array( settings, "p_h_d_1_hotkey", p_h_d_1_hotkey_save_array )
obs.obs_data_set_array( settings, "p_h_e_1_hotkey", p_h_e_1_hotkey_save_array )
obs.obs_data_set_array( settings, "p_v_a_1_hotkey", p_v_a_1_hotkey_save_array )
obs.obs_data_set_array( settings, "p_v_b_1_hotkey", p_v_b_1_hotkey_save_array )
obs.obs_data_set_array( settings, "p_v_c_1_hotkey", p_v_c_1_hotkey_save_array )
obs.obs_data_set_array( settings, "p_v_d_1_hotkey", p_v_d_1_hotkey_save_array )
obs.obs_data_set_array( settings, "p_v_e_1_hotkey", p_v_e_1_hotkey_save_array )
obs.obs_data_set_array( settings, "p_s_a_1_hotkey", p_s_a_1_hotkey_save_array )
obs.obs_data_set_array( settings, "p_s_b_1_hotkey", p_s_b_1_hotkey_save_array )
obs.obs_data_set_array( settings, "p_s_c_1_hotkey", p_s_c_1_hotkey_save_array )
obs.obs_data_set_array( settings, "p_s_d_1_hotkey", p_s_d_1_hotkey_save_array )
obs.obs_data_set_array( settings, "p_s_e_1_hotkey", p_s_e_1_hotkey_save_array )
obs.obs_data_set_array( settings, "p_h_a_0_hotkey", p_h_a_0_hotkey_save_array )
obs.obs_data_set_array( settings, "p_h_b_0_hotkey", p_h_b_0_hotkey_save_array )
obs.obs_data_set_array( settings, "p_h_c_0_hotkey", p_h_c_0_hotkey_save_array )
obs.obs_data_set_array( settings, "p_h_d_0_hotkey", p_h_d_0_hotkey_save_array )
obs.obs_data_set_array( settings, "p_h_e_0_hotkey", p_h_e_0_hotkey_save_array )
obs.obs_data_set_array( settings, "p_v_a_0_hotkey", p_v_a_0_hotkey_save_array )
obs.obs_data_set_array( settings, "p_v_b_0_hotkey", p_v_b_0_hotkey_save_array )
obs.obs_data_set_array( settings, "p_v_c_0_hotkey", p_v_c_0_hotkey_save_array )
obs.obs_data_set_array( settings, "p_v_d_0_hotkey", p_v_d_0_hotkey_save_array )
obs.obs_data_set_array( settings, "p_v_e_0_hotkey", p_v_e_0_hotkey_save_array )
obs.obs_data_set_array( settings, "p_s_a_0_hotkey", p_s_a_0_hotkey_save_array )
obs.obs_data_set_array( settings, "p_s_b_0_hotkey", p_s_b_0_hotkey_save_array )
obs.obs_data_set_array( settings, "p_s_c_0_hotkey", p_s_c_0_hotkey_save_array )
obs.obs_data_set_array( settings, "p_s_d_0_hotkey", p_s_d_0_hotkey_save_array )
obs.obs_data_set_array( settings, "p_s_e_0_hotkey", p_s_e_0_hotkey_save_array )
obs.obs_data_array_release( p_h_a_1_hotkey_save_array )
obs.obs_data_array_release( p_h_b_1_hotkey_save_array )
obs.obs_data_array_release( p_h_c_1_hotkey_save_array )
obs.obs_data_array_release( p_h_d_1_hotkey_save_array )
obs.obs_data_array_release( p_h_e_1_hotkey_save_array )
obs.obs_data_array_release( p_v_a_1_hotkey_save_array )
obs.obs_data_array_release( p_v_b_1_hotkey_save_array )
obs.obs_data_array_release( p_v_c_1_hotkey_save_array )
obs.obs_data_array_release( p_v_d_1_hotkey_save_array )
obs.obs_data_array_release( p_v_e_1_hotkey_save_array )
obs.obs_data_array_release( p_s_a_1_hotkey_save_array )
obs.obs_data_array_release( p_s_b_1_hotkey_save_array )
obs.obs_data_array_release( p_s_c_1_hotkey_save_array )
obs.obs_data_array_release( p_s_d_1_hotkey_save_array )
obs.obs_data_array_release( p_s_e_1_hotkey_save_array )
obs.obs_data_array_release( p_h_a_0_hotkey_save_array )
obs.obs_data_array_release( p_h_b_0_hotkey_save_array )
obs.obs_data_array_release( p_h_c_0_hotkey_save_array )
obs.obs_data_array_release( p_h_d_0_hotkey_save_array )
obs.obs_data_array_release( p_h_e_0_hotkey_save_array )
obs.obs_data_array_release( p_v_a_0_hotkey_save_array )
obs.obs_data_array_release( p_v_b_0_hotkey_save_array )
obs.obs_data_array_release( p_v_c_0_hotkey_save_array )
obs.obs_data_array_release( p_v_d_0_hotkey_save_array )
obs.obs_data_array_release( p_v_e_0_hotkey_save_array )
obs.obs_data_array_release( p_s_a_0_hotkey_save_array )
obs.obs_data_array_release( p_s_b_0_hotkey_save_array )
obs.obs_data_array_release( p_s_c_0_hotkey_save_array )
obs.obs_data_array_release( p_s_d_0_hotkey_save_array )
obs.obs_data_array_release( p_s_e_0_hotkey_save_array )
end
--[[
----------------------------------------------------------
a function named script_load will be called on startup
Connect hotkey and activation/deactivation signal callbacks
--
NOTE: These particular script callbacks do not necessarily have to
be disconnected, as callbacks will automatically destroy themselves
if the script is unloaded. So there's no real need to manually
disconnect callbacks that are intended to last until the script is
unloaded.
----------------------------------------------------------
]]
function script_load( settings )