-
Notifications
You must be signed in to change notification settings - Fork 3
/
API.html
913 lines (821 loc) · 39.3 KB
/
API.html
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
<!-- Author: Mikord -->
<html>
<head>
<title>Mik's Scrolling Battle Text API</title>
<style type="text/css">
body { font-size: 10pt; font-family: verdana, arial, helvetica, sans-serif; }
a:link { color: #000060; text-decoration: none; }
a:visited { color: #000060; text-decoration: none; }
a:hover { text-decoration: underline; }
div.TOCTitle { font-weight: bold; font-size: 14pt; color: #004080; border-bottom: 1px solid #000060; }
div.TOC { margin: 2ex 1ex 2ex 2ex; }
div.TOCSection { margin: 1ex 1ex 2ex 2ex; }
div.SectionTitle { margin-top: 6ex; font-weight: bold; font-size: 14pt; color: #004080; border-bottom: 1px solid #000060; }
div.SectionDesc { margin-top: 1ex; margin-bottom: 2ex; }
div.SubsectionTitle { font-weight: bold; }
div.SubsectionBody { margin: 2ex 10ex 2ex 5ex; }
div.Syntax { background-color: #e0e0e0; padding-left: 1ex; }
td.ParameterName { font-size: 10pt; background-color: #e0e0e0; vertical-align: top; }
td.ParameterDesc { font-size: 10pt; background-color: #e0e0e0; text-align: left; }
</style>
</head>
<body>
<div>
This file contains a reference for all of MSBT's publicly accessible functions and structures.<br /><br />
<div class="TOCTitle"><a name="TOC"></a>Table of Contents:</div>
</div>
<div class="TOC">
<b>Mod State:</b>
<div class="TOCSection">
<a href="#MikSBT.IsModDisabled">MikSBT.IsModDisabled</a><br />
</div>
<b>Displaying Messages:</b>
<div class="TOCSection">
<a href="#DisplayOverview">Displaying Messages Overview</a><br />
<a href="#MikSBT.RegisterFont">MikSBT.RegisterFont</a><br />
<a href="#MikSBT.DisplayMessage">MikSBT.DisplayMessage</a><br />
<a href="#MikSBT.IterateFonts">MikSBT.IterateFonts</a><br />
<a href="#MikSBT.IterateScrollAreas">MikSBT.IterateScrollAreas</a><br />
<span style="color: red;">MikSBT.GetRegisteredFontList - REMOVED</span><br />
<span style="color: red;">MikSBT.GetScrollAreaList - REMOVED</span><br />
</div>
<b>Sounds:</b>
<div class="TOCSection">
<a href="#SoundsOverview">Sounds Overview</a><br />
<a href="#MikSBT.RegisterSound">MikSBT.RegisterSound</a><br />
<a href="#MikSBT.IterateSounds">MikSBT.IterateSounds</a><br />
</div>
<b>Custom Animation Styles:</b>
<div class="TOCSection">
<a href="#CustomAnimationStylesOverview">Custom Animation Styles Overview</a><br />
<a href="#MikSBT.RegisterAnimationStyle">MikSBT.RegisterAnimationStyle</a><br />
<a href="#MikSBT.RegisterStickyAnimationStyle">MikSBT.RegisterStickyAnimationStyle</a><br />
<a href="#InitDisplayEventCallback">InitDisplayEvent Callback</a><br />
<a href="#AnimationCallback">Animation Callback</a><br />
<a href="#DisplayEventTable">DisplayEvent Table</a><br />
</div>
</div>
<div class="SectionTitle"><a name="MikSBT.IsModDisabled"></a>MikSBT.IsModDisabled</div>
<a href="#TOC">Return to TOC</a><br /><br />
<div class="SectionDesc">
Returns a flag indicating if the mod is disabled.
</div>
<div class="SubsectionTitle">Syntax</div>
<div class="SubsectionBody">
<div class="Syntax"><i>isDisabled</i> = <b>MikSBT.IsModDisabled()</b></div>
</div>
<div class="SubsectionTitle">Parameters</div>
<div class="SubsectionBody">
None.
</div>
<div class="SubsectionTitle">Return Values</div>
<div class="SubsectionBody">
<table cellspacing="3">
<tr>
<td class="ParameterName" nowrap="nowrap"><i>isDisabled</i></td>
<td class="ParameterDesc">
A flag that indicates if the mod is disabled. The return value will be one of the following:<br /><br />
<ul>
<li>true - The mod is disabled.</li>
<li>nil - The mod is enabled.</li>
</ul>
</td>
</tr>
</table>
</div>
<div class="SubsectionTitle">Example</div>
<div class="SubsectionBody">
<div class="Syntax">
-- Do something special if MSBT is disabled.<br />
if MikSBT.IsModDisabled() then<br />
-- Do something special here.<br />
end
</div>
</div>
<div class="SubsectionTitle">Remarks</div>
<div class="SubsectionBody">
None.
</div>
<div class="SectionTitle"><a name="DisplayOverview"></a>Displaying Messages Overview</div>
<a href="#TOC">Return to TOC</a><br /><br />
<div class="SectionDesc">
MSBT allows you to output messages via the <a href="#MikSBT.DisplayMessage">MikSBT.DisplayMessage</a> function.
You can either output the messages using one of the existing fonts, which can be obtained with the <a href="#MikSBT.IterateFonts">MikSBT.IterateFonts</a> function, or first use the
<a href="#MikSBT.RegisterFont">MikSBT.RegisterFont</a> function to use your own custom font.<br /><br />
Additionally, you may call the <a href="#MikSBT.IterateScrollAreas">MikSBT.IterateScrollAreas</a> function to get an iterator for the valid scroll areas in which the message
may be displayed.
</div>
<div class="SectionTitle"><a name="MikSBT.RegisterFont"></a>MikSBT.RegisterFont</div>
<a href="#TOC">Return to TOC</a><br /><br />
<div class="SectionDesc">
Registers a font with MSBT and Shared Media.<br /><br />
Font registration is not permanent. It must be done each load. In this manner if the user were to remove
a mod that registers custom fonts, the fonts would simply no longer be available. If anything in MSBT has a
custom font selected that is no longer registered, MSBT will recognize that an invalid font is specified and
use the default font accordingly.
</div>
<div class="SubsectionTitle">Syntax</div>
<div class="SubsectionBody">
<div class="Syntax"><b>MikSBT.RegisterFont(</b><i>fontName</i><b>,</b> <i>fontPath</i><b>)</b></div>
</div>
<div class="SubsectionTitle">Parameters</div>
<div class="SubsectionBody">
<table cellspacing="3">
<tr>
<td class="ParameterName" nowrap="nowrap"><i>fontName</i> (Required)</td>
<td class="ParameterDesc">
The name to use for the font. This name will be displayed in the font selection
dialogs, and also is the name to be referenced when displaying messages via the
<a href="#MikSBT.DisplayMessage">MikSBT.DisplayMessage</a> function.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>fontPath</i> (Required)</td>
<td class="ParameterDesc">The filesystem path to where the font resides.</td>
</tr>
</table>
</div>
<div class="SubsectionTitle">Return Values</div>
<div class="SubsectionBody">
None.
</div>
<div class="SubsectionTitle">Example</div>
<div class="SubsectionBody">
<div class="Syntax">
-- Registers a font named "MyUberFont" with MSBT.<br />
MikSBT.RegisterFont("MyUberFont", "Interface\\AddOns\\MyModName\\Fonts\\MyUberFont.ttf");
</div>
</div>
<div class="SubsectionTitle">Remarks</div>
<div class="SubsectionBody">
If you attempt to register a font name that already exists, the function will quietly fail.
</div>
<div class="SectionTitle"><a name="MikSBT.DisplayMessage"></a>MikSBT.DisplayMessage</div>
<a href="#TOC">Return to TOC</a><br /><br />
<div class="SectionDesc">Displays the passed message with the passed formatting options.</div>
<div class="SubsectionTitle">Syntax</div>
<div class="SubsectionBody">
<div class="Syntax"><b>MikSBT.DisplayMessage(</b><i>message</i> <b>[,</b> <i>scrollArea</i><b>,</b> <i>isSticky</i><b>,</b> <i>colorR</i><b>,</b> <i>colorG</i><b>,</b> <i>colorB</i><b>,</b> <i>fontSize</i><b>,</b> <i>fontName</i><b>,</b> <i>outlineIndex</i><b>,</b> <i>texturePath</i><b>])</b></div>
</div>
<div class="SubsectionTitle">Parameters</div>
<div class="SubsectionBody">
<table cellspacing="3">
<tr>
<td class="ParameterName" nowrap="nowrap"><i>message</i> (Required)</td>
<td class="ParameterDesc">The string to display.</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>scrollArea</i> (Optional)</td>
<td class="ParameterDesc">
Specifies the scroll area key or scroll area name in which to display the message.
<br /><br />
You can get an iterator for the available scroll areas with the
<a href="#MikSBT.IterateScrollAreas">MikSBT.IterateScrollAreas</a> function, or use one of the following predefined values:<br /><br />
MikSBT.DISPLAYTYPE_INCOMING<br />
MikSBT.DISPLAYTYPE_OUTGOING<br />
MikSBT.DISPLAYTYPE_NOTIFICATION<br />
MikSBT.DISPLAYTYPE_STATIC<br /><br />
If the parameter is omitted or invalid, a default of MikSBT.DISPLAYTYPE_NOTIFICATION will be used.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>isSticky</i> (Optional)</td>
<td class="ParameterDesc">
Specifies whether or not the message should be displayed sticky style. This must be either true or false.<br /><br />
If the parameter is omitted, a default of false will be used.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>colorR</i> (Optional)</td>
<td class="ParameterDesc">
The red component of the color to display the message with. Value range is 0-255.<br /><br />
If the parameter is omitted, a default of 255 will be used.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>colorG</i> (Optional)</td>
<td class="ParameterDesc">
The green component of the color to display the message with. Value range is 0-255.<br /><br />
If the parameter is omitted, a default of 255 will be used.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>colorB</i> (Optional)</td>
<td class="ParameterDesc">
The blue component of the color to display the message with. Value range is 0-255.<br /><br />
If the parameter is omitted, a default of 255 will be used.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>fontSize</i> (Optional)</td>
<td class="ParameterDesc">
The font size to use. Value range is 4-38.<br /><br />
If this value is omitted or an invalid value is passed, the settings for the scroll area will be used.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>fontName</i> (Optional)</td>
<td class="ParameterDesc">
The name of the font to use.
<br /><br />
You can get a list of available font names with the
<a href="#MikSBT.IterateFonts">MikSBT.IterateFonts</a> function.<br /><br />
If the parameter is omitted or an invalid font name is passed, the font for the scroll area will be used.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>outlineIndex</i> (Optional)</td>
<td class="ParameterDesc">
The index of the outline to use. The valid values are:
<ul>
<li>1 - No Outline</li>
<li>2 - Thin</li>
<li>3 - Thick</li>
<li>4 - Monochrome</li>
<li>5 - Monochrome + Thin</li>
<li>6 - Monochrome + Thick</li>
</ul>
If the parameter is omitted or an invalid index is passed, the outline index for the scroll area will be used.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>texturePath</i> (Optional)</td>
<td class="ParameterDesc">
The path to a texture file to display.<br /><br />
If the parameter is omitted or an invalid path is passed, no texture will be displayed.
</td>
</tr>
</table>
</div>
<div class="SubsectionTitle">Return Values</div>
<div class="SubsectionBody">None.</div>
<div class="SubsectionTitle">Examples</div>
<div class="SubsectionBody">
<div class="Syntax">
-- Displays "Test Message" in the notification scroll area in white.<br />
MikSBT.DisplayMessage("Test Message");<br /><br />
-- Displays "Another Message" in the incoming scroll area in white as a sticky.<br />
MikSBT.DisplayMessage("Another Message", MikSBT.DISPLAYTYPE_INCOMING, true);<br /><br />
-- Displays "Uber Damage!" in the outgoing scroll area in blue.<br />
MikSBT.DisplayMessage("Uber Damage!", MikSBT.DISPLAYTYPE_OUTGOING, false, 0, 0, 255);<br /><br />
-- Displays "Enemy begins to flee in fear" in the notification scroll area in green with the<br />
-- scroll area's font size, the font set to Yellowjacket, no outline, and the icon for fear.<br />
MikSBT.DisplayMessage("Enemy begins to flee in fear", nil, false, 0, 255, 0, nil, "MSBT Yellowjacket", 1, "Interface\\Icons\\Spell_Shadow_Possession");
</div>
</div>
<div class="SubsectionTitle">Remarks</div>
<div class="SubsectionBody">
Since this function specifies the font name to use, you can use custom fonts by first registering them via the
<a href="#MikSBT.RegisterFont">MikSBT.RegisterFont</a> function.
</div>
<div class="SectionTitle"><a name="MikSBT.IterateFonts"></a>MikSBT.IterateFonts</div>
<a href="#TOC">Return to TOC</a><br /><br />
<div class="SectionDesc">
Returns an iterator function for the table containing the registered fonts.
</div>
<div class="SubsectionTitle">Syntax</div>
<div class="SubsectionBody">
<div class="Syntax"><i>for fontName, fontPath in</i> <b>MikSBT.IterateFonts()</b> <i>do</i></div>
</div>
<div class="SubsectionTitle">Parameters</div>
<div class="SubsectionBody">None.</div>
<div class="SubsectionTitle">Return Values</div>
<div class="SubsectionBody">
<table cellspacing="3">
<tr>
<td class="ParameterName" nowrap="nowrap"><i>iterator</i></td>
<td class="ParameterDesc">
An iterator function for the table containing the registered fonts.<br /><br />
The format of the table is as follows:<br /><br />
["FontName1"] = "Font Path 1"<br />
["FontName2"] = "Font Path 2"<br />
</td>
</tr>
</table>
</div>
<div class="SubsectionTitle">Examples</div>
<div class="SubsectionBody">
<div class="Syntax">
-- Print the font names registered with MSBT.<br />
for fontName, fontPath in MikSBT.IterateFonts() do<br />
DEFAULT_CHAT_FRAME:AddMessage(fontName);<br />
end<br />
</div>
</div>
<div class="SubsectionTitle">Remarks</div>
<div class="SubsectionBody">
This function has superseded the <span style="color: red;">MikSBT.GetRegisteredFontList</span> function. The
old function created a new table and returned it every time it was called which was wasteful.
</div>
<div class="SectionTitle"><a name="MikSBT.IterateScrollAreas"></a>MikSBT.IterateScrollAreas</div>
<a href="#TOC">Return to TOC</a><br /><br />
<div class="SectionDesc">
Returns an iterator function for the table containing the available scroll areas.
</div>
<div class="SubsectionTitle">Syntax</div>
<div class="SubsectionBody">
<div class="Syntax"><i>for scrollAreaKey, scrollAreaName in</i> <b>MikSBT.IterateScrollAreas()</b> <i>do</i></div>
</div>
<div class="SubsectionTitle">Parameters</div>
<div class="SubsectionBody">None.</div>
<div class="SubsectionTitle">Return Values</div>
<div class="SubsectionBody">
<table cellspacing="3">
<tr>
<td class="ParameterName" nowrap="nowrap"><i>iterator</i></td>
<td class="ParameterDesc">
An iterator function for the table containing the available scroll areas.<br /><br />
The format of the table is as follows:<br /><br />
["FirstKey"] = "First Scroll Area Name"<br />
["SecondKey"] = "Second Scroll Area Name"<br />
</td>
</tr>
</table>
</div>
<div class="SubsectionTitle">Examples</div>
<div class="SubsectionBody">
<div class="Syntax">
-- Print MSBT's available scroll area names.<br />
for scrollAreaKey, scrollAreaName in MikSBT.IterateScrollAreas() do<br />
DEFAULT_CHAT_FRAME:AddMessage(scrollAreaName);<br />
end
</div>
</div>
<div class="SubsectionTitle">Remarks</div>
<div class="SubsectionBody">
This function has superseded the <span style="color: red;">MikSBT.GetScrollAreaList</span> function. The
old function created a new table and returned it every time it was called which was wasteful.
</div>
<div class="SectionTitle"><a name="SoundsOverview"></a>Sounds Overview</div>
<a href="#TOC">Return to TOC</a><br /><br />
<div class="SectionDesc">
MSBT allows you to register sounds which the user can assign to be played when events and triggers occur.<br /><br />
The <a href="#MikSBT.RegisterSound">MikSBT.RegisterSound</a> function is used to register the sounds, and the
registered sounds may be obtained by using the <a href="#MikSBT.IterateSounds">MikSBT.IterateSounds</a> function.
</div>
<div class="SectionTitle"><a name="MikSBT.RegisterSound"></a>MikSBT.RegisterSound</div>
<a href="#TOC">Return to TOC</a><br /><br />
<div class="SectionDesc">
Registers a sound with MSBT and Shared Media.<br /><br />
Sound registration is not permanent. It must be done each load. In this manner if the user were to remove
a mod that registers custom sounds, the sounds would simply no longer be available.
</div>
<div class="SubsectionTitle">Syntax</div>
<div class="SubsectionBody">
<div class="Syntax"><b>MikSBT.RegisterSound(</b><i>soundName</i><b>,</b> <i>soundPath</i><b>)</b></div>
</div>
<div class="SubsectionTitle">Parameters</div>
<div class="SubsectionBody">
<table cellspacing="3">
<tr>
<td class="ParameterName" nowrap="nowrap"><i>soundName</i> (Required)</td>
<td class="ParameterDesc">
The name to use for the sound. This name will be displayed in the sound selection
dialogs.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>soundPath</i> (Required)</td>
<td class="ParameterDesc">The filesystem path to where the sound resides.</td>
</tr>
</table>
</div>
<div class="SubsectionTitle">Return Values</div>
<div class="SubsectionBody">
None.
</div>
<div class="SubsectionTitle">Example</div>
<div class="SubsectionBody">
<div class="Syntax">
-- Registers an mp3 sound named "MyUberSound1" with MSBT.<br />
MikSBT.RegisterSound("MyUberSound1", "Interface\\AddOns\\MyModName\\Sounds\\MyUberSound1.mp3");<br /><br />
-- Registers an ogg sound named "MyUberSound2" with MSBT.<br />
MikSBT.RegisterSound("MyUberSound2", "Interface\\AddOns\\MyModName\\Sounds\\MyUberSound2.ogg");
</div>
</div>
<div class="SubsectionTitle">Remarks</div>
<div class="SubsectionBody">
If you attempt to register a sound name that already exists, the function will quietly fail.
</div>
<div class="SectionTitle"><a name="MikSBT.IterateSounds"></a>MikSBT.IterateSounds</div>
<a href="#TOC">Return to TOC</a><br /><br />
<div class="SectionDesc">
Returns an iterator function for the table containing the registered sounds.
</div>
<div class="SubsectionTitle">Syntax</div>
<div class="SubsectionBody">
<div class="Syntax"><i>for soundName, soundPath in</i> <b>MikSBT.IterateSounds()</b> <i>do</i></div>
</div>
<div class="SubsectionTitle">Parameters</div>
<div class="SubsectionBody">None.</div>
<div class="SubsectionTitle">Return Values</div>
<div class="SubsectionBody">
<table cellspacing="3">
<tr>
<td class="ParameterName" nowrap="nowrap"><i>iterator</i></td>
<td class="ParameterDesc">
An iterator function for the table containing the registered sounds.<br /><br />
The format of the table is as follows:<br /><br />
["SoundName1"] = "Sound Path 1"<br />
["SoundName2"] = "Sound Path 2"<br />
</td>
</tr>
</table>
</div>
<div class="SubsectionTitle">Examples</div>
<div class="SubsectionBody">
<div class="Syntax">
-- Print the sound names registered with MSBT.<br />
for soundName, soundPath in MikSBT.IterateSounds() do<br />
DEFAULT_CHAT_FRAME:AddMessage(soundName);<br />
end<br />
</div>
</div>
<div class="SubsectionTitle">Remarks</div>
<div class="SubsectionBody">None.</div>
<div class="SectionTitle"><a name="CustomAnimationStylesOverview"></a>Custom Animation Styles Overview</div>
<a href="#TOC">Return to TOC</a><br /><br />
<div class="SectionDesc">
MSBT has a custom animation style registration system that allows other mod authors to create new animation styles.
<br /><br />
The system works by allowing an initialization callback handler, directions, and behaviors for an animation style to be
registered with the <a href="#MikSBT.RegisterAnimationStyle">MikSBT.RegisterAnimationStyle</a> and
<a href="#MikSBT.RegisterStickyAnimationStyle">MikSBT.RegisterStickyAnimationStyle</a> functions. The supplied initialization
handler then sets the appropriate animation handler for each new <a href="#DisplayEventTable">DisplayEvent</a> it receives.
<br /><br />
The callback handlers receive recycled <a href="#DisplayEventTable">DisplayEvent</a> tables that contain information about an animating event
such as its x and y position, its alpha (opacity), the height of the scroll area it's animating in, and the animation completion percentage.
<br /><br />
There are two callback handlers:
<table cellspacing="3">
<tr>
<td class="ParameterName" nowrap="nowrap"><a href="#InitDisplayEventCallback">InitDisplayEvent</a></td>
<td class="ParameterDesc">
This function receives a new <a href="#DisplayEventTable">DisplayEvent</a> table, an array of <a href="#DisplayEventTable">DisplayEvent</a>s that are
currently active for the scroll area using the same animation style, and the currently selected direction and behavior for the scroll area.
<br /><br />
The most important thing for this function to do is set the <i>.animationHandler</i> field for the new
<a href="#DisplayEventTable">DisplayEvent</a> to an appropriate <a href="#AnimationCallback">Animation</a> callback handler.
The handler <b>MUST</b> be set.
<br /><br />
Other things to be done are to establish the initial settings for the new <a href="#DisplayEventTable">DisplayEvent</a> table,
create any additional fields you need for your animation code, and move the active <a href="#DisplayEventTable">DisplayEvent</a>s
that are now colliding due to the newly added event if your animation style should avoid overlaps.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><a href="#AnimationCallback">Animation</a></td>
<td class="ParameterDesc">
This function moves the <a href="#DisplayEventTable">DisplayEvent</a> at each update interval by modifying the <i>.positionX</i> and <i>.positionY</i> fields.
The opacity can also be controlled by modifying the <i>.alpha</i> field.
</td>
</tr>
</table>
</div>
<div class="SectionTitle"><a name="MikSBT.RegisterAnimationStyle"></a>MikSBT.RegisterAnimationStyle</div>
<a href="#TOC">Return to TOC</a><br /><br />
<div class="SectionDesc">
Registers a new animation style with MSBT.
<br /><br />
Custom animation style registration is not permanent. It must be done each load. In order to remove a custom
animation style, all that needs to be done is no longer register it on subsequent loads. If any of the scroll
areas have a custom animation style selected that is no longer registered, MSBT will recognize that an invalid
animation style is specified and use the default animation style accordingly.<br /><br />
</div>
<div class="SubsectionTitle">Syntax</div>
<div class="SubsectionBody">
<div class="Syntax"><b>MikSBT.RegisterAnimationStyle(</b><i>styleID</i><b>,</b> <i>initHandler</i><b>,</b> <i>availableDirections</i><b> [,</b> <i>availableBehaviors</i><b>,</b> <i>localizationTable</i><b>])</b></div>
</div>
<div class="SubsectionTitle">Parameters</div>
<div class="SubsectionBody">
<table cellspacing="3">
<tr>
<td class="ParameterName" nowrap="nowrap"><i>styleID</i> (Required)</td>
<td class="ParameterDesc">
A unique string that identifies the animation style.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>initHandler</i> (Required)</td>
<td class="ParameterDesc">
Your <a href="#InitDisplayEventCallback">InitDisplayEvent</a> callback handler.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>availableDirections</i> (Required)</td>
<td class="ParameterDesc">
A string that contains a semicolon separated list of the available directions for the animation style.<br /><br />
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>availableBehaviors</i> (Optional)</td>
<td class="ParameterDesc">
A string that contains a semicolon separated list of the available behaviors for the animation style.<br /><br />
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>localizationTable</i> (Optional)</td>
<td class="ParameterDesc">
A table that contains translations.<br /><br />
The strings provided in the <i>styleID</i>, <i>availableDirections</i>, and <i>availableBehaviors</i> parameters
will by used as the key into this table to find an appropriate translation.
</td>
</tr>
</table>
</div>
<div class="SubsectionTitle">Return Values</div>
<div class="SubsectionBody">None.</div>
<div class="SubsectionTitle">Examples</div>
<div class="SubsectionBody">
<div class="Syntax">
-- Register a new animation style with MSBT.<br />
MikSBT.RegisterAnimationStyle("MyModNameUberAnimation", myInitHandler, "Up;Down", "Implode;Explode", myLocalizationTable);
</div>
</div>
<div class="SubsectionTitle">Remarks</div>
<div class="SubsectionBody">
If you attempt to register a <i>styleID</i> that already exists, the function will quietly fail.
An easy way to make sure you have a unique <i>styleID</i> is to preprend your mod's name to it as demonstrated in the example.
</div>
<div class="SectionTitle"><a name="MikSBT.RegisterStickyAnimationStyle"></a>MikSBT.RegisterStickyAnimationStyle</div>
<a href="#TOC">Return to TOC</a><br /><br />
<div class="SectionDesc">
Registers a new sticky animation style with MSBT.
<br /><br />
Custom animation style registration is not permanent. It must be done each load. In order to remove a custom animation style, all that needs to be done is
no longer register it on subsequent loads. If any of the scroll areas have a custom animation style selected that is no longer registered, MSBT will recognize that an invalid
animation style is specified and use the default animation style accordingly.<br /><br />
</div>
<div class="SubsectionTitle">Syntax</div>
<div class="SubsectionBody">
<div class="Syntax"><b>MikSBT.RegisterStickyAnimationStyle(</b><i>styleID</i><b>,</b> <i>initHandler</i><b>,</b> <i>availableDirections</i><b> [,</b> <i>availableBehaviors</i><b>,</b> <i>localizationTable</i><b>])</b></div>
</div>
<div class="SubsectionTitle">Parameters</div>
<div class="SubsectionBody">
<table cellspacing="3">
<tr>
<td class="ParameterName" nowrap="nowrap"><i>styleID</i> (Required)</td>
<td class="ParameterDesc">
A unique string that identifies the animation style.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>initHandler</i> (Required)</td>
<td class="ParameterDesc">
Your <a href="#InitDisplayEventCallback">InitDisplayEvent</a> callback handler.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>availableDirections</i> (Required)</td>
<td class="ParameterDesc">
A string that contains a semicolon separated list of the available directions for the animation style.<br /><br />
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>availableBehaviors</i> (Optional)</td>
<td class="ParameterDesc">
A string that contains a semicolon separated list of the available behaviors for the animation style.<br /><br />
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>localizationTable</i> (Optional)</td>
<td class="ParameterDesc">
A table that contains translations.<br /><br />
The strings provided in the <i>styleID</i>, <i>availableDirections</i>, and <i>availableBehaviors</i> parameters
will by used as the key into this table to find an appropriate translation.
</td>
</tr>
</table>
</div>
<div class="SubsectionTitle">Return Values</div>
<div class="SubsectionBody">None.</div>
<div class="SubsectionTitle">Examples</div>
<div class="SubsectionBody">
<div class="Syntax">
-- Register a new sticky animation style with MSBT.<br />
MikSBT.RegisterStickyAnimationStyle("MyModNameUberStickyAnimation", myInitHandler, "Up;Down", "Jiggle;Normal", myLocalizationTable);
</div>
</div>
<div class="SubsectionTitle">Remarks</div>
<div class="SubsectionBody">
If you attempt to register a <i>styleID</i> that already exists, the function will quietly fail.
An easy way to make sure you have a unique <i>styleID</i> is to preprend your mod's name to it as demonstrated in the example.
</div>
<div class="SectionTitle"><a name="InitDisplayEventCallback"></a>InitDisplayEvent Callback</div>
<a href="#TOC">Return to TOC</a><br /><br />
<div class="SectionDesc">
Each time a new <a href="#DisplayEventTable">DisplayEvent</a> is added to a scroll area, this function is called with it, an array of
other <a href="#DisplayEventTable">DisplayEvent</a>s that are currently active for the scroll area, and the currently selected direction
and behavior for the scroll area.
<br /><br />
The most important thing for this function to do is set the <i>.animationHandler</i> field for the new <a href="#DisplayEventTable">DisplayEvent</a>
to an appropriate <a href="#AnimationCallback">Animation</a> callback handler.
<br /><br />
The other purpose of this function is to initialize the starting position and any additional information you need for the new
<a href="#DisplayEventTable">DisplayEvent</a>, and to move any other <a href="#DisplayEventTable">DisplayEvent</a>s that are now colliding due
to the new event.
<br /><br />
<b>This function MUST set the <i>.animationHandler</i> field of the <i>newDisplayEvent</i> parameter to a valid <a href="#AnimationCallback">Animation</a> callback handler.</b>
</div>
<div class="SubsectionTitle">Syntax</div>
<div class="SubsectionBody">
<div class="Syntax"><b>function myInitHandler(</b><i>newDisplayEvent</i><b>,</b> <i>activeDisplayEvents</i><b> [,</b> <i>direction</i><b>,</b> <i>behavior</i><b>])</b></div>
</div>
<div class="SubsectionTitle">Parameters</div>
<div class="SubsectionBody">
<table cellspacing="3">
<tr>
<td class="ParameterName" nowrap="nowrap"><i>newDisplayEvent</i> (Required)</td>
<td class="ParameterDesc">
A <a href="#DisplayEventTable">DisplayEvent</a> table that represents a new event.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>activeDisplayEvents</i> (Required)</td>
<td class="ParameterDesc">
An array of <a href="#DisplayEventTable">DisplayEvent</a> tables that represent the other events
that are currently active for the scroll area.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>direction</i> (Optional)</td>
<td class="ParameterDesc">
A string that is the currently selected direction for the scroll area.<br /><br />
The default animation direction should be used when this parameter is invalid.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>behavior</i> (Optional)</td>
<td class="ParameterDesc">
A string that is the currently selected behavior for the scroll area.<br /><br />
The default animation behavior should be used when this parameter is invalid.
</td>
</tr>
</table>
</div>
<div class="SubsectionTitle">Return Values</div>
<div class="SubsectionBody">None.</div>
<div class="SubsectionTitle">Examples</div>
<div class="SubsectionBody">
<div class="Syntax">
-- Create an InitDisplayEvent callback handler.<br />
local function myInitHandler(newDisplayEvent, activeDisplayEvents, direction, behavior)<br />
-- Do stuff in here to initialize the newDisplayEvent and move any activeDisplayEvents that are colliding according to your custom animation style.<br />
end<br />
</div>
</div>
<div class="SubsectionTitle">Remarks</div>
<div class="SubsectionBody">
Take a look at the init functions in the MSBTAnimationStyles.lua file that comes with the mod for an example of how MSBT initializes the default animation styles.<br /><br />
</div>
<div class="SectionTitle"><a name="AnimationCallback"></a>Animation Callback</div>
<a href="#TOC">Return to TOC</a><br /><br />
<div class="SectionDesc">
This function is called continously (typically every 15 or so milliseconds) for every active <a href="#DisplayEventTable">DisplayEvent</a> that is animating
for the duration of the animation time.
<br /><br />
The <a href="#DisplayEventTable">DisplayEvent</a> is positioned by setting its <i>.positionX</i> and <i>.positionY</i> fields, and its opacity can be controlled by setting its <i>.alpha</i> field.
<br /><br />
The x and y positions should be calculated based upon the completed animation percentage and the height and width of the scroll area available
in the <i>.scrollHeight</i> and <i>.scrollWidth</i> fields. By basing your calculations on the completed animation percentage, the animation
will remain consistent under diverse performance situations. If you were to base it simply on moving a set number of pixels each update then
the actual scroll speed would vary greatly. These fields are further described in the <a href="#DisplayEventTable">DisplayEvent</a> Table section.
</div>
<div class="SubsectionTitle">Syntax</div>
<div class="SubsectionBody">
<div class="Syntax"><b>function myAnimationHandler(</b><i>displayEvent</i>, <i>percentDone</i><b>)</b></div>
</div>
<div class="SubsectionTitle">Parameters</div>
<div class="SubsectionBody">
<table cellspacing="3">
<tr>
<td class="ParameterName" nowrap="nowrap"><i>displayEvent</i> (Required)</td>
<td class="ParameterDesc">
A <a href="#DisplayEventTable">DisplayEvent</a> table that represents the animating event.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>percentDone</i> (Required)</td>
<td class="ParameterDesc">
A decimal representation of a percentage that indicates how far along the animation has progressed.
</td>
</tr>
</table>
</div>
<div class="SubsectionTitle">Return Values</div>
<div class="SubsectionBody">None.</div>
<div class="SubsectionTitle">Examples</div>
<div class="SubsectionBody">
<div class="Syntax">
-- Create an Animation callback handler.<br />
local function myAnimationHandler(displayEvent, percentDone)<br />
-- Do stuff in here to animate the displayEvent.<br />
end<br />
</div>
</div>
<div class="SubsectionTitle">Remarks</div>
<div class="SubsectionBody">
Take a look at the scroll functions in the MSBTAnimationStyles.lua file that comes with the mod for an example of how MSBT animates the default animation styles.
</div>
<div class="SectionTitle"><a name="DisplayEventTable"></a>DisplayEvent Table</div>
<a href="#TOC">Return to TOC</a><br /><br />
<div class="SectionDesc">
This table respresents an animating event.
</div>
<div class="SubsectionTitle">Fields</div>
<div class="SubsectionBody">
<table cellspacing="3">
<tr>
<td class="ParameterName" nowrap="nowrap"><i>.scrollHeight</i> (Read-Only)</td>
<td class="ParameterDesc">
This field contains the height of the scroll area the event is animating in.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>.scrollWidth</i> (Read-Only)</td>
<td class="ParameterDesc">
This field contains the width of the scroll area the event is animating in.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>.fontSize</i> (Read-Only)</td>
<td class="ParameterDesc">
This field contains the size of the font used for the event.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>.frame</i> (Read-Only)</td>
<td class="ParameterDesc">
This field contains the <Frame> object the event is using.<br /><br />
A dynamic pool of frames is maintained and reused by MSBT.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>.fontString</i> (Read-Only)</td>
<td class="ParameterDesc">
This field contains the <FontString> object that the event is using to display the text.<br /><br />
A dynamic pool of font strings is maintained and reused by MSBT.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>.anchorPoint</i> (Read-Only)</td>
<td class="ParameterDesc">
This field contains anchor point for <Frame> object the event is using.<br /><br />
It will be "BOTTOMLEFT", "BOTTOM", or "BOTTOMRIGHT", corresponding to left, center, and right text alignment.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>.animationSpeed</i> (Read-Only)</td>
<td class="ParameterDesc">
The user selected animation speed. This is a decimal representation of a percentage.
<br /><br />
For example, 0.5 means that the animation should animate at 50% of the normal speed,
1.0 means it should animate at normal speed, and 2.5 means it should animate at 250% of normal speed.
<br /><br />
MSBT automatically scales the scroll time based upon the animation speed, but depending on your animation
you may need to do some manual scaling of different phases.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>.positionX</i> (Read-Write)</td>
<td class="ParameterDesc">
The x position of the event to be set once the function returns.
<br /><br />
MSBT handles all scroll area offsetting. x = 0 refers to the frame's attachment point (left, right, or center).
Negative values for x move the frame to the left, and positive values moves the frame to the right.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>.positionY</i> (Read-Write)</td>
<td class="ParameterDesc">
The y position of the event to be set once the function returns.
<br /><br />
MSBT handles all scroll area offsetting. y = 0 refers to the bottom point of the scroll area and increases upward.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>.alpha</i> (Read-Write)</td>
<td class="ParameterDesc">
The opacity of the frame to be set once the function returns.
<br /><br />
The value range is from 0 (invisible) to 1 (fully visible).
<br /><br />
MSBT automatically fades the animating frame out near the end of the animation. This field can be used for altering the opacity
during the remainder of the animation.
</td>
</tr>
<tr>
<td class="ParameterName" nowrap="nowrap"><i>.elapsedTime</i> (Read-Write)</td>
<td class="ParameterDesc">
The amount of time the event has been animating.
</td>
</tr>
</table>
</div>
<div class="SubsectionTitle">Remarks</div>
<div class="SubsectionBody">
Technically the fields marked as read-only are normal fields just like the rest, however they should be treated as read-only. Altering them can cause unexpected behavior.
I didn't want to add the extra overhead it would take to truly make them read-only. There are also a few other internal fields that should not be altered.
</div>
</body>
</html>