forked from tdauth/dmdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjasshelpermanual.html
4288 lines (3205 loc) · 461 KB
/
jasshelpermanual.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
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
<html>
<head>
<title>JassHelper 0.A.2.B</title>
<meta name="Generator" content="gedit">
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<style type='text/css'>
pre { padding-left: 20px; }
</style>
</head>
<body bgcolor="#ffffff" text="#000000">
<h1>JassHelper 0.A.2.B</h1>
<style type="text/css"><!--
.syntax-NULL {
color: #010101;
}
.syntax-COMMENT1 {
color: #0f6601;
font-style: italic;
}
.syntax-COMMENT2 {
background: #f7fef7;
color: #016f0b;
font-style: italic;
}
.syntax-COMMENT3 {
color: #8e8e8e;
font-weight: bold;
}
.syntax-COMMENT4 {
color: #cc6600;
}
.syntax-DIGIT {
color: #000066;
}
.syntax-FUNCTION {
color: #ff7200;
}
.syntax-INVALID {
background: #ff0f00;
color: #fefefe;
}
.syntax-KEYWORD1 {
color: #190090;
font-weight: bold;
}
.syntax-KEYWORD2 {
color: #010101;
font-weight: bold;
}
.syntax-KEYWORD3 {
color: #6868fd;
font-weight: bold;
}
.syntax-KEYWORD4 {
color: #ff3900;
}
.syntax-LABEL {
color: #02b902;
}
.syntax-LITERAL1 {
color: #ae01a3;
font-style: italic;
}
.syntax-LITERAL2 {
color: #000066;
}
.syntax-LITERAL3 {
color: #cc0096;
}
.syntax-LITERAL4 {
color: #2d00ff;
}
.syntax-MARKUP {
color: #0000ff;
}
.syntax-OPERATOR {
color: #016241;
font-weight: bold;
}
--></style>
<p>Although World Editor's Jass compiler was finally replaced by PJass using WEHelper , there were
a couple of other annoyances that still needed fixing, that's the reason this project begand.</p>
<p>Later I felt like going further and restarted the idea of extending Jass to OOP thus JassHelper is a compiler for the vJass language extension which includes structs, libraries, textmacros and more.</p>
<p>Although this is not really OOP the syntax is powerful enough I hope, there is no inheritance and that's the reason I am not calling the objects classes but structs. There are however, interfaces which allow polymorphism and since they can declare attributes you can have some kind of pseudo inheritance. Pseudo inheritance can be accomplished in many ways.</p>
<p>The design of vJass ought to stay static eventually so I stop adding syntax construct cause that' the right thing to do. After version 1.0.0 there should not be any addition, so if you have requests hurry up cause it would not be healthy to change the syntax after 1.0.0.</p>
<p>Version Z.0 introduces the addition of the Zinc language to jasshelper, it is just a less verbose alternative to vJass that is also more rigid on some aspects.</p>
<h2>Table of contents</h2>
<h3>I. vJass reference:</h3>
<li>Jass syntax mods</li>
<ul>
<li><a href="#gdf">Global declaration freedom</a></li>
<li><a href="#ndf">Native declaration freedom</a></li>
<li><a href="#debp">Debug preprocessor</a></li>
<li><a href="#shadowing">Local variables shadowing</a></li>
<li><a href="#retfix">Patch 1.24 return bug false positive fixer</a></li>
</ul>
<li>Entry preprocessors</li>
<ul>
<li><a href="#import">Import external script files</a></li>
<li><a href="#zinc">Zinc</a></li>
<li><a href="#novjass">No vJass!</a></li>
</ul>
<li>Libraries and Scopes
<ul>
<li><a href="#lib">Libraries</a></li>
<li><a href="#priv">Private members, scopes</a></li>
<li><a href="#pub">Public members</a></li>
<li><a href="#nests">Nested scopes</a></li>
<li><a href="#sconst">SCOPE_PREFIX and SCOPE_PRIVATE</a></li>
<li><a href="#keyword">keyword</a></li>
</ul>
</li>
<li><a href="#textm">TextMacros</a></li>
<li>Structs and other custom types
<ul>
<li><a href="#stru">Structs</a></li>
<li><a href="#strudecl">Declaring structs</a></li>
<li><a href="#strucrest">Creating and destroying structs</a></li>
<li><a href="#strucuse">Struct usage</a></li>
<li><a href="#strucins">Instance members</a></li>
<li><a href="#strucglob">Globals of struct types</a></li>
<li><a href="#strucstat">Static members</a></li>
<li><a href="#strucpubriv">public/private structs</a></li>
<li><a href="#strucmeth">Methods</a></li>
<li><a href="#strucenc">Encapsullation</a></li>
<li><a href="#strucmethstac">Static methods</a></li>
<li><a href="#strucondes">The onDestroy method</a></li>
<li><a href="#struconini">The onInit method</a></li>
<li><a href="#interfs">Interfaces</a></li>
<li><a href="#operover">Operator making</a></li>
<li><a href="#extendstruct">Extending structs</a></li>
<li><a href="#stubmeth">Stub methods</a></li>
<li><a href="#super">super</a></li>
<li><a href="#dynarr">Dynamic arrays</a></li>
<li><a href="#arrmemb">Array members</a></li>
<li><a href="#delegat">Delegate</a></li>
<li><a href="#thistype">thistype</a></li>
<li><a href="#module">Module</a></li>
<li><a href="#funcobj">Functions as objects</a></li>
<li><a href="#funcinterf">Function interfaces</a></li>
<li><a href="#typecast">Typecast</a></li>
<li><a href="#methodname">Method function name</a></li>
<li><a href="#methodexists">Method exists</a></li>
<li><a href="#arrstruct">Array structs</a></li>
<li><a href="#keykeykey">Keys</a></li>
</ul></li>
<li>Storage space enhancements
<ul>
<li><a href="#storintro">Introduction</a></li>
<li><a href="#storarray">Sized arrays</a></li>
<li><a href="#twodarray">2D arrays</a></li>
<li><a href="#storstruct">Structs with more index space</a></li>
<li><a href="#stordyrar">Dynamic arrays with more index space</a></li>
</ul>
</li>
<li>Jass syntax extensions</li>
<ul>
<li><a href="#secolon">Colon</a></li>
<li><a href="#delicom">Delimited comments</a></li>
<li>Comma (Not implemented yet)</li>
</ul>
<li><a href="#hook">hook</a></li>
<li><a href="#inject">inject</a></li>
<li><a href="#slk">Loading structs from SLK files</a></li>
<li><a href="#opt">Script optimization</a></li>
<ul>
<li><a href="#inl">Function inlining</a></li>
</ul>
<li><a href="#ext">External tools</a></li>
<li><a href="#br">Linebreak fixer</a></li>
</ul>
<h3><a href="#inst">II. Installation</a></h3>
<ul>
<li><a href="#platplat">Supported platforms</a></li>
</ul>
<h3><a href="#usag">III. Usage</a></h3>
<ul><li><a href="#usagnewg">Newgen pack</a></li>
<li><a href="#usagcli">Command line</a>
<ul>
<li><a href="#clidebug">--debug</a></li>
<li><a href="#clinopre">--nopreprocessor</a></li>
<li><a href="#clinoop">--nooptimize</a></li>
<li><a href="#clifile">--scriptonly</a></li>
<li><a href="#cliwar">--warcity</a></li>
<li><a href="#clizinc">--zinconly</a></li>
<li><a href="#climac">--macromode</a></li>
<li><a href="#cliabout">--about</a></li>
<li><a href="#clierror">--showerrors</a></li>
<li><a href='#clicli'>clijasshelper.exe</a>
</ul>
</li>
</ul>
<h2>I. vJass reference:</h2>
<p>If you want actual instructions on how to install and use JassHelper: <a href='#installing'>skip to the usage area</a>, remember to come back here once you have it installed so you can actually take advantage of this solution.</p>
<h3><a name="gdf"></a>Global declaration Freedom</h3>
<p>Warcraft III world editor always made everything harder for us, inluding declaring globals, you
needed to use that dialog and it was really difficult to recreate global variables from a map or
another and you were forced to use GUI for that. It was also impossible to declare globals of some types
without modding world editor and then make your map completelly unopenable by normal world editor.</p>
<p>Global declaration freedom simply allows you to write globals blocks wherever you want, for example
in the custom script section or in a 'trigger', and because of this you can even use the constant
prefix which can even make finalizers able to inline constants and stuff.</p>
<p>The JassHelper preprocessor will simply merge all the global blocks found around the map script and move
them to the top of the map, all merged in a single globals block.</p>
<pre><span class="syntax0"><span class="syntax-KEYWORD2">function</span> something <span class="syntax-KEYWORD2">takes</span> <span class="syntax-KEYWORD3">nothing</span> <span class="syntax-KEYWORD2">returns</span> <span class="syntax-KEYWORD3">nothing</span>
<span class="syntax-KEYWORD1">set</span> somearray<span class="syntax-OPERATOR">[</span>SOMETHING_INDEX<span class="syntax-OPERATOR">]</span><span class="syntax-OPERATOR">=</span><span class="syntax-DIGIT">4</span>
<span class="syntax-KEYWORD2">endfunction</span>
<span class="syntax-KEYWORD2">globals</span>
<span class="syntax-KEYWORD2">constant</span> <span class="syntax-KEYWORD3">integer</span> SOMETHING_INDEX <span class="syntax-OPERATOR">=</span> <span class="syntax-DIGIT">45</span>
<span class="syntax-KEYWORD3">integer</span> <span class="syntax-KEYWORD3">array</span> somearray
<span class="syntax-KEYWORD2">endglobals</span>
</span></pre>
<p>Will now work without any error, there is one limitation though, you can't use functions or
non-constant values in the default value, for example you can make a global start on null, 1 ,
19923 , 0xFFF, true, false, "Hi" , etc. But you can't make them initialize with any function call
or with a native (although it is possible to use a native, most natives tend to crash the thread
when used in globals declaration). You can't also assign to another global variable, because there
isn't really a way to control to what position of the map would a global declaration go.</p>
<h4>Notes:</h4>
<ul><li>Please try to keep a good global naming method, some programs use pure caps for global names,
Jass' standard set by common.j and blizzard.j is that constants should be uppercase, you can then
use system_variable for a good variable name, although you can stick to the udg_ preffix as well.</li></ul>
<h3><a name="ndf"></a>Native declaration Freedom</h3>
<p>This feature (added in 0.9.I.0) is similar to global declarations, but it is for more advanced users, so if you do not understand a single thing of these few paragraphs, feel free to skip to the explanation about the debug keyword. Warcraft III supports declaration of natives in the map script, but it requires the natives to be declared just after the script's globals section. Jasshelper will detect these declarations along the map and move them to the correct place.</p>
<p>Why would you want to do this? And what native functions exactly? There are some few native functions that were created for AI scripts that are not declared in common.j, some of them are actually useful for Jass maps. There is also the possibility you are using a modded/hacked version of warcraft III, and importing a whole new common.j for the native functions is probably too annoying for you, in this case you can declare the new custom functions in the map as well.</p>
<p>There is a protection in this feature that will make jasshelper delete declarations of duplicate natives. (i.e if the native was already declared in common.j, it will remove the native from the map script, to ensure your map is actually playable). This heavily depends on the common.j version provided to jasshelper. This is something to consider if for some reason the common.j version you (or newgen pack) is passing to jasshelper is different to the common.j version you intend the map to be playable with.</p>
<pre><span class="syntax0"><span class="syntax-KEYWORD2">native</span> GetUnitGoldCost <span class="syntax-KEYWORD2">takes</span> <span class="syntax-KEYWORD3">integer</span> unitid <span class="syntax-KEYWORD2">returns</span> <span class="syntax-KEYWORD3">integer</span>
<span class="syntax-KEYWORD2">function</span> test <span class="syntax-KEYWORD2">takes</span> <span class="syntax-KEYWORD3">nothing</span> <span class="syntax-KEYWORD2">returns</span> <span class="syntax-KEYWORD3">nothing</span>
<span class="syntax-KEYWORD1">call</span> <span class="syntax-FUNCTION">BJDebugMsg</span><span class="syntax-OPERATOR">(</span><span class="syntax-LITERAL1">"</span><span class="syntax-LITERAL1">A</span><span class="syntax-LITERAL1"> </span><span class="syntax-LITERAL1">footman</span><span class="syntax-LITERAL1"> </span><span class="syntax-LITERAL1">consts</span><span class="syntax-LITERAL1"> </span><span class="syntax-LITERAL1">:</span><span class="syntax-LITERAL1"> </span><span class="syntax-LITERAL1">"</span><span class="syntax-OPERATOR">+</span><span class="syntax-KEYWORD4">I2S</span><span class="syntax-OPERATOR">(</span> GetUnitGoldCost<span class="syntax-OPERATOR">(</span><span class="syntax-LITERAL1">'hfoo'</span><span class="syntax-OPERATOR">)</span><span class="syntax-OPERATOR">+</span><span class="syntax-LITERAL1">"</span><span class="syntax-LITERAL1"> </span><span class="syntax-LITERAL1">gold</span><span class="syntax-LITERAL1"> </span><span class="syntax-LITERAL1">coins</span><span class="syntax-LITERAL1">"</span> <span class="syntax-OPERATOR">)</span> <span class="syntax-OPERATOR">)</span>
<span class="syntax-KEYWORD2">endfunction</span>
</span></pre>
<h3><a name="debp"></a>Debug preprocessor</h3>
<p>Jass includes a debug keyword which compiles correctly but makes the rest of the code be
ignored. It seemed this keyword was used for debugging purposes like a switch in a debug build
of warcraft III that enabled those calls.</p>
<p>We can now take advantage of this hidden Jass feature. Saving a map in debug mode using
JassHelper will simply remove the debug keyword so the calls are enabled, if debug mode is not
enabled, JassHelper will remove the lines that begin with debug.</p>
<pre><span class="syntax0"><span class="syntax-KEYWORD2">function</span> Something <span class="syntax-KEYWORD2">takes</span> <span class="syntax-KEYWORD3">integer</span> a <span class="syntax-KEYWORD2">returns</span> <span class="syntax-KEYWORD3">nothing</span>
<span class="syntax-KEYWORD1">debug</span> <span class="syntax-KEYWORD1">call</span> <span class="syntax-FUNCTION">BJDebugMsg</span><span class="syntax-OPERATOR">(</span><span class="syntax-LITERAL1">"</span><span class="syntax-LITERAL1">a</span><span class="syntax-LITERAL1"> </span><span class="syntax-LITERAL1">is</span><span class="syntax-LITERAL1"> </span><span class="syntax-LITERAL1">"</span><span class="syntax-OPERATOR">+</span><span class="syntax-KEYWORD4">I2S</span><span class="syntax-OPERATOR">(</span>a<span class="syntax-OPERATOR">)</span><span class="syntax-OPERATOR">)</span>
<span class="syntax-KEYWORD1">call</span> KillNUnits<span class="syntax-OPERATOR">(</span>a<span class="syntax-OPERATOR">)</span>
<span class="syntax-KEYWORD2">endfunction</span>
</span></pre>
<p>If we use this function in a map saved with debug mode, we will see "a is value" each time this
function is called, otherwise it will only call KillNUnits silently.</p>
<p>You may also use the constant boolean DEBUG_MODE which is set to true or false depending on whether the debug mode is enabled.</p>
<h3><a name="shadowing"></a>Local variables shadowing</h3>
<p>Starting with version 0.9.K.0, local variable shadowing is part of vJass syntax, unlike Jass syntax in which it has always been a problem. Up to patch 1.24, it was not even possible to shadow more than one variable, and it turned the whole map script into case-insensitive. These glitches were apparently fixed around patch 1.24, but they were fixed barely to a level of helping GUI users do local var tricks. Issues persist, and the issues are of the kind that could eventually cause some scripts issues in unpredictable places.</p>
<p>If the vJass code is used correctly and things are correctly scoped, this should not be a problem. However, when using code from multiple places, one of the codes may not be correctly scoped, which threatens to cause a conflict with a local variable and thus then making your map mysteriously unopenable in wc3. Jass' weakness with variable shadowing was too unpredictable in nature. So I decided to add a small preprocessor phase to jasshelper that will simulate correct local variable shadowing. This means that the local variables in your functions may now have the same name as any global in the map (even globals you do not know about) without causing further issues or unknown, unpredictable bugs (unlike normal Jass in which this is an active possibility). Although the vJass code allows variable shadowing, it is compiled to Jass code in which there is no shadowing (some l__ prefixes are added to conflicting local variables).</p>
<h3><a name="retfix"></a>Patch 1.24 return bug false positive fixer</h3>
<p><b>Note:</b> This feature is disabled by default as the problems were fixed by patch 1.24b. </p>
<p>Retail patch 1.24 brought a lot of doom and destruction to the world of Jass, thanks to some new blizzard bugs, certain functions with more than one return statement would silent cause syntax errors or crash the game, effectively making innocent maps unplayable, even if they do not use the now infamous &aquot;Return bug exploiters&aquot;. This was the reason, that I had to add a quick fix to jasshelper, this compiler mod will replace all your functions with multiple return values into two separate functions that will be safe from the false positive.</p>
<h4>Side effects and limitations </h4>
<p>This fixer is only meant as a temporary measure while blizzard fixes this terrible bug or while you make your functions safe from having multiple return statements, whatever happens first. The technique is a little dumb, for each function that is suspect, it will create a new dummy one that returns nothing, and just assigns a global before returning, then the old function will actually call this dummy function. In short words, this means that this fixer will make calling certain functions (specifically those that have a return value and more than 1 return statements) slightly slower by adding an extra function call.</p>
<p>This method does not work correctly with recursive functions (as it is still not possible to call a function from above its declaration). It is likely that if a function is recursive and has multiple return statements, it will cause a compiler error. In this case, it is better to modify the function, as it is most likely also a return bug false positive (so it probably causes your map to be unplayable in patch 1.24). To prevent this, jasshelper will try to detect the recursion, and if possible, take care of it. But there are some recursion patterns that jasshelper cannot fix at this moment.</p>
<h4>Enabling the return fixer</h4>
<p>This feature must be manually enabled, so if you for some reason need to make your map work specifically with patch 1.24, or if maybe you think that some return bug false positive is still affecting your map, you can enable the feature.</p>
<p>In order to enable the return fixer, take jasshelper.conf and replace [noreturnfixer] with [doreturnfixer] if there is no tag [noreturnfixer] in jasshelper.conf, then simply add the [doreturnfixer] tag to it.</p>
<h3><a name='import'></a>Import external script files</h3>
<p>JassHelper also includes a //! import preprocessor like WEHelper's, it allows you to import external files.</p>
<p>The usage is //! import "scriptfile" , you can use fixed paths or relative paths.</p>
<p>For example: //! import "c:\x.j" will include x.j file located on c:\ in your map script. It is effectively like pasting the file there before compiling it, so the file can include globals, libraries, textmacros, etc. It can even use //! import itself</p>
<p>If you use //! import twice or more on the same file name , the command is ignored.</p>
<p>Relative paths are allowed, for example: //! import "x.j" or //! import "subfolder\f.j" will use relative paths. When the path is relative JassHelper will look for the script file in the map's folder or in the lookup folders set in JassHelper's configuration.</p>
<p>Grimoire's version uses jasshelper.conf to determine the lookup folders, WEHelper's version comes with a dialog that allows you to set them. Also the version for WEHelper will automatically add wehelper's import path to the lookup folders list.</p>
<p>WEHelper's internal import preprocessor is most likely to override JassHelper's import since the default is to call it before JassHelper, in case you want to use JassHelper's import you would have to disable WEHelper's, the only advantage the jasshelper one has over the wehelper one is the ability to configure lookup folders.</p>
<p>Grimoire's jassehlper.conf already determines grimoire' Jass folder as a position of scripts. You can add whatever folders you find necessary. Notice that there is a priority system, if a file is found on the map's folder it will be imported no matter the same file exists in another folder used in jasshelper.conf</p>
<p>There is a problem with using the map's folder and it is that testmap saves the map in another path. So you would preffer to use custom paths for this option.</p>
<p>Test map is often problematic with this kind of features. The best way to deal with this is to ALWAYS SAVE BEFORE USING TESTMAP, this will force the map to go to its path and then will use it for testmap, in case you need to test temporary changes, you can save it with another name in the same folder and then do testmap.</p>
<p>As of jasshelper 0.9.C.0 , relative paths used by import an already-imported file will be able to also support the file's path as possible container. Notice that the files in the same folder as the current file have priority over files on the configured paths or even the map's location.</p>
<p>import syntax has been extended to have an extra script type option:</p>
<p>//! import <b>vjass/zinc/comment</b> "filename"</p>
<p>vjass is assumed to be the default. zinc makes the file to be considered a zinc script. comment makes the import command get ignored unless we compile under the warcity mode.</p>
<h3><a name='zinc'></a>Zinc</h3>
<p>Jasshelper supports two scripting languages, vJass and Zinc. vJass is an extension to wc3's JASS, while Zinc is a less verbose language that is more rigid in certain aspects and also has control structures and things not well compatible with JASS.
<p>For more info on the Zinc language and its syntax please refer to the other file, <a href='zincmanual.html'>Zinc manual</a></p>
<h3><a name='novjass'></a>No vjass!</h3>
<p>The //! novjass and //! endnovjass preprocessor directives allow you to make vjass compilers (like jasshelper) completely ignore the code between them.</p>
<!-- gVim can suck it, jEdit's HTML plugin pwns it in every conceivable way -->
<pre><span class="syntax0"> <span class="syntax-KEYWORD2">function</span> VerifyVJass <span class="syntax-KEYWORD2">takes</span> <span class="syntax-KEYWORD3">nothing</span> <span class="syntax-KEYWORD2">returns</span> <span class="syntax-KEYWORD3">nothing</span>
<span class="syntax-KEYWORD1">local</span> <span class="syntax-KEYWORD3">boolean</span> b<span class="syntax-OPERATOR">=</span><span class="syntax-LITERAL2">true</span>
<span class="syntax-COMMENT3">//! novjass</span>
<span class="syntax-KEYWORD1">set</span> b<span class="syntax-OPERATOR">=</span><span class="syntax-LITERAL2">false</span>
<span class="syntax-COMMENT3">//! endnovjass</span>
<span class="syntax-KEYWORD1">if</span><span class="syntax-OPERATOR">(</span>b<span class="syntax-OPERATOR">)</span> <span class="syntax-KEYWORD1">then</span>
<span class="syntax-KEYWORD1">call</span> <span class="syntax-FUNCTION">BJDebugMsg</span><span class="syntax-OPERATOR">(</span><span class="syntax-LITERAL1">"</span><span class="syntax-LITERAL1">You</span><span class="syntax-LITERAL1"> </span><span class="syntax-LITERAL1">got</span><span class="syntax-LITERAL1"> </span><span class="syntax-LITERAL1">vJass</span><span class="syntax-LITERAL1">"</span><span class="syntax-OPERATOR">)</span>
<span class="syntax-KEYWORD1">else</span>
<span class="syntax-KEYWORD1">call</span> <span class="syntax-FUNCTION">BJDebugMsg</span><span class="syntax-OPERATOR">(</span><span class="syntax-LITERAL1">"</span><span class="syntax-LITERAL1">Where</span><span class="syntax-LITERAL1">'</span><span class="syntax-LITERAL1">s</span><span class="syntax-LITERAL1"> </span><span class="syntax-LITERAL1">vJass</span><span class="syntax-LITERAL1">?</span><span class="syntax-LITERAL1">"</span><span class="syntax-OPERATOR">)</span>
<span class="syntax-KEYWORD1">endif</span>
<span class="syntax-KEYWORD2">endfunction</span>
</span></pre>
<p>If that code is parsed by a vJass compiler, it will remove what is inside the //! novjass blocks. If the function is just saved in normal World Editor, it will just ignore the //! novjass tags (since it will think they are comments) so it will still consider their contents.</p>
<h3><a name='lib'></a>Libraries</h3>
<p>Yet another issue with World editor and Jass was that it is impossible to control the order of
triggers in the map's script when saved. The custom script partially solved the problem but it is
really problematic to ask users to paste things there, it is also anti-modular programming to keep
it full of unrelated stuff.</p>
<p>The library preprocessor allows you to keep your top functions in the top and being able to
control where each one goes. It also has an smart requirement support so it will sort the function
packs for you.</p>
<p>The syntax is simple, you use <b>library</b> LIBRARYNAME
or <b>library</b> LIBRARYNAME <b>requires</b> ONEREQUIREMENT or <b>library</b> LIBRARYNAME <b>requires</b> REQ1, REQ2 ...</p>
<p>Remember to mark the end of a library using the <b>endlibrary</b> keyword .</p>
<pre><span class="syntax0"><span class="syntax-KEYWORD2">library</span> B
<span class="syntax-KEYWORD2">function</span> Bfun <span class="syntax-KEYWORD2">takes</span> <span class="syntax-KEYWORD3">nothing</span> <span class="syntax-KEYWORD2">returns</span> <span class="syntax-KEYWORD3">nothing</span>
<span class="syntax-KEYWORD2">endfunction</span>
<span class="syntax-KEYWORD2">endlibrary</span>
<span class="syntax-KEYWORD2">library</span> A
<span class="syntax-KEYWORD2">function</span> Afun <span class="syntax-KEYWORD2">takes</span> <span class="syntax-KEYWORD3">nothing</span> <span class="syntax-KEYWORD2">returns</span> <span class="syntax-KEYWORD3">nothing</span>
<span class="syntax-KEYWORD2">endfunction</span>
<span class="syntax-KEYWORD2">endlibrary</span>
</span></pre>
<p>If JassHelper finds this command, it will make sure to move the Afun and Bfun functions to the top of the map's script, so the rest of the map's script can freely call Afun() or Bfun().</p>
<p>Notice that it would be uncertain to know what would happen if Afun() was called from a
function inside the B library. The command is to move libraries to the top, but we wouldn't
know if B went before or after A.</p>
<p>If a function inside library B needed to call a function inside library A we should let
JassHelper know that A must be added before B. That's the reason the 'requires' keyword exists:</p>
<pre><span class="syntax0"> <span class="syntax-KEYWORD2">library</span> C <span class="syntax-KEYWORD2">requires</span> A<span class="syntax-OPERATOR">,</span> B<span class="syntax-OPERATOR">,</span> D
<span class="syntax-KEYWORD2">function</span> Cfun <span class="syntax-KEYWORD2">takes</span> <span class="syntax-KEYWORD3">nothing</span> <span class="syntax-KEYWORD2">returns</span> <span class="syntax-KEYWORD3">nothing</span>
<span class="syntax-KEYWORD1">call</span> Afun<span class="syntax-OPERATOR">(</span><span class="syntax-OPERATOR">)</span>
<span class="syntax-KEYWORD1">call</span> Bfun<span class="syntax-OPERATOR">(</span><span class="syntax-OPERATOR">)</span>
<span class="syntax-KEYWORD1">call</span> Dfun<span class="syntax-OPERATOR">(</span><span class="syntax-OPERATOR">)</span>
<span class="syntax-KEYWORD2">endfunction</span>
<span class="syntax-KEYWORD2">endlibrary</span>
<span class="syntax-KEYWORD2">library</span> D
<span class="syntax-KEYWORD2">function</span> Dfun <span class="syntax-KEYWORD2">takes</span> <span class="syntax-KEYWORD3">nothing</span> <span class="syntax-KEYWORD2">returns</span> <span class="syntax-KEYWORD3">nothing</span>
<span class="syntax-KEYWORD2">endfunction</span>
<span class="syntax-KEYWORD2">endlibrary</span>
<span class="syntax-KEYWORD2">library</span> B <span class="syntax-KEYWORD2">requires</span> A
<span class="syntax-KEYWORD2">function</span> Bfun <span class="syntax-KEYWORD2">takes</span> <span class="syntax-KEYWORD3">nothing</span> <span class="syntax-KEYWORD2">returns</span> <span class="syntax-KEYWORD3">nothing</span>
<span class="syntax-KEYWORD1">call</span> Afun<span class="syntax-OPERATOR">(</span><span class="syntax-OPERATOR">)</span>
<span class="syntax-KEYWORD2">endfunction</span>
<span class="syntax-KEYWORD2">endlibrary</span>
<span class="syntax-KEYWORD2">library</span> A
<span class="syntax-KEYWORD2">function</span> Afun <span class="syntax-KEYWORD2">takes</span> <span class="syntax-KEYWORD3">nothing</span> <span class="syntax-KEYWORD2">returns</span> <span class="syntax-KEYWORD3">nothing</span>
<span class="syntax-KEYWORD2">endfunction</span>
<span class="syntax-KEYWORD2">endlibrary</span>
</span></pre>
<p><b>Note: </b> For senseless reasons: <b>requires</b>, <b>needs</b> and <b>uses</b> all work correctly and have the same function in the library syntax, but please use requires, the other ones may be gone one day...</p>
<p>The result in the top of the map would be:</p>
<pre><span class="syntax0"> <span class="syntax-KEYWORD2">function</span> Afun <span class="syntax-KEYWORD2">takes</span> <span class="syntax-KEYWORD3">nothing</span> <span class="syntax-KEYWORD2">returns</span> <span class="syntax-KEYWORD3">nothing</span>
<span class="syntax-KEYWORD2">endfunction</span>
<span class="syntax-KEYWORD2">function</span> Dfun <span class="syntax-KEYWORD2">takes</span> <span class="syntax-KEYWORD3">nothing</span> <span class="syntax-KEYWORD2">returns</span> <span class="syntax-KEYWORD3">nothing</span>
<span class="syntax-KEYWORD2">endfunction</span>
<span class="syntax-KEYWORD2">function</span> Bfun <span class="syntax-KEYWORD2">takes</span> <span class="syntax-KEYWORD3">nothing</span> <span class="syntax-KEYWORD2">returns</span> <span class="syntax-KEYWORD3">nothing</span>
<span class="syntax-KEYWORD1">call</span> Afun<span class="syntax-OPERATOR">(</span><span class="syntax-OPERATOR">)</span>
<span class="syntax-KEYWORD2">endfunction</span>
<span class="syntax-KEYWORD2">function</span> Cfun <span class="syntax-KEYWORD2">takes</span> <span class="syntax-KEYWORD3">nothing</span> <span class="syntax-KEYWORD2">returns</span> <span class="syntax-KEYWORD3">nothing</span>
<span class="syntax-KEYWORD1">call</span> Afun<span class="syntax-OPERATOR">(</span><span class="syntax-OPERATOR">)</span>
<span class="syntax-KEYWORD1">call</span> Bfun<span class="syntax-OPERATOR">(</span><span class="syntax-OPERATOR">)</span>
<span class="syntax-KEYWORD1">call</span> Dfun<span class="syntax-OPERATOR">(</span><span class="syntax-OPERATOR">)</span>
<span class="syntax-KEYWORD2">endfunction</span>
</span></pre>
<p>Well, not necessarily. It would depend on the order WE saves the scripts in the input file, if two libraries do not require each other, then they may get added on a random order depending on the order in which they are
declared in the map. It is always a good idea to require the libraries you are going to use in your library.</p>
<p>Make sure to remember that:</p>
<ul><li>Library names are Case Sensitive.</li>
<li>If library A requires library B and library B requires library A , there's a cycle and JassHelper will popup a syntax error.</li>
<li>If library A requires a library that requires B and library B requires A, the cycle is still there.</li>
<li>You can't nest libraries.</li>
<li>Libraries might have globals blocks, as of version 0.9.B.0 library requirements determine the order in which these variables are added, notice that this warranty does not exist in prior versions.</li></ul>
<p>It is also difficult to control what code is executed first, that's the reason libraries also
have an initializer keyword, you can add initializer FUNCTION_NAME after the name of a library and
it will make it be executed with priority using ExecuteFunc , ExecuteFunc is forced so it uses another
thread, most libraries require heavy operations on init so we better prevent the init thread from
crashing. After the initializer keyword the 'needs' statement might be used as well.</p>
<p>The initializers are added to the script in the same order libraries are added. So if library A
needs B and both have initializers then B's inititalizer will be called before A's.</p>
<p>Notice the initializer must be a function that takes nothing .</p>
<pre><span class="syntax0"> <span class="syntax-KEYWORD2">library</span> A <span class="syntax-KEYWORD2">initializer</span> InitA <span class="syntax-KEYWORD2">requires</span> B
<span class="syntax-KEYWORD2">function</span> InitA <span class="syntax-KEYWORD2">takes</span> <span class="syntax-KEYWORD3">nothing</span> <span class="syntax-KEYWORD2">returns</span> <span class="syntax-KEYWORD3">nothing</span>
<span class="syntax-KEYWORD1">call</span> <span class="syntax-KEYWORD4">StoreInteger</span><span class="syntax-OPERATOR">(</span>B_gamecache <span class="syntax-OPERATOR">,</span> <span class="syntax-LITERAL1">"</span><span class="syntax-LITERAL1">a_rect</span><span class="syntax-LITERAL1">"</span> <span class="syntax-OPERATOR">,</span> <span class="syntax-KEYWORD4">Rect</span><span class="syntax-OPERATOR">(</span><span class="syntax-OPERATOR">-</span><span class="syntax-DIGIT">100.0</span> <span class="syntax-OPERATOR">,</span> <span class="syntax-DIGIT">100.0</span> <span class="syntax-OPERATOR">,</span> <span class="syntax-OPERATOR">-</span><span class="syntax-DIGIT">100.0</span> <span class="syntax-OPERATOR">,</span> <span class="syntax-DIGIT">100</span> <span class="syntax-OPERATOR">)</span> <span class="syntax-OPERATOR">)</span>
<span class="syntax-KEYWORD2">endfunction</span>
<span class="syntax-KEYWORD2">endlibrary</span>
<span class="syntax-KEYWORD2">library</span> B <span class="syntax-KEYWORD2">initializer</span> InitB
<span class="syntax-KEYWORD2">globals</span>
<span class="syntax-KEYWORD3">gamecache</span> B_gamecache
<span class="syntax-KEYWORD2">endglobals</span>
<span class="syntax-KEYWORD2">function</span> InitB <span class="syntax-KEYWORD2">takes</span> <span class="syntax-KEYWORD3">nothing</span> <span class="syntax-KEYWORD2">returns</span> <span class="syntax-KEYWORD3">nothing</span>
<span class="syntax-KEYWORD1">set</span> B_gamecache<span class="syntax-OPERATOR">=</span><span class="syntax-KEYWORD4">InitGameCache</span><span class="syntax-OPERATOR">(</span><span class="syntax-LITERAL1">"</span><span class="syntax-LITERAL1">B</span><span class="syntax-LITERAL1">"</span><span class="syntax-OPERATOR">)</span>
<span class="syntax-KEYWORD2">endfunction</span>
<span class="syntax-KEYWORD2">endlibrary</span>
</span></pre>
<p>B's initializer will be called on init before A's initializer.</p>
<p><b>Hints:</b><ul><li> The <b>library_once</b> keyword works exactly like <b>library</b> but you can declare the same library name twice, it would just ignore the second declaration and avoid to add its contents instead of showing a syntax error, it is useful in combination with textmacros.</li>
<li> Older versions of vJass had a different syntax for libraries, that started with //! this was eventually deprecated and will now pop a syntax error out.
</ul></p>
<p><b>Hints:</b> As of 0.9.Z.0, the declaration of a library will create a true boolean constant called LIBRARY_libraryname. Requirements may also be optional (prefix an <b>optional</b> keyword before the requirement name) which means that the library will be moved bellow that requirement, but if the requirement is not found, no syntax error will appear. These may be useful with another new 0.9.Z.0 feature: static ifs.</p>
<h3><a name='staticif'></a>Static ifs</h3>
<p>static ifs are like normal ifs, except that a) the condition must contain only constant booleans, the <b>and</b> operator and the <b>not</b> operator and b) They are evaluated during compile time. Which means that the code that is not matched to its condition is simply ignored.</p>
<pre><span class="syntax0"> <span class="syntax-KEYWORD2">library</span> OptionalCode <span class="syntax-KEYWORD2">requires</span> <span class="syntax-KEYWORD2">optional</span> UnitKiller
<span class="syntax-KEYWORD2">globals</span>
<span class="syntax-KEYWORD2">constant</span> <span class="syntax-KEYWORD3">boolean</span> DO_KILL_LIB <span class="syntax-OPERATOR">=</span> <span class="syntax-LITERAL2">true</span>
<span class="syntax-KEYWORD2">endglobals</span>
<span class="syntax-KEYWORD2">function</span> fun <span class="syntax-KEYWORD2">takes</span> <span class="syntax-KEYWORD3">nothing</span> <span class="syntax-KEYWORD2">returns</span> <span class="syntax-KEYWORD3">nothing</span>
<span class="syntax-KEYWORD1">local</span> <span class="syntax-KEYWORD3">unit</span> u <span class="syntax-OPERATOR">=</span> <span class="syntax-KEYWORD4">GetTriggerUnit</span><span class="syntax-OPERATOR">(</span><span class="syntax-OPERATOR">)</span>
<span class="syntax-COMMENT2">//</span><span class="syntax-COMMENT2">the</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">following</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">code</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">may</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">need</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">to</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">kill</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">the</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">unit</span>
<span class="syntax-COMMENT2">//</span><span class="syntax-COMMENT2">but</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">is</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">alternatively</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">able</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">to</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">use</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">the</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">external</span>
<span class="syntax-COMMENT2">//</span><span class="syntax-COMMENT2">'UnitKiller'</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">library</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">to</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">do</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">the</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">library.</span>
<span class="syntax-COMMENT2">//</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">ONLY</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">when</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">DO_KILL_LIB</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">is</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">true</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">AND</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">the</span>
<span class="syntax-COMMENT2">//</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">library</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">UnitKiller</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">is</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">in</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">the</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">map.</span>
<span class="syntax-KEYWORD2">static</span> <span class="syntax-KEYWORD1">if</span> DO_KILL_LIB <span class="syntax-OPERATOR">and</span> LIBRARY_UnitKiller <span class="syntax-KEYWORD1">then</span>
<span class="syntax-COMMENT2">//</span><span class="syntax-COMMENT2">static</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">if</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">because</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">if</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">the</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">UnitKiller</span>
<span class="syntax-COMMENT2">//</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">library</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">was</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">not</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">in</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">the</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">map,</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">using</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">a</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">normal</span>
<span class="syntax-COMMENT2">//</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">if</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">would</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">not</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">remove</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">this</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">line</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">of</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">code</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">and</span>
<span class="syntax-COMMENT2">//</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">therefore</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">it</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">would</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">cause</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">a</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">syntax</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">error.</span>
<span class="syntax-COMMENT2">//</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">(unable</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">to</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">find</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">function</span><span class="syntax-COMMENT2"> </span><span class="syntax-COMMENT2">UnitKiller)</span>
<span class="syntax-KEYWORD1">call</span> UnitKiller<span class="syntax-OPERATOR">(</span>u<span class="syntax-OPERATOR">)</span>
<span class="syntax-KEYWORD1">else</span>
<span class="syntax-KEYWORD1">call</span> <span class="syntax-KEYWORD4">KillUnit</span><span class="syntax-OPERATOR">(</span>u<span class="syntax-OPERATOR">)</span>
<span class="syntax-KEYWORD1">endif</span>
<span class="syntax-KEYWORD2">endfunction</span>
<span class="syntax-KEYWORD2">endlibrary</span>
<span class="syntax-KEYWORD2">library</span> UnitKiller
<span class="syntax-KEYWORD2">function</span> UnitKiller<span class="syntax-OPERATOR">(</span><span class="syntax-KEYWORD3">unit</span> u<span class="syntax-OPERATOR">)</span>
<span class="syntax-KEYWORD1">call</span> <span class="syntax-FUNCTION">BJDebugMsg</span><span class="syntax-OPERATOR">(</span><span class="syntax-LITERAL1">"</span><span class="syntax-LITERAL1">Unit</span><span class="syntax-LITERAL1"> </span><span class="syntax-LITERAL1">kill</span><span class="syntax-LITERAL1">!</span><span class="syntax-LITERAL1">"</span><span class="syntax-OPERATOR">)</span>
<span class="syntax-KEYWORD1">call</span> <span class="syntax-KEYWORD4">KillUnit</span><span class="syntax-OPERATOR">(</span>u<span class="syntax-OPERATOR">)</span>
<span class="syntax-KEYWORD2">endfunction</span>
<span class="syntax-KEYWORD2">endfunction</span>
</span></pre>
<h3><a name='priv'></a>Private members</h3>
<p>With the adition of libraries it was a good idea to add some scope control, private members are a great way of protecting users from themselves and to avoid collisions.</p>
<pre><font color="#000000"><b>library</b></font> <span style="background-color: #ffffff"><font color="#000000">privatetest</font></span>
<font color="#000000"><b>globals</b></font>
<font color="#000000"><b>private</b></font> <font color="#7777cc"><b>integer</b></font> <span style="background-color: #ffffff"><font color="#000000">N</font></span>=<font color="#000066">0</font>
<font color="#000000"><b>endglobals</b></font>
<font color="#000000"><b>private</b></font> <font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">x</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>set</b></font> <span style="background-color: #ffffff"><font color="#000000">N</font></span>=<span style="background-color: #ffffff"><font color="#000000">N</font></span>+<font color="#000066">1</font>
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">privatetest</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">x</font></span>()
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">x</font></span>()
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>endlibrary</b></font>
<font color="#000000"><b>library</b></font> <span style="background-color: #ffffff"><font color="#000000">otherprivatetest</font></span>
<font color="#000000"><b>globals</b></font>
<font color="#000000"><b>private</b></font> <font color="#7777cc"><b>integer</b></font> <span style="background-color: #ffffff"><font color="#000000">N</font></span>=<font color="#000066">5</font>
<font color="#000000"><b>endglobals</b></font>
<font color="#000000"><b>private</b></font> <font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">x</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>set</b></font> <span style="background-color: #ffffff"><font color="#000000">N</font></span>=<span style="background-color: #ffffff"><font color="#000000">N</font></span>+<font color="#000066">1</font>
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">otherprivatetest</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">x</font></span>()
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">x</font></span>()
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>endlibrary</b></font>
</pre>
<p>Notice how both libraries have private globals and functions with the same names, this wouldn't cause any syntax errors since the private preprocessor will make sure that private members are only available for that scope and don't conflict with things named the same present in other scopes. In this case private members are only to be used by the libraries in which they are declared.</p>
<p>Sometimes, you don't want the code to go to the top of your script (it is not really a function library) yet you' still want to use the private keyword for a group of globals and functions. This is the reason we defined the <b>scope</b> keyword</p>
<p>The <b>scope</b> keyword has this syntax: <b>scope</b> NAME [...script block...] <b>endscope</b></p>
<p>So, functions and other declarations inside an scope can freely use the private members of the scope, but code outside won't be able to. (Notice that a library is to be considered to have an internal scope with its name)</p>
<p>There are many applications for this feature:</p>
<pre>
<font color="#000000"><b>scope</b></font> <span style="background-color: #ffffff"><font color="#000000">GetUnitDebugStr</font></span>
<font color="#000000"><b>private</b></font> <font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">H2I</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>handle</b></font> <span style="background-color: #ffffff"><font color="#000000">h</font></span> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>integer</b></font>
<font color="#000000"><b>return</b></font> <span style="background-color: #ffffff"><font color="#000000">h</font></span>
<font color="#000000"><b>return</b></font> <font color="#000066">0</font>
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">GetUnitDebugStr</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>unit</b></font> <span style="background-color: #ffffff"><font color="#000000">u</font></span> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>string</b></font>
<font color="#000000"><b>return</b></font> <span style="background-color: #ffffff"><font color="#000000">GetUnitName</font></span>(<span style="background-color: #ffffff"><font color="#000000">u</font></span>)+<font color="#0000cc"><i>"_"</i></font>+<span style="background-color: #ffffff"><font color="#000000">I2S</font></span>(<span style="background-color: #ffffff"><font color="#000000">H2I</font></span>(<span style="background-color: #ffffff"><font color="#000000">u</font></span>))
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>endscope</b></font>
</pre>
<p>In this case, the function uses H2I, but H2I is a very common function name, so there could be conflicts with other scripts that might declare it as well, you could add a whole preffix to the H2I function yourself, or make the function a library that requires another library H2I, but that can be sometimes too complicated, by using an scope and private you can freely use H2I in that function without worrying. It doesn' matter if another H2I is declared elsewhere and it is not a private function, private also makes the scope keep a priority for its members.</p>
<p>It is more important for globals because if you make a function pack you might want to disallow direct access to globals but just allow access to some functions, to keep a sense of encapsullation, for example.</p>
<p>The way private work is actually by automatically prefixing scopename(random digit)__ to the identifier names of the private members. The random digit is a way to let it be truly private so people can not even use them by adding the preffix themselves. A double _ is used because we decided that it is the way to recognize preprocessor-generated variables/functions, so you should avoid to use double __ in your human-declarated identifier names. Being able to recognize preprocessor-generated identifiers is useful when reading the output file (for example when PJass returns syntax errors).</p>
<p>In order to use private members ExecuteFunc or real value change events you have to use SCOPE_PRIVATE (see bellow)</p>
<p><b>Hint:</b>Scopes support <b>initializer</b> just like libraries, there is a difference in implementation and it is that they use a normal call rather than an ExecuteFunc call, if you need a heavy process to init a scope, better use a library initializer or call a subfunction using ExecuteFunc from the scope initializer.</p>
<p><b>Note:</b>In a similar way to libraries, scopes used to have a syntax that required //! , that old syntax is deprecated and will cause a syntax error.</p>
<h3><a name='pub'></a>Public members</h3>
<p>Public members are closely related to private members in that they do mostly the same, the difference is that public members don't get their names randomized, and can be used outside the scope. For a variable/function declared as public in an scope called SCP you can just use the declared function/variable name inside the scope, but to use it outside of the scope you call it with an SCP_ preffix.</p>
<p>An example should be easier to understand:</p>
<pre>
<font color="#000000"><b>library</b></font> <span style="background-color: #ffffff"><font color="#000000">cookiesystem</font></span>
<font color="#000000"><b>public</b></font> <font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">ko</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">BJDebugMsg</font></span>(<font color="#0000cc"><i>"a"</i></font>)
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">thisisnotpublicnorprivate</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">ko</font></span>()
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">cookiesystem_ko</font></span>() <font color="#008800">//cookiesystem_ preffix is optional</font>
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>endlibrary</b></font>
<font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">outside</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">cookiesystem_ko</font></span>() <font color="#008800">//cookiesystem_ preffix is required</font>
<font color="#000000"><b>endfunction</b></font>
</pre>
<p>Public function members can be used by ExecuteFunc or real variable value events, but they always need the scope prefix when used as string:</p>
<pre> <font color="#000000"><b>library</b></font> <span style="background-color: #ffffff"><font color="#000000">cookiesystem</font></span>
<font color="#000000"><b>public</b></font> <font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">ko</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">BJDebugMsg</font></span>(<font color="#0000cc"><i>"a"</i></font>)
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">thisisnotpublicnorprivate</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">ExecuteFunc</font></span>(<font color="#0000cc"><i>"cookiesystem_ko"</i></font>) <font color="#008800">//Needs the prefix no matter it is inside the scope</font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">ExecuteFunc</font></span>(<font color="#0000cc"><i>"ko"</i></font>) <font color="#008800">//This will most likely crash the game.</font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">cookiesystem_ko</font></span>() <font color="#008800">//Does not need the prefix but can use it.</font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">ko</font></span>() <font color="#008800">//since it doesn't need the prefix, the line works correctly.</font>
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>endlibrary</b></font>
</pre>
<p>Alternatively, you may use SCOPE_PREFIX (see bellow)</p>
<p>Note: If you use public on a function called InitTrig, it is handled in an special way, instead of becoming ScopeName_InitTrig it will become InitTrig_ScopeName, so you could have an scope/library in a trigger with the same scope name and use this public function instead of manually making InitTrig_Correctname.</p>
<h3><a name='nests'></a>Nested scopes</h3>
<p>Scopes can be nested, don't confuse this statement with "libraries can be nested", in fact, you cannot even place a <b>library</b> inside an <b>scope</b> definition. You can however, have <b>scope</b> inside either <b>library</b> or <b>scope</b> definitions.</p>
<p>An scope inside another scope is considered a child scope. A child scope is considered to be a public member of the parent scope (?).</p>
<p>A child scope cannot declare members that were previously declared as private or global by a parent scope.</p>
<p>A child scope behaves in relation to its parent in the same way as a normal scope behaves in relation to the whole map script.</p>
<p>Since child scopes are always public members, you can access a child scope' public members froum outside the parent scope, but it needs a prefix for the parent and a prefix for the child.</p>
<p>An example :</p>
<pre>
<font color="#000000"><b>library</b></font> <span style="background-color: #ffffff"><font color="#000000">nestedtest</font></span>
<font color="#000000"><b>scope</b></font> <span style="background-color: #ffffff"><font color="#000000">A</font></span>
<font color="#000000"><b>globals</b></font>
<font color="#000000"><b>private</b></font> <font color="#7777cc"><b>integer</b></font> <span style="background-color: #ffffff"><font color="#000000">N</font></span>=<font color="#000066">4</font>
<font color="#000000"><b>endglobals</b></font>
<font color="#000000"><b>public</b></font> <font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">display</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">BJDebugMsg</font></span>(<span style="background-color: #ffffff"><font color="#000000">I2S</font></span>(<span style="background-color: #ffffff"><font color="#000000">N</font></span>))
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>endscope</b></font>
<font color="#000000"><b>scope</b></font> <span style="background-color: #ffffff"><font color="#000000">B</font></span>
<font color="#000000"><b>globals</b></font>
<font color="#000000"><b>public</b></font> <font color="#7777cc"><b>integer</b></font> <span style="background-color: #ffffff"><font color="#000000">N</font></span>=<font color="#000066">5</font>
<font color="#000000"><b>endglobals</b></font>
<font color="#000000"><b>public</b></font> <font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">display</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">BJDebugMsg</font></span>(<span style="background-color: #ffffff"><font color="#000000">I2S</font></span>(<span style="background-color: #ffffff"><font color="#000000">N</font></span>))
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>endscope</b></font>
<font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">nestedDoTest</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">B_display</font></span>()
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">A_display</font></span>()
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>endlibrary</b></font>
<font color="#000000"><b>public</b></font> <font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">outside</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>set</b></font> <span style="background-color: #ffffff"><font color="#000000">nestedtest_B_N</font></span>= -<font color="#000066">4</font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">nestedDoTest</font></span>()
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">nestedtest_A_display</font></span>()
<font color="#000000"><b>endfunction</b></font>
</pre>
<p>The next example will cause a syntax error:</p>
<pre>
<font color="#000000"><b>library</b></font> <span style="background-color: #ffffff"><font color="#000000">nestedtest</font></span>
<font color="#000000"><b>globals</b></font>
<font color="#000000"><b>private</b></font> <font color="#7777cc"><b>integer</b></font> <span style="background-color: #ffffff"><font color="#000000">N</font></span>=<font color="#000066">3</font>
<font color="#000000"><b>endglobals</b></font>
<font color="#000000"><b>scope</b></font> <span style="background-color: #ffffff"><font color="#000000">A</font></span>
<font color="#000000"><b>globals</b></font>
<font color="#000000"><b>private</b></font> <font color="#7777cc"><b>integer</b></font> <span style="background-color: #ffffff"><font color="#000000">N</font></span>=<font color="#000066">4</font> <font color="#008800">//Error: 'N' redeclared</font>
<font color="#000000"><b>endglobals</b></font>
<font color="#000000"><b>endscope</b></font>
<font color="#000000"><b>endlibrary</b></font>
</pre>
<p>It is actually caused by a limitation in the parser, there is a conflict caused by using N for the parent and then declaring it for the child. However this version does not cause syntax errors:</p>
<pre>
<font color="#000000"><b>library</b></font> <span style="background-color: #ffffff"><font color="#000000">nestedtest</font></span>
<font color="#000000"><b>scope</b></font> <span style="background-color: #ffffff"><font color="#000000">A</font></span>
<font color="#000000"><b>globals</b></font>
<font color="#000000"><b>private</b></font> <font color="#7777cc"><b>integer</b></font> <span style="background-color: #ffffff"><font color="#000000">N</font></span>=<font color="#000066">4</font>
<font color="#000000"><b>endglobals</b></font>
<font color="#000000"><b>endscope</b></font>
<font color="#000000"><b>globals</b></font>
<font color="#000000"><b>private</b></font> <font color="#7777cc"><b>integer</b></font> <span style="background-color: #ffffff"><font color="#000000">N</font></span>=<font color="#000066">3</font>
<font color="#000000"><b>endglobals</b></font>
<font color="#000000"><b>endlibrary</b></font>
</pre>
<p> It does kind of the same thing, but since the child's N was declared before the parent's the parser no longer gets in a confusion.</p>
<p>Another thing to keep in mind is that unlike normal global variables, private/public global variables cannot be used before declared, otherwise JassHelper will think they are just normal variables.</p>
<p>Scopes cannot be redeclared, there cannot be 2 scopes with the same name. But 2 child scopes might have the same name if they are children of different scopes, the reason is that they actually don't have the same name, they have different names given by their public child scope situation.</p>
<pre> <font color="#000000"><b>library</b></font> <span style="background-color: #ffffff"><font color="#000000">nestedtest</font></span>
<font color="#000000"><b>scope</b></font> <span style="background-color: #ffffff"><font color="#000000">A</font></span>
<font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">kkk</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>set</b></font> <span style="background-color: #ffffff"><font color="#000000">N</font></span>=<span style="background-color: #ffffff"><font color="#000000">N</font></span>+<font color="#000066">5</font> <font color="#008800">// By the time JassHelper gets to this line, it did not see the private integer N</font>
<font color="#008800">// declaration yet, so it assumes N is an attempt to use a global variable and does not</font>
<font color="#008800">// do any replacement</font>
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>endscope</b></font>
<font color="#000000"><b>endlibrary</b></font>
<font color="#000000"><b>scope</b></font> <span style="background-color: #ffffff"><font color="#000000">X</font></span>
<font color="#000000"><b>scope</b></font> <span style="background-color: #ffffff"><font color="#000000">A</font></span>
<font color="#008800">//Declaring scope A again does not cause any problem, it is because the scope is actually X_A , the</font>
<font color="#008800">// previous declaration of A was actually nestedtest_A</font>
<font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">DoSomething</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>endscope</b></font>
<font color="#000000"><b>endscope</b></font></pre>
<p>There is no nesting limit, but notice that resulting variable and function names of private/public members get big and bigger depending of the depth of the scope nesting. Bigger variable names may affect performance. Not a lot but they do, and this efficiency issue is to be prevented by an obfuscator/finalizer that renames every identifier in the map script a.k.a the map optimizer's shortest names possible method.</p>
<h4><a name='sconst'></a>SCOPE_PREFIX and SCOPE_PRIVATE</h4>
<p>Whenever you are inside an scope/library declaration, SCOPE_PREFIX and SCOPE_PRIVATE are enabled string constants that you could use.</p>
<p>SCOPE_PREFIX will return the name (as a Jass string) of the current scope concatenated with an underscode. (The prefix added for public memebers)</p>
<p>SCOPE_PRIVATE will return the name (as a Jass string) of the current prefix for private members.</p>
<pre>
<font color="#000000"><b>scope</b></font> <span style="background-color: #ffffff"><font color="#000000">test</font></span>
<font color="#000000"><b>private</b></font> <font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">kol</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">BJDebugMsg</font></span>(<font color="#0000cc"><i>"..."</i></font>)
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">lala</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">ExecuteFunc</font></span>(<span style="background-color: #ffffff"><font color="#000000">SCOPE_PRIVATE</font></span>+<font color="#0000cc"><i>"kol"</i></font>)
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>endscope</b></font>
</pre>
<p>In the example, we are allowing lala() to call the private function kol via ExecuteFunc.</p>
<h4><a name='keyword'></a>keyword</h4>
<p>The keyword statement allows you to declare a replacement directive for an scope without declaring an actual function/variable/etc. It is useful for many reasons, the most important of the reasons being that you cannot use a private/public member in an scope before it is declared, in most cases this limitation is no more than an annoyance requiring you to change the position of declarations, in other situations though this is a limitator of other features.</p>
<p>For example two mutually recursive functions may use .evaluate (keep reading this readme) to call each other, but if you also want the functions to be private it is impossible to do it without using keyword:</p>
<pre>
<font color="#000000"><b>scope</b></font> <span style="background-color: #ffffff"><font color="#000000">myScope</font></span>
<font color="#000000"><b>private</b></font> <span style="background-color: #ffffff"><font color="#000000">keyword</font></span> <span style="background-color: #ffffff"><font color="#000000">B</font></span> <font color="#008800">//we were able to declare B as private without having to actually</font>
<font color="#008800">//include the statement of the function which would cause conflicts.</font>
<font color="#000000"><b>private</b></font> <font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">A</font></span> <font color="#000000"><b>takes</b></font> <font color="#0055aa"><b>integer</b></font> <span style="background-color: #ffffff"><font color="#000000">i</font></span> <font color="#000000"><b>returns</b></font> <font color="#0055aa"><b>nothing</b></font>
<font color="#000000"><b>if</b></font>(<span style="background-color: #ffffff"><font color="#000000">i</font></span>!=<font color="#0000aa">0</font>) <font color="#000000"><b>then</b></font>
<font color="#000000"><b>return</b></font> <span style="background-color: #ffffff"><font color="#000000">B</font></span><font color="#0000aa">.</font><span style="background-color: #ffffff"><font color="#000000">evaluate</font></span>(<span style="background-color: #ffffff"><font color="#000000">i</font></span>-<font color="#0000aa">1</font>)*<font color="#0000aa">2</font> <font color="#008800">//we can safely use B since it was already</font>
<font color="#008800">//declared as a private member of the scope</font>
<font color="#000000"><b>endif</b></font>
<font color="#000000"><b>return</b></font> <font color="#0000aa">0</font>
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>private</b></font> <font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">B</font></span> <font color="#000000"><b>takes</b></font> <font color="#0055aa"><b>integer</b></font> <span style="background-color: #ffffff"><font color="#000000">i</font></span> <font color="#000000"><b>returns</b></font> <font color="#0055aa"><b>nothing</b></font>
<font color="#000000"><b>if</b></font>(<span style="background-color: #ffffff"><font color="#000000">i</font></span>!=<font color="#0000aa">0</font>) <font color="#000000"><b>then</b></font>
<font color="#000000"><b>return</b></font> <span style="background-color: #ffffff"><font color="#000000">A</font></span>(<span style="background-color: #ffffff"><font color="#000000">i</font></span>-<font color="#0000aa">1</font>)*<font color="#0000aa">3</font>
<font color="#000000"><b>endif</b></font>
<font color="#000000"><b>return</b></font> <font color="#0000aa">0</font>
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>endscope</b></font>
</pre>
<h3><a name='textm'></a>Text Macros</h3>
<p>Let's accept it, sometimes we want very complex things added to Jass but other times, the only thing we actually need is an automatic text copy+paste+replace, textmacros were added because they can be really useful in a lot of very different cases</p>
<p>The syntax is simple, //! textmacro NAME [takes argument1, argument2, ..., argument n] then //! endtextmacro to finish. And just a runtextmacro to run. It is easier to understand after an example:</p>
<pre> <font color="#666666">//! textmacro Increase takes TYPEWORD</font>
<font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">IncreaseStored</font></span><font color="#666666">$TYPEWORD$</font> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>gamecache</b></font> <span style="background-color: #ffffff"><font color="#000000">g</font></span>, <font color="#7777cc"><b>string</b></font> <span style="background-color: #ffffff"><font color="#000000">m</font></span>, <font color="#7777cc"><b>string</b></font> <span style="background-color: #ffffff"><font color="#000000">l</font></span> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">Store</font></span><font color="#666666">$TYPEWORD$</font>(<span style="background-color: #ffffff"><font color="#000000">g</font></span>,<span style="background-color: #ffffff"><font color="#000000">m</font></span>,<span style="background-color: #ffffff"><font color="#000000">l</font></span>,<span style="background-color: #ffffff"><font color="#000000">GetStored</font></span><font color="#666666">$TYPEWORD$</font>(<span style="background-color: #ffffff"><font color="#000000">g</font></span>,<span style="background-color: #ffffff"><font color="#000000">m</font></span>,<span style="background-color: #ffffff"><font color="#000000">l</font></span>)+<font color="#000066">1</font>)
<font color="#000000"><b>endfunction</b></font>
<font color="#666666">//! endtextmacro</font>
<font color="#666666">//! runtextmacro Increase("Integer")</font>
<font color="#666666">//! runtextmacro Increase("Real")</font></pre>
<p>The result of the example is:</p>
<pre> <font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">IncreaseStoredInteger</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>gamecache</b></font> <span style="background-color: #ffffff"><font color="#000000">g</font></span>, <font color="#7777cc"><b>string</b></font> <span style="background-color: #ffffff"><font color="#000000">m</font></span>, <font color="#7777cc"><b>string</b></font> <span style="background-color: #ffffff"><font color="#000000">l</font></span> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">StoreInteger</font></span>(<span style="background-color: #ffffff"><font color="#000000">g</font></span>,<span style="background-color: #ffffff"><font color="#000000">m</font></span>,<span style="background-color: #ffffff"><font color="#000000">l</font></span>,<span style="background-color: #ffffff"><font color="#000000">GetStoredInteger</font></span>(<span style="background-color: #ffffff"><font color="#000000">g</font></span>,<span style="background-color: #ffffff"><font color="#000000">m</font></span>,<span style="background-color: #ffffff"><font color="#000000">l</font></span>)+<font color="#000066">1</font>)
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">IncreaseStoredReal</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>gamecache</b></font> <span style="background-color: #ffffff"><font color="#000000">g</font></span>, <font color="#7777cc"><b>string</b></font> <span style="background-color: #ffffff"><font color="#000000">m</font></span>, <font color="#7777cc"><b>string</b></font> <span style="background-color: #ffffff"><font color="#000000">l</font></span> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">StoreReal</font></span>(<span style="background-color: #ffffff"><font color="#000000">g</font></span>,<span style="background-color: #ffffff"><font color="#000000">m</font></span>,<span style="background-color: #ffffff"><font color="#000000">l</font></span>,<span style="background-color: #ffffff"><font color="#000000">GetStoredReal</font></span>(<span style="background-color: #ffffff"><font color="#000000">g</font></span>,<span style="background-color: #ffffff"><font color="#000000">m</font></span>,<span style="background-color: #ffffff"><font color="#000000">l</font></span>)+<font color="#000066">1</font>)
<font color="#000000"><b>endfunction</b></font></pre>
<p>The $$ delimiters are required because the replace tokens could require to be together to other symbols.</p>
<p>Notice that strings and comments are not protected from the text replacement. So if there is a match for any of the arguments delimited by $$ it will always get replaced.</p>
<p>textmacros don't need arguments, in that case you simply remove the takes keyword.</p>
<pre> <font color="#666666">//! textmacro bye</font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">BJDebugMsg</font></span>(<font color="#0000cc"><i>"1"</i></font>)
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">BJDebugMsg</font></span>(<font color="#0000cc"><i>"2"</i></font>)
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">BJDebugMsg</font></span>(<font color="#0000cc"><i>"3"</i></font>)
<font color="#666666">//! endtextmacro</font>
<font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">test</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#666666">//! runtextmacro bye()</font>
<font color="#666666">//! runtextmacro bye()</font>
<font color="#000000"><b>endfunction</b></font></pre>
<p>Textmacros add just a lot of fake dynamism to the language, the next is the typical attach/handle vars call for handles:</p>
<pre> <font color="#666666">//! textmacro GetSetHandle takes TYPE, TYPENAME</font>
<font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">GetHandle</font></span><font color="#666666">$TYPENAME$</font> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>handle</b></font> <span style="background-color: #ffffff"><font color="#000000">h</font></span>, <font color="#7777cc"><b>string</b></font> <span style="background-color: #ffffff"><font color="#000000">k</font></span> <font color="#000000"><b>returns</b></font> <font color="#666666">$TYPE$</font>
<font color="#000000"><b>return</b></font> <span style="background-color: #ffffff"><font color="#000000">GetStoredInteger</font></span>(<span style="background-color: #ffffff"><font color="#000000">udg_handlevars</font></span>, <span style="background-color: #ffffff"><font color="#000000">I2S</font></span>(<span style="background-color: #ffffff"><font color="#000000">H2I</font></span>(<span style="background-color: #ffffff"><font color="#000000">h</font></span>)), <span style="background-color: #ffffff"><font color="#000000">k</font></span>)
<font color="#000000"><b>return</b></font> <span style="background-color: #ffffff"><font color="#000000">null</font></span>
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">SetHandle</font></span><font color="#666666">$TYPENAME$</font> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>handle</b></font> <span style="background-color: #ffffff"><font color="#000000">h</font></span>, <font color="#7777cc"><b>string</b></font> <span style="background-color: #ffffff"><font color="#000000">k</font></span>, <font color="#666666">$TYPE$</font> <span style="background-color: #ffffff"><font color="#000000">v</font></span> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">StoredInteger</font></span>(<span style="background-color: #ffffff"><font color="#000000">udg_handlevars</font></span>,<span style="background-color: #ffffff"><font color="#000000">I2S</font></span>(<span style="background-color: #ffffff"><font color="#000000">H2I</font></span>(<span style="background-color: #ffffff"><font color="#000000">h</font></span>)),<span style="background-color: #ffffff"><font color="#000000">k</font></span>, <span style="background-color: #ffffff"><font color="#000000">H2I</font></span>(<span style="background-color: #ffffff"><font color="#000000">v</font></span>))
<font color="#000000"><b>endfunction</b></font>
<font color="#666666">//! endtextmacro</font>
<font color="#666666">//! runtextmacro GetSetHandle("unit","Unit")</font>
<font color="#666666">//! runtextmacro GetSetHandle("location","Loc")</font>
<font color="#666666">//! runtextmacro GetSetHandle("item","Item")</font></pre>
<p>The development time has beed reduced significantly</p>
<p>Textmacros and scopes/libraries can become best friends by allowing some kind of static object orientedness:</p>
<pre>
<font color="#666666">//! textmacro STACK takes NAME, TYPE, TYPE2STRING</font>
<font color="#000000"><b>scope</b></font> <font color="#666666">$NAME$</font>
<font color="#000000"><b>globals</b></font>
<font color="#000000"><b>private</b></font> <font color="#666666">$TYPE$</font> <font color="#7777cc"><b>array</b></font> <span style="background-color: #ffffff"><font color="#000000">V</font></span>
<font color="#000000"><b>private</b></font> <font color="#7777cc"><b>integer</b></font> <span style="background-color: #ffffff"><font color="#000000">N</font></span>=<font color="#000066">0</font>
<font color="#000000"><b>endglobals</b></font>
<font color="#000000"><b>public</b></font> <font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">push</font></span> <font color="#000000"><b>takes</b></font> <font color="#666666">$TYPE$</font> <span style="background-color: #ffffff"><font color="#000000">val</font></span> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>set</b></font> <span style="background-color: #ffffff"><font color="#000000">V</font></span>[<span style="background-color: #ffffff"><font color="#000000">N</font></span>]=<span style="background-color: #ffffff"><font color="#000000">val</font></span>
<font color="#000000"><b>set</b></font> <span style="background-color: #ffffff"><font color="#000000">N</font></span>=<span style="background-color: #ffffff"><font color="#000000">N</font></span>+<font color="#000066">1</font>
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>public</b></font> <font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">pop</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#666666">$TYPE$</font>
<font color="#000000"><b>set</b></font> <span style="background-color: #ffffff"><font color="#000000">N</font></span>=<span style="background-color: #ffffff"><font color="#000000">N</font></span>-<font color="#000066">1</font>
<font color="#000000"><b>return</b></font> <span style="background-color: #ffffff"><font color="#000000">V</font></span>[<span style="background-color: #ffffff"><font color="#000000">N</font></span>]
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>public</b></font> <font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">print</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>local</b></font> <font color="#7777cc"><b>integer</b></font> <span style="background-color: #ffffff"><font color="#000000">a</font></span>=<span style="background-color: #ffffff"><font color="#000000">N</font></span>-<font color="#000066">1</font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">BJDebugMsg</font></span>(<font color="#0000cc"><i>"Contents of $TYPE$ stack $NAME$:"</i></font>)
<font color="#000000"><b>loop</b></font>
<font color="#000000"><b>exitwhen</b></font> <span style="background-color: #ffffff"><font color="#000000">a</font></span><<font color="#000066">0</font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">BJDebugMsg</font></span>(<font color="#0000cc"><i>" "</i></font>+<font color="#666666">$TYPE2STRING$</font>(<span style="background-color: #ffffff"><font color="#000000">V</font></span>[<span style="background-color: #ffffff"><font color="#000000">a</font></span>]))
<font color="#000000"><b>set</b></font> <span style="background-color: #ffffff"><font color="#000000">a</font></span>=<span style="background-color: #ffffff"><font color="#000000">a</font></span>-<font color="#000066">1</font>
<font color="#000000"><b>endloop</b></font>
<font color="#000000"><b>endfunction</b></font>
<font color="#000000"><b>endscope</b></font>
<font color="#666666">//! endtextmacro</font>
<font color="#666666">//! runtextmacro STACK("StackA","integer","I2S")</font>
<font color="#666666">//! runtextmacro STACK("StackB","integer","I2S")</font>
<font color="#666666">//! runtextmacro STACK("StackC","string","")</font>
<font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">Test</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">StackA_push</font></span>(<font color="#000066">4</font>)
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">StackA_push</font></span>(<font color="#000066">5</font>)
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">StackB_push</font></span>(<span style="background-color: #ffffff"><font color="#000000">StackA_pop</font></span>())
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">StackA_push</font></span>(<font color="#000066">7</font>)
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">StackA_print</font></span>()
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">StackB_print</font></span>()
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">StackC_push</font></span>(<font color="#0000cc"><i>"A"</i></font>)
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">StackC_push</font></span>(<font color="#0000cc"><i>"B"</i></font>)
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">StackC_push</font></span>(<font color="#0000cc"><i>"C"</i></font>)
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">StackC_print</font></span>()
<font color="#000000"><b>endfunction</b></font>
</pre>
<p><b>Hint:</b> You can use textmacro_once in a similar way to library_once.</p>
<p><b>Hint 2:</b> If you //! runtextmacro optional textmacroname(args), the textmacro line will not cause a syntax error if the textmacro does not exist.</p>
<h3><a name='stru'></a>Structs</h3>
<p>Structs introduce Jass to the object oriented programming paradigm.</p>
<p>I am unable to explain them without making an example first:</p>
<pre>
<font color="#000000"><b>struct</b></font> <span style="background-color: #ffffff"><font color="#000000">pair</font></span>
<font color="#7777cc"><b>integer</b></font> <span style="background-color: #ffffff"><font color="#000000">x</font></span>
<font color="#7777cc"><b>integer</b></font> <span style="background-color: #ffffff"><font color="#000000">y</font></span>
<font color="#000000"><b>endstruct</b></font>
<font color="#000000"><b>function</b></font> <span style="background-color: #ffffff"><font color="#000000">testpairs</font></span> <font color="#000000"><b>takes</b></font> <font color="#7777cc"><b>nothing</b></font> <font color="#000000"><b>returns</b></font> <font color="#7777cc"><b>nothing</b></font>
<font color="#000000"><b>local</b></font> <span style="background-color: #ffffff"><font color="#000000">pair</font></span> <span style="background-color: #ffffff"><font color="#000000">A</font></span>=<span style="background-color: #ffffff"><font color="#000000">pair</font></span><font color="#000066">.</font><span style="background-color: #ffffff"><font color="#000000">create</font></span>()
<font color="#000000"><b>set</b></font> <span style="background-color: #ffffff"><font color="#000000">A</font></span><font color="#000066">.</font><span style="background-color: #ffffff"><font color="#000000">x</font></span>=<font color="#000066">5</font>
<font color="#000000"><b>set</b></font> <span style="background-color: #ffffff"><font color="#000000">A</font></span><font color="#000066">.</font><span style="background-color: #ffffff"><font color="#000000">x</font></span>=<font color="#000066">8</font>
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">BJDebugMsg</font></span>(<span style="background-color: #ffffff"><font color="#000000">I2S</font></span>(<span style="background-color: #ffffff"><font color="#000000">A</font></span><font color="#000066">.</font><span style="background-color: #ffffff"><font color="#000000">x</font></span>)+<font color="#0000cc"><i>" : "</i></font>+<span style="background-color: #ffffff"><font color="#000000">I2S</font></span>(<span style="background-color: #ffffff"><font color="#000000">A</font></span><font color="#000066">.</font><span style="background-color: #ffffff"><font color="#000000">y</font></span>))
<font color="#000000"><b>call</b></font> <span style="background-color: #ffffff"><font color="#000000">pair</font></span><font color="#000066">.</font><span style="background-color: #ffffff"><font color="#000000">destroy</font></span>(<span style="background-color: #ffffff"><font color="#000000">A</font></span>)
<font color="#000000"><b>endfunction</b></font></pre>
<p>As you can see, you can store multiple values in a single struct, then you can just use the struct as if it was another Jass type, notice the . syntax which is used for members on most common languages.</p>
<h4><a name='strudecl'></a>Declaring structs</h4>
<p>Before using an struct you need to declare it, duh. The syntax is simply using the struct <name> and endstruct keyword, notice how similar they are to global blocks</p>
<p>To declare a member you simply use <type> <name> [= initial value]</p>
<p>In the above example we are declaring an struct type named pair, which has 2 members: x and y, they do not have an initial value set.</p>
<p>It is usually a good idea to assign initial values to the members, so that you don't have to manually initialize them after creating an object of the struct type, the usual default values are the null ones, but depending on the problem you want to solve you could need any other value.</p>
<h4><a name='strucrest'></a>Creating and destroying structs</h4>
<p>Structs are pseudo-dynamic, you would often need to create and destroy structs, and you should create an struct an assign it to a variable before using it.</p>
<p>The syntax to <i>create an struct</i> (It is actually to get a unique id) is : structtypename.create()</p>
<p>In the case of the above struct you would have to use pair.create() to get a new struct.</p>
<p>JassHelper is just a preprocessor not a hack so whatever adition to Jass we add is still limited by Jass' own limitations, in this case, structs use arrays which have a 8191 values limit, and we cannot use index 0 which is null for structs, so there is an 8190 instances limit. This limit is for instances of each type, so you may have 8190 objects of a pair struct type and still are able to have many other instances of other types.</p>
<p>It means that if you keep creating many structs of a type without destroying them you would eventually reach the limit. So keep in mind this: IN the case the instances limit of a type is reached structtype.create() WILL RETURN 0.</p>
<p>The limit is not usually a worrying issue, 8190 is in practice a huge number, unless you want to make linked lists or things like that, but those should be solved by a lower level approach.</p>
<p>For example, if you are only using structs for spell instance data, it is even impossible to get more than 9 instances. And many other practical applications would never need more than 2000 instances.</p>
<p>UNLESS, of course some structs that are not used anymore are not getting destroyed. In that case the limit is reached by a bug in the usage of structs that should be fixed (In the case of structs, unlike handles, not destroying them does not increase the memory usage, but the risk of reaching the limit)</p>
<p>If you make calculations, if you create an struct per second and always forget to remove it, the map would need 2 hour, 16 minutes in order to reach the limit.</p>
<p>Either way if you are making this for usage by other people and are unsure about the possibility of reaching the limit you can always use a comparission with 0 after calling create() and block the process somehow in case the error is found.</p>
<p>In case the limit is reached and you don't have a way to catch it, struct 0 would be used and assigned and probably cause some conflicts later, the strenght of the conflicts could be null or huge depending on the way you are using the structs.</p>
<p>If debug mode is on when compiling the script, create() will show a warning message whenever the limit is reached.</p>