-
Notifications
You must be signed in to change notification settings - Fork 0
/
MSFD9.tex
12733 lines (9619 loc) · 479 KB
/
MSFD9.tex
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
% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{listings}
\lstdefinelanguage{es3}{
literate=%
{0}{{{\color{black}0}}}1
{1}{{{\color{black}1}}}1
{2}{{{\color{black}2}}}1
{3}{{{\color{black}3}}}1
{4}{{{\color{black}4}}}1
{5}{{{\color{black}5}}}1
{6}{{{\color{black}6}}}1
{7}{{{\color{black}7}}}1
{8}{{{\color{black}8}}}1
{9}{{{\color{black}9}}}1,
sensitive = false,
breaklines=true,
columns=fixed,
}
% Set Language
\lstset{
language={es3},
basicstyle=\small\ttfamily, % Global Code Style
extendedchars=true, % Allows 256 instead of 128 ASCII characters
tabsize=2, % number of spaces indented when discovering a tab
columns=fixed, % make all characters equal width
keepspaces=true, % does not ignore spaces to fit width, convert tabs to spaces
showstringspaces=false, % lets spaces in strings appear as real spaces
breaklines=true, % wrap lines if they don't fit
frame=trbl, % draw a frame at the top, right, left and bottom of the listing
}
\usepackage{amsmath,amssymb}
\usepackage{lmodern}
\usepackage{iftex}
\ifPDFTeX
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
\usepackage{unicode-math}
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
\KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\hypersetup{
hidelinks,
pdfcreator={LaTeX via pandoc}}
\urlstyle{same} % disable monospaced font for URLs
\usepackage{longtable,booktabs,array}
\usepackage{multirow}
\usepackage{calc} % for calculating minipage widths
% Correct order of tables after \paragraph or \subparagraph
\usepackage{etoolbox}
\makeatletter
\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
\makeatother
% Allow footnotes in longtable head/foot
\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
\makesavenoteenv{longtable}
\usepackage{graphicx}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\ifLuaTeX
\usepackage{selnolig} % disable illegal ligatures
\fi
\author{}
\date{}
\begin{document}
% frontpage font color from the .doc: orange.
% frontpage font sizes from the .doc: 36pt, 16pt, 14pt.
\begin{center}
{\Huge \textcolor{orange}{\textbf{Morrowind Scripting for Dummies}}}
{\LARGE (10\textsuperscript{th} Edition)}
{\Large A manual for the TES Construction Set Scripting Language by
\textbf{GhanBuriGhan}
\textbf{Updated by Yacoby and melian}}
{\large \textbf{With help and information from the community}}
\end{center}
\includegraphics{media/image1.jpg} %\\
\clearpage
\tableofcontents
\addtocontents{toc}
%Table of Contents
%
%\protect\hyperlink{foreword-to-the-ninth-edition}{Foreword to the ninth
%edition 9}
%
%\protect\hyperlink{foreword-to-eighth-edition}{Foreword to eighth
%edition 10}
%
%\protect\hyperlink{_Toc53412549}{Introduction 11}
%
%\protect\hyperlink{using-this-guide.}{Using this guide. 11}
%
%\protect\hyperlink{what-is-a-script}{What is a script? 11}
%
%\protect\hyperlink{what-can-scripts-do}{What can scripts do? 12}
%
%\protect\hyperlink{what-scripts-cant-do}{What scripts can't do: 12}
%
%\protect\hyperlink{_Toc53412554}{Scripting tutorial 13}
%
%\protect\hyperlink{lets-get-going}{Let's get going! 13}
%
%\protect\hyperlink{the-scripting-window}{The scripting window 13}
%
%\protect\hyperlink{what-do-we-want}{What do we want? 14}
%
%\protect\hyperlink{writing-a-script}{Writing a script 14}
%
%\protect\hyperlink{naming-a-script-begin-and-end}{Naming a script: Begin
%and End 14}
%
%\protect\hyperlink{detecting-an-action-by-the-player}{Detecting an
%action by the player 15}
%
%\protect\hyperlink{writing-text-and-obtaining-decisions-from-the-player}{Writing
%text and obtaining decisions from the player 15}
%
%\protect\hyperlink{how-local-scripts-are-executed}{How local scripts are
%executed 16}
%
%\protect\hyperlink{your-first-bug}{Your first bug 19}
%
%\protect\hyperlink{putting-a-spell-on-the-player}{Putting a spell on the
%player 19}
%
%\protect\hyperlink{how-to-learn-more}{How to learn more 22}
%
%\protect\hyperlink{general-information-scripts-commands-and-syntax}{General
%Information: Scripts, Commands and Syntax 23}
%
%\protect\hyperlink{types-of-scripts}{Types of scripts 23}
%
%\protect\hyperlink{local-scripts}{Local scripts 23}
%
%\protect\hyperlink{global-scripts}{Global scripts 23}
%
%\protect\hyperlink{syntax}{Syntax 25}
%
%\protect\hyperlink{beginning-and-ending-scripts}{Beginning and ending
%scripts 25}
%
%\protect\hyperlink{general-syntax-for-functions}{General syntax for
%functions: 25}
%
%\protect\hyperlink{general-syntax-commas-parentheses-and-spaces}{General
%syntax: Commas, parentheses and spaces 26}
%
%\protect\hyperlink{comments}{Comments 26}
%
%\protect\hyperlink{indentation-using-tabstops}{Indentation / using
%tabstops 26}
%
%\protect\hyperlink{variables}{Variables 27}
%
%\protect\hyperlink{types-of-variables}{Types of variables 27}
%
%\protect\hyperlink{_Toc182634499}{Local variables 28}
%
%\protect\hyperlink{global-variables}{Global variables 29}
%
%\protect\hyperlink{referencing-variables-on-other-objects-and-scripts}{Referencing
%variables on other objects and scripts 29}
%
%\protect\hyperlink{using-variables-in-functions}{Using variables in
%functions 30}
%
%\protect\hyperlink{section}{Operators / mathematical calculations 30}
%
%\protect\hyperlink{_Toc182634504}{Testing conditions 31}
%
%\protect\hyperlink{use-of-if-elseif-conditions}{Use of if\ldots{} elseif
%conditions 31}
%
%\protect\hyperlink{while-conditions}{While conditions 33}
%
%\protect\hyperlink{constructing-boolean-operations-in-tes-script}{Constructing
%Boolean operations in TES Script 34}
%
%\protect\hyperlink{_Toc53412583}{List of TES-script functions 35}
%
%\protect\hyperlink{explanation-of-the-format}{Explanation of the format
%35}
%
%\protect\hyperlink{working-with-objects}{Working with objects 36}
%
%\protect\hyperlink{working-with-inventory-items}{Working with inventory
%items 36}
%
%\protect\hyperlink{adding-and-removing-items-from-the-inventory}{Adding
%and removing items from the inventory 36}
%
%\protect\hyperlink{dropping-items-to-the-floor}{Dropping items to the
%floor 38}
%
%\protect\hyperlink{monitoring-inventory-activities-adding-dropping-items-and-using-soul-gems}{Monitoring
%inventory activities: Adding, dropping items and using soul gems 39}
%
%\protect\hyperlink{force-equipping-an-item}{Force-equipping an Item 40}
%
%\protect\hyperlink{detecting-if-an-item-has-been-equipped}{Detecting if
%an item has been equipped 41}
%
%\protect\hyperlink{disabling-ability-to-equip-an-item}{Disabling ability
%to equip an item 42}
%
%\protect\hyperlink{_Toc182634518}{Checking for presence of items in
%inventory 43}
%
%\protect\hyperlink{repairing-objects}{Repairing objects 43}
%
%\protect\hyperlink{worn-equipped-object-information}{Worn / equipped
%object information 43}
%
%\protect\hyperlink{usedonme-function}{UsedOnMe function 46}
%
%\protect\hyperlink{moving-and-placing-objects}{Moving and placing
%objects 46}
%
%\protect\hyperlink{moving-along-an-objects-axis}{Moving along an objects
%axis 46}
%
%\protect\hyperlink{moving-along-the-world-axis}{Moving along the world
%axis 47}
%
%\protect\hyperlink{cellupdate}{CellUpdate 48}
%
%\protect\hyperlink{setting-position-the-other-way-to-do-movement}{Setting
%position (the other way to do movement) 48}
%
%\protect\hyperlink{positioning-an-object-in-the-world-or-in-an-interior-cell}{Positioning
%an object in the world or in an interior cell 50}
%
%\protect\hyperlink{resetting-an-object-to-its-original-position}{Resetting
%an object to its original position 51}
%
%\protect\hyperlink{placing-an-item-near-the-pc}{Placing an item near the
%PC 51}
%
%\protect\hyperlink{place-items-near-an-object}{Place items near an
%object 52}
%
%\protect\hyperlink{creating-new-object-references-with-placeitem}{Creating
%new object-references with PlaceItem 52}
%
%\protect\hyperlink{rotation-and-angles}{Rotation and angles 54}
%
%\protect\hyperlink{making-an-object-spin}{Making an object spin 54}
%
%\protect\hyperlink{setting-angles}{Setting Angles 54}
%
%\protect\hyperlink{scale-functions}{Scale Functions 56}
%
%\protect\hyperlink{determining-location-relative-position-and-movement}{Determining
%location, relative position and movement 58}
%
%\protect\hyperlink{detecting-if-player-is-indoors-or-outdoors}{Detecting
%if player is indoors or outdoors 58}
%
%\protect\hyperlink{determining-the-players-cell}{Determining the players
%cell 58}
%
%\protect\hyperlink{distance-of-one-object-to-another}{Distance of one
%object to another 59}
%
%\protect\hyperlink{determining-an-objects-position-and-facing}{Determining
%an objects position and facing 59}
%
%\protect\hyperlink{line-of-sight}{Line of Sight 60}
%
%\protect\hyperlink{_Toc182634542}{Determine whether an Actor is detected
%by another Actor 62}
%
%\protect\hyperlink{determining-when-the-pc-leaves-a-cell}{Determining
%when the PC leaves a cell 62}
%
%\protect\hyperlink{detect-player-traveling}{Detect player traveling 63}
%
%\protect\hyperlink{triggers-for-actors-standing-on-an-object}{Triggers
%for Actors standing on an object 64}
%
%\protect\hyperlink{hurting-an-actor-standing-on-an-object}{Hurting an
%Actor standing on an object 65}
%
%\protect\hyperlink{_Toc182634547}{Object Collision Functions 65}
%
%\protect\hyperlink{checking-activation-of-an-item-and-activating-it}{Checking
%activation of an item and activating it 66}
%
%\protect\hyperlink{locking-and-unlocking-doors-or-chests}{Locking and
%Unlocking doors or chests 69}
%
%\protect\hyperlink{animating-objects}{Animating objects 69}
%
%\protect\hyperlink{enabling-and-disabling-objects}{Enabling and
%disabling objects 71}
%
%\protect\hyperlink{deleting-a-reference-completely}{Deleting a reference
%completely 72}
%
%\protect\hyperlink{dont-save-changes-to-an-object}{Don't save changes to
%an object 74}
%
%\protect\hyperlink{scripting-npcs-ai-and-movement}{Scripting NPC's: AI
%and Movement 75}
%
%\protect\hyperlink{make-an-npc-walk-to-a-new-location}{Make an NPC walk
%to a new location 75}
%
%\protect\hyperlink{checking-whether-an-npc-has-performed-his-movement}{Checking
%whether an NPC has performed his movement 75}
%
%\protect\hyperlink{make-an-actor-turn-or-face-a-certain-direction}{Make
%an Actor turn or face a certain direction 77}
%
%\protect\hyperlink{define-random-actor-movement}{Define random Actor
%movement 77}
%
%\protect\hyperlink{making-actors-activate-objects}{Making Actors
%activate objects 79}
%
%\protect\hyperlink{following-and-escorting}{Following and Escorting 80}
%
%\protect\hyperlink{checking-which-ai-package-is-currently-executed}{Checking
%which AI package is currently executed 81}
%
%\protect\hyperlink{forcing-sneak-movement}{Forcing sneak movement 83}
%
%\protect\hyperlink{forcing-running-and-jumping-tribunal-npc-movement-functions}{Forcing
%running and jumping: Tribunal NPC Movement Functions 85}
%
%\protect\hyperlink{detecting-players-action-running-jumping-sneaking}{Detecting
%players action: running, jumping, sneaking? 86}
%
%\protect\hyperlink{detect-combat-readiness}{Detect combat readiness 87}
%
%\protect\hyperlink{section-7}{Making someone fall 88}
%
%\protect\hyperlink{equipment-sharing-and-other-companion-functions}{Equipment
%sharing and other companion functions 88}
%
%\protect\hyperlink{race-faction-and-rank}{Race, Faction and Rank 90}
%
%\protect\hyperlink{determining-race}{Determining Race 90}
%
%\protect\hyperlink{determining-the-pcs-faction-status}{Determining the
%PC's Faction status: 90}
%
%\protect\hyperlink{modifying-faction-standing-and-reaction}{Modifying
%faction standing and reaction 91}
%
%\protect\hyperlink{determining-and-changing-reputation-and-disposition}{Determining
%and changing reputation and disposition 93}
%
%\protect\hyperlink{werewolf-specific-functions}{Werewolf-specific
%functions 94}
%
%\protect\hyperlink{set-the-werewolf-attributes}{Set the werewolf
%attributes 94}
%
%\protect\hyperlink{change-the-color-of-secunda}{Change the color of
%Secunda 94}
%
%\protect\hyperlink{determine-how-many-kills-a-werewolf-has}{Determine
%how many kills a werewolf has 94}
%
%\protect\hyperlink{check-to-see-if-the-creature-is-in-werewolf-form}{Check
%to see if the creature is in werewolf form 95}
%
%\protect\hyperlink{change-to-a-werewolf}{Change to a werewolf 95}
%
%\protect\hyperlink{section-8}{Special werewolf global variables 96}
%
%\protect\hyperlink{text-and-dialogue}{Text and Dialogue 97}
%
%\protect\hyperlink{brief-dialogue-how-to}{Brief dialogue how-to 97}
%
%\protect\hyperlink{the-concept-of-mw-dialogue}{The concept of MW
%dialogue 97}
%
%\protect\hyperlink{how-dialogue-works}{How dialogue works 98}
%
%\protect\hyperlink{a-few-golden-rules}{A few golden rules 101}
%
%\protect\hyperlink{dialogue-101}{Dialogue 101 101}
%
%\protect\hyperlink{dialogue-related-functions}{Dialogue-related
%functions 103}
%
%\protect\hyperlink{displaying-messages}{Displaying messages 103}
%
%\protect\hyperlink{_Toc182634588}{Displaying variables and text defines
%in a message box 105}
%
%\protect\hyperlink{adding-a-dialogue-topic}{Adding a dialogue topic 106}
%
%\protect\hyperlink{initiating-and-ending-dialogue}{Initiating and ending
%dialogue 107}
%
%\protect\hyperlink{allowing-forced-dialogue-with-werewolf-player-bloodmoon}{Allowing
%forced Dialogue with Werewolf player (Bloodmoon) 108}
%
%\protect\hyperlink{multiple-choice-asking-questions}{Multiple choice --
%asking questions 109}
%
%\protect\hyperlink{adding-to-the-journal-and-testing-journal-entries}{Adding
%to the journal and testing journal entries 110}
%
%\protect\hyperlink{special-dialogue-only-functions}{Special
%dialogue-only functions 111}
%
%\protect\hyperlink{changing-the-hello-setting}{Changing the Hello
%setting 112}
%
%\protect\hyperlink{useful-dialogue-variables}{Useful dialogue variables
%112}
%
%\protect\hyperlink{changing-and-testing-skills-attributes-and-other-stats}{Changing
%and testing Skills, Attributes, and other Stats 113}
%
%\protect\hyperlink{get-set-and-modify-stats---general-remarks}{Get, Set,
%and Modify stats - general remarks 113}
%
%\protect\hyperlink{determining-and-changing-actor-and-player-stats}{Determining
%and changing Actor and player stats: 114}
%
%\protect\hyperlink{determining-and-changing-attributes}{Determining and
%changing Attributes: 114}
%
%\protect\hyperlink{determining-and-changing-health-magicka-fatigue}{Determining
%and changing Health, Magicka, Fatigue: 114}
%
%\protect\hyperlink{determining-and-changing-skills}{Determining and
%changing Skills: 115}
%
%\protect\hyperlink{determining-and-changing-level}{Determining and
%changing Level 115}
%
%\protect\hyperlink{_Toc182634604}{GetStat, ModStat and SetStat: A
%concerned modder's guide. - Galsiah 116}
%
%\protect\hyperlink{combat}{Combat 120}
%
%\protect\hyperlink{initiating-and-ending-combat}{Initiating and ending
%combat 120}
%
%\protect\hyperlink{detecting-attack}{Detecting Attack 120}
%
%\protect\hyperlink{combat-related-getmodset-ai-functions-fight-flee-alarm}{Combat
%related Get/Mod/Set AI functions: Fight, Flee, Alarm 122}
%
%\protect\hyperlink{keeping-track-of-kills-and-knockouts}{Keeping track
%of kills and knockouts 123}
%
%\protect\hyperlink{resurrecting-a-dead-actor}{Resurrecting a dead Actor
%125}
%
%\protect\hyperlink{crime}{Crime 126}
%
%\protect\hyperlink{determining-and-changing-crime-level}{Determining and
%changing Crime Level 126}
%
%\protect\hyperlink{jailing-the-pc}{Jailing the PC 126}
%
%\protect\hyperlink{clearing-the-pc-of-crime}{Clearing the PC of crime
%126}
%
%\protect\hyperlink{detecting-crime}{Detecting crime 126}
%
%\protect\hyperlink{useful-global-variables}{Useful global variables 128}
%
%\protect\hyperlink{magic}{Magic 129}
%
%\protect\hyperlink{limiting-the-use-of-teleport}{Limiting the use of
%teleport 129}
%
%\protect\hyperlink{limiting-the-use-of-levitation}{Limiting the use of
%levitation 130}
%
%\protect\hyperlink{checking-and-managing-souls-and-soulgems}{Checking
%and managing souls and soulgems 131}
%
%\protect\hyperlink{adding-and-removing-spells-and-cursing}{Adding and
%removing spells and cursing 133}
%
%\protect\hyperlink{casting-spells}{Casting spells 134}
%
%\protect\hyperlink{managing-and-testing-for-spells}{Managing and testing
%for spells 135}
%
%\protect\hyperlink{managing-and-testing-spell-effects}{Managing and
%testing spell effects 136}
%
%\protect\hyperlink{testing-disease}{Testing disease 137}
%
%\protect\hyperlink{explosion}{Explosion 138}
%
%\protect\hyperlink{magic-getmodset-effects-functions}{Magic Get/Mod/Set
%effects functions: 138}
%
%\protect\hyperlink{sound}{Sound 140}
%
%\protect\hyperlink{make-actors-speak-an-audio-file}{Make Actors speak an
%audio file 140}
%
%\protect\hyperlink{playing-music}{Playing music 140}
%
%\protect\hyperlink{playing-sounds}{Playing sounds 141}
%
%\protect\hyperlink{controlling-sound}{Controlling sound 141}
%
%\protect\hyperlink{sound-file-formats}{Sound file formats 142}
%
%\protect\hyperlink{keeping-track-of-time}{Keeping track of time 143}
%
%\protect\hyperlink{timer}{Timer 143}
%
%\protect\hyperlink{morrowinds-time-related-global-variables}{Morrowind's
%time related global variables 143}
%
%\protect\hyperlink{keeping-track-of-days-passed}{Keeping track of days
%passed 144}
%
%\protect\hyperlink{moon-phases}{Moon phases 144}
%
%\protect\hyperlink{weather}{Weather 146}
%
%\protect\hyperlink{changing-weather}{Changing weather 146}
%
%\protect\hyperlink{changing-weather-settings-for-a-region}{Changing
%weather settings for a region 146}
%
%\protect\hyperlink{determining-current-weather}{Determining current
%weather 147}
%
%\protect\hyperlink{detecting-wind-speed}{Detecting wind speed 147}
%
%\protect\hyperlink{player-sleeping}{Player sleeping 148}
%
%\protect\hyperlink{enabling-and-disabling-player-control-and-interface}{Enabling
%and disabling player control and interface 149}
%
%\protect\hyperlink{disable-player-control-functions}{Disable player
%control functions 149}
%
%\protect\hyperlink{enable-player-control-functions}{Enable player
%control functions 149}
%
%\protect\hyperlink{check-player-control-status}{Check player control
%status 150}
%
%\protect\hyperlink{force-first-or-third-person-view}{Force first or
%third person view 150}
%
%\protect\hyperlink{functions-for-character-generation-menus}{Functions
%for character generation menus 150}
%
%\protect\hyperlink{determining-if-player-has-menus-open}{Determining if
%player has menus open 151}
%
%\protect\hyperlink{using-menutest-to-open-and-close-menus}{Using
%MenuTest to open and close menus 152}
%
%\protect\hyperlink{miscellaneous-functions-and-variables}{Miscellaneous
%functions and variables 153}
%
%\protect\hyperlink{breaking-of-script-processing}{Breaking of script
%processing 153}
%
%\protect\hyperlink{controlling-global-scripts}{Controlling global
%scripts 153}
%
%\protect\hyperlink{fading-the-screen-in-and-out}{Fading the screen in
%and out 154}
%
%\protect\hyperlink{adding-a-location-to-the-map}{Adding a location to
%the map 154}
%
%\protect\hyperlink{assigning-random-values-to-variables}{Assigning
%random values to variables 154}
%
%\protect\hyperlink{playing-videos}{Playing videos 155}
%
%\protect\hyperlink{_Toc182634660}{Levelled List functions 156}
%
%\protect\hyperlink{square-root}{Square root 157}
%
%\protect\hyperlink{water-level-functions}{Water Level Functions 157}
%
%\protect\hyperlink{tips-and-tricks}{Tips and tricks 160}
%
%\protect\hyperlink{little-helpers-text-search-copy-paste}{Little
%helpers: Text search, copy, paste 160}
%
%\protect\hyperlink{alternative-scripting-editors}{Alternative scripting
%editors 160}
%
%\protect\hyperlink{script-extenders}{Script Extenders 161}
%
%\protect\hyperlink{script-with-style-for-safer-scripting}{Script with
%style for safer scripting 162}
%
%\protect\hyperlink{cleaning-up-your-mod}{Cleaning up your mod 163}
%
%\protect\hyperlink{on-references-persist}{On References Persist 165}
%
%\protect\hyperlink{the-72-hours-bug-a-brief-explanation}{The "72-Hours
%Bug": A Brief Explanation 165}
%
%\protect\hyperlink{limits-of-the-script-editor}{Limits of the Script
%Editor 166}
%
%\protect\hyperlink{pitfalls}{Pitfalls 167}
%
%\protect\hyperlink{saving-cpu-time}{Saving CPU time 168}
%
%\protect\hyperlink{targeted-scripts-running-global-scripts-tied-to-an-object}{Targeted
%scripts: running "global" scripts tied to an object 170}
%
%\protect\hyperlink{detecting-when-the-player-does-a-load-from-saved-game}{Detecting
%when the player does a load from saved game: 171}
%
%\protect\hyperlink{uses-of-the-chargenstate-variable---disabling-saving-and-menus}{Uses
%of the CharGenState variable - Disabling saving and menus 173}
%
%\protect\hyperlink{detecting-use-of-scrolls-or-books}{Detecting use of
%scrolls or books 174}
%
%\protect\hyperlink{making-actors-switch-between-weapons}{Making Actors
%switch between weapons 176}
%
%\protect\hyperlink{_Toc182634679}{Making NPCs switch between spell
%"sets" 177}
%
%\protect\hyperlink{making-actors-lie-down}{Making Actors lie down 177}
%
%\protect\hyperlink{scripted-teleporting}{Scripted teleporting 181}
%
%\protect\hyperlink{interaction-between-mods}{Interaction between mods
%183}
%
%\protect\hyperlink{safely-starting-global-scripts--avoiding-the-main-script}{Safely
%starting global scripts- avoiding the main script 184}
%
%\protect\hyperlink{use-sound-to-detect-events}{Use sound to detect
%events 185}
%
%\protect\hyperlink{large-battles}{Large battles 185}
%
%\protect\hyperlink{a-guide-to-making-ridable-objects}{A guide to making
%ridable objects 186}
%
%\protect\hyperlink{selecting-objects}{Selecting objects 186}
%
%\protect\hyperlink{creatingdeleting-objects}{Creating/Deleting objects
%186}
%
%\protect\hyperlink{falling-off-from-objects}{Falling off from objects
%187}
%
%\protect\hyperlink{collision-detection}{Collision detection 188}
%
%\protect\hyperlink{savegame-issue}{Savegame issue 188}
%
%\protect\hyperlink{trigonometry-script---fast-sine-and-cosine}{Trigonometry
%script - fast sine and cosine 189}
%
%\protect\hyperlink{mannequins}{Mannequins 198}
%
%\protect\hyperlink{is-she-looking-at-me}{Is she looking at me? 201}
%
%\protect\hyperlink{cinematic-sequence}{Cinematic sequence 203}
%
%\protect\hyperlink{troubleshooting}{Troubleshooting 204}
%
%\protect\hyperlink{general-hints}{General hints 204}
%
%\protect\hyperlink{the-console}{The Console 204}
%
%\protect\hyperlink{using-the-console-to-check-variables}{Using the
%Console to check variables: 204}
%
%\protect\hyperlink{using-the-console-to-quickly-test-scripts}{Using the
%Console to quickly test scripts: 204}
%
%\protect\hyperlink{error-messages-malfunctions-and-common-causes}{Error
%messages, malfunctions and common causes 205}
%
%\protect\hyperlink{in-the-editor}{In the editor 205}
%
%\protect\hyperlink{in-game-error-messages}{In game error messages: 205}
%
%\protect\hyperlink{appendix}{Appendix 208}
%
%\protect\hyperlink{new-functions-that-come-with-tribunal}{New functions
%that come with TRIBUNAL 208}
%
%\protect\hyperlink{changes-fixes-to-morrowind-scripting}{Changes / fixes
%to Morrowind scripting: 208}
%
%\protect\hyperlink{index-of-new-tribunal-script-functions}{Index of new
%Tribunal Script Functions: 208}
%
%\protect\hyperlink{new-functions-that-come-with-bloodmoon}{New functions
%that come with BLOODMOON 209}
%
%\protect\hyperlink{index-of-new-bloodmoon-script-functions-and-variables}{Index
%of new Bloodmoon Script Functions and variables: 209}
%
%\protect\hyperlink{previously-undocumented-functions}{Previously
%undocumented functions 210}
%
%\protect\hyperlink{variable-type-functions}{Variable-type functions:
%211}
%
%\protect\hyperlink{local-variables-that-get-set-by-the-game}{Local
%variables that get set by the game: 211}
%
%\protect\hyperlink{local-variables-that-you-can-set-as-a-flag}{Local
%variables that you can set as a flag: 211}
%
%\protect\hyperlink{special-globals}{Special Globals 211}
%
%\protect\hyperlink{game-units}{Game units: 213}
%
%\protect\hyperlink{derived-attribute-calculations}{Derived attribute
%calculations: 213}
%
%\protect\hyperlink{_Toc53412751}{Magic Effect List 215}
%
%\protect\hyperlink{list-of-console-commands}{List of console commands
%216}
%
%\protect\hyperlink{game-settings}{Game Settings 219}
%
%\protect\hyperlink{index}{Index 226}
\hypertarget{foreword-to-the-ninth-edition}{%
\subsubsection{\texorpdfstring{\hfill\break
Foreword to the ninth
edition}{ Foreword to the ninth edition}}\label{foreword-to-the-ninth-edition}}
Another update, this time by more than one person, now you can get
really confused when it mentions that ``I'' did something or found
something *grins*. Although this update was intended as a bugfix, a huge
amount of new information has been added - since much of it concerns the
bugs and pitfalls of the scripting language that have been discovered
since version 8, you will find changes and additions scattered
throughout.
I have also added a couple more functions that were missing from the
last version, and there is a small section on script extenders to give a
brief overview of what can be done with each which should hopefully
prove informative to anyone wanting to know more about what they do.
Galsiah proveded a large section on the failings of get/mod/set stat;
there is a lot more info on dialog and how it works, which should be
very useful; a short explanation of float values and how they work has
been added; some sections have been rearranged for clarity; and I
\emph{think} I've removed all the en dashes and typographer's quotes
from code blocks, so it should be safe to copy-paste most of the example
scripts now.
Special thanks go to GhanBuriGhan, who gave me permission to update his
indispensable guide. Also thanks to Dave Humphrey for his permission to
use the information on UESP wiki, and everyone who contributed to that
wiki. I would like to thank exclusiveor77, DinkumThinkum, Björn, abot,
Galsiah, Casey Tucker, cyran0 and JOG for the huge amount of information
they gave me on the forums.
However without the help of the rest of community, everyone who
collected all the information, posted their experiences, this guide
would have never happened.
Yacoby and melian
\hypertarget{foreword-to-eighth-edition}{%
\subsubsection{\texorpdfstring{\hfill\break
Foreword to eighth
edition}{ Foreword to eighth edition}}\label{foreword-to-eighth-edition}}
Oh no, MSFD updates again! Quite a few changes this time. I have
continued to reorder functions to achieve a more consistent
classification. In the course of this restructuring of the text,
Tribunal and Bloodmoon functions are now also sorted among the rest of
the functions (but clearly marked), and the same applies for
Get/Set/ModStat type functions - the ones that affect magic are now in
the Magic section, the ones that affect combat are in the combat
chapter, and so on. I reformatted all the function entries for better
visibility. There are also a good number of corrections and additions:
check out the corrected list of idles in AIWander, more detailed info on
functions such as OnDeath, OnActivate, or the revelation that some
functions, like PositionCell use a different unit for the angle setting
(minutes instead of degrees). There is a lot of interesting new detail
on the intricacies of RemoveItem, OnPCEquip, and SkipEquip. Throughout,
I have added a couple more sample scripts. I have assembled a tips list
on Dialogue from the information from a once-pinned thread on the
official forums. To make your mod-testing easier, I now have a much more
complete list of console commands, and you may find that some of these
may actually be useful script functions as well. A nice collection of
new tips and tricks have also been added, e.g. on how to detect savegame
loading, alternative script editors, a fast sine and cosine calculator
and more.
I would like to mention something here, that has become more and more
evident in recent discussions. Apparently the different versions of the
game (Morrowind, the expansions, various updates, European/American
versions), have quite a number of functional differences with respect to
scripting. This may explain a lot of the conflicting information I get
about some functions. Some functions actually seem to have lost
functionality in later versions of the game, some regained
functionality, etc. In the absence of a full change log by Bethesda it
is unfortunately impossible to really give a final verdict in many of
these cases.
Again I can only stress that this guide would never have become what it
is without the help and support of the modding community. This time, I
would like to say special thanks to Nigedo, DinkumThinkum, ManaUser,
ThePal, Erstam, JDGBOLT, Klinn, and MentalElf, for their tireless help
in finding and solving many errors or inconsistencies in the last
edition, or sharing scripts and information with me. Thanks also to
Emma, for all the info she put into that dialogue thread on the forums.
GhanBuriGhan
Disclaimer \& Copyright Statment: The Elder Scrolls, Morrowind,
Daggerfall, Arena, Tribunal, Bloodmoon the TES Construction Set etc. are
property of Bethesda Softworks, a ZeniMax Media company. The authors and
editors of this manual make no claims to these names and trademarks. In
all other respects I (GhanBuriGhan) maintain the copyright for this
document. This guide is fully unofficial and in no way am I, any other
authors or editors, or Bethesda responsible for any damages or loss of
data, patience, hair, or sanity inflicted through the use of this
manual. You can freely distribute this document as long as you keep it
intact and unmodified.
\emph{\textbf{If you find older versions of this document on the web for
download, please inform the webmaster about the new version.}}
\protect\hypertarget{_Toc53412549}{}{}Introduction
\hypertarget{using-this-guide.}{%
\subsection{Using this guide.}\label{using-this-guide.}}
If you are new to scripting, you should probably start by reading this
introduction and especially do the tutorial. It is my best attempt at
explaining scripts, what they do, and how to program one, in simple
terms.
Secondly this is a manual, a reference, a handbook. The bulk of this
document is a documentation of the available functions. This part is not
written for the beginner, you are expected to know the basics of
scripting already. I have however tried to provide a lot more info,
explanations and sample scripts than the original helpfile, to make it
easier to use these functions correctly in your scripts. Use the index
at the end of the document to find info on a specific function, or the
table of contents to find functions related to a general area of
interest. If you run into errors, the Troubleshooting section may help
you a bit. In the Appendix you find lists that may also come in handy as
a reference.
Thirdly, as an advanced scripter you may find the Tips and Tricks
section interesting that covers both basic advice and advanced scripting
techniques.
Finally a word of advice: don't take what's written here as gospel. The
info in this guide represents the best of my knowledge and forum wisdom,
but that doesn't mean that there aren't mistakes and oversights, etc.
E.g. if I write that a function doesn't take variables as arguments it
\emph{probably} doesn't -- but if it is important for your mod, by all
means try anyway. It may have changed with a patch or maybe simply
nobody checked before. So run a test, and if you find something new, let
me know, and I will add the info in a possible future update.
\hypertarget{what-is-a-script}{%
\subsection{What is a script?}\label{what-is-a-script}}
Scripts are basically pieces of code written in a special scripting
language (I will call it TES script from here on). These little
"programs" will run during the game and can perform certain things in
the game, lots of things actually: Trigger events, control time and
place, make things and creatures vanish, appear or move, give messages
to the player, change stats, even change the weather -- the
possibilities are great.
TES Script is a unique scripting language, it is not used outside the
TES Construction Set. As a scripting language it has certain limitations
compared to a "real" programming language, like, e.g. C++:
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
The scope of TES Script is limited-- don't expect to be able to
program anything that is not already in the game in one way or another
-- which is not to say you can not achieve new and unusual things with
scripting! But you can't use TES script to, say, program a word
processor.
\item
TES Script is also not an SDK (software development kit) that lets you
actually work with and change (parts of) the games source code. That's
why you can't use TES script to, for example, add new weather-effects.
Those are hardcoded and you would need to change the actual game .exe
to do that.
\item
It's an interpreted language not a compiled one -- the code needs a
separate program (in this case Morrowind) to run -- unlike compiled
code that could be run by itself, like an .exe application.
\end{enumerate}
\hypertarget{what-can-scripts-do}{%
\subsection{What can scripts do?}\label{what-can-scripts-do}}
Scripts for Morrowind are a way to have the game dynamically react to
what the player does in the game world. You can use scripts to manage
complex quests. You can use scripts to create custom items that perform
actions beyond what regular enchantments could. You can use scripts to
create traps. You can use scripts to change NPC or creature behavior.
Remember the character creation in Morrowind? It's basically controlled
by a number of scripts. Seen Fargoth sneak around to his stash in Seyda
Neen? That's a script directing his moves. Freed any slaves? That also
is handled by a script. So the short answer to the question is: a lot.
\hypertarget{what-scripts-cant-do}{%
\subsection{What scripts can't do:}\label{what-scripts-cant-do}}
The TES script language is limited in its capabilities -- there are only
so many functions that you can use and sometimes the possible uses are
not all that you may wish them to be. In fact some functions are buggy
or plain broken. In many cases smart scripters can find workarounds for
apparent limitations, but don't expect miracles. Many things are
hardcoded and can not or only indirectly be influenced by scripts.
\protect\hypertarget{_Toc53412554}{}{}Scripting tutorial
If you are completely new to scripting and programming in general, the
thought of using TES script might be a little daunting -- I have
therefore written an extended tutorial that will walk you through making
your first script. I will also explain the main elements of the
scripting language as we go. There will be other explanations on the
way, but the key instructions will be in \textbf{bold} print.
\hypertarget{lets-get-going}{%
\subsection{Let's get going!}\label{lets-get-going}}
We start by opening the script editor: \textbf{Start up the TES
Construction Set, open the Morrowind.esm file and then select Edit
Scripts from the Gameplay menu to open the scripting window.}
\hypertarget{the-scripting-window}{%
\subsection{The scripting window}\label{the-scripting-window}}