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
|
====== Evol script commands ======
*chatjoin chatId [, char [,password]]
Force player to join chat with id chatId.
Example:
chatjoin .chat;
---------------------------------------
*setcamnpc [npcName [, x, y]]
Enable camera moving mode in client and move camera to npc with name "npcName"
and move relative from it in x and y pixels.
If "npcName" is missing, using attached npc.
If x and y missing, it count as 0.
Example:
setcamnpc 32, 0;
setcamnpc "npc1";
---------------------------------------
*setcam x, y
Move camera to absolute position x,y in pixels.
Example:
setcam 0, 0;
setcam 2000, 512;
---------------------------------------
*movecam x, y
Enable camera moving mode in client and move camera relative to player
position by x and y pixels.
Example:
movecam 10, 20;
---------------------------------------
*restorecam
Disable camera moving mode in client and set camera to default position.
Example:
restorecam;
---------------------------------------
*npctalk3 text
Send chat message from current npc, visible only for attached player.
Npc name will be translated.
Example:
npctalk3 "hello";
---------------------------------------
*closedialog
Will close npc dialog in client. If npc script will continue after this command,
dialog can be opened again.
Player must be attached.
Example:
closedialog;
---------------------------------------
*clear
Clear from text npc dialog for attached npc.
Player must be attached.
Example:
clear;
---------------------------------------
*shop npcName
Open if exists for attached player npc shop from npc with name "npcName"
Example:
shop "bag";
---------------------------------------
*getitemlink itemName [, cardName1 [, cardName2 [, cardName3 [, cardName4]]]]
*getitemlink itemId [, cardName1 [, cardName2 [, cardName3 [, cardName4]]]]
Return link for item id "itemId" or name "itemName" with cards.
This link after can be used in mes or other commands what show messages in npc dialog.
Example:
mes "Acorn link: " + getitemlink(Acorn);
mes getitemlink(VneckJumper, MintCashmereDye);
---------------------------------------
*getinvindexlink index
Return link to item by player inventory index. Also return cards in link.
This link after can be used in mes or other commands what show messages in npc dialog.
Inventory index counted from 0.
Example:
mes "link here: " + getinvindexlink(3);
---------------------------------------
*l text [, param1, ...]
Return translated formatted string.
Player must be attached.
Example:
mes l("test line");
mes l("give me @@.", getitemlink(Acorn));
---------------------------------------
*lg femaleText, makeText, [, param1, ...]
*lg text
Return translated formatted string based on gender.
Player must be attached.
Translators will give text with #N.
Example:
// translators will get two strings "i went to shop.#0" and "i went to shop.#1"
// with #0 for female and #1 for male
lg("i went to shop.");
lg("call her @@.", "call him @@.", "test");
---------------------------------------
*requestlang
Return selected language in client to server.
Player must be attached.
Example:
.@lang = requestlang();
---------------------------------------
*requestitem
Return selected item id by player. In client player move this item to npc.
Player must be attached.
Example:
.@item = requestitem();
mes "You gave me " + getitemlink(.@item);
---------------------------------------
*requestitems [n]
Return n items from player what he moved to npc inventory separated by ";".
If n missing it mean 1.
Better not use this command. Better use requestcraft.
Player must be attached.
Example:
.@str$ = requestitems();
.@str$ = requestitems(3);
---------------------------------------
*requestitemindex
Return inventory index for selected item by player. In client player move this item to npc.
Player must be attached.
Example:
.@item = requestitemindex();
---------------------------------------
*requestitemsindex [n]
Return inventory indexes for n items from player what he moved to npc inventory separated by ";".
If n missing it mean 1.
Player must be attached.
Example:
.@str$ = requestitemsindex();
.@str$ = requestitemsindex(3);
---------------------------------------
*requestcraft [n]
Request selected craft items in string format.
n is craft inventory size. If n missing, it mean 1.
After this string must be validated and converted to craft object
Player must be attached.
Example:
.@str$ = requestcraft(9);
---------------------------------------
*initcraft str
Create craft object based on craft string sent from client.
Return craft object id. Or -1 on error.
After using, craft object must be deleted with function deletecraft.
Player must be attached.
Example:
.@str$ = requestcraft(9);
.@craft = initcraft(.@str$);
deletecraft(.@craft);
---------------------------------------
*dumpcraft id
Dump to server console given craft object with id 'id'.
Player must be attached.
Example:
.@str$ = requestcraft(9);
.@craft = initcraft(.@str$);
dumpcraft(.@craft);
deletecraft(.@craft);
---------------------------------------
*deletecraft id
Delete craft object.
Player must be attached.
Example:
.@str$ = requestcraft(9);
.@craft = initcraft(.@str$);
deletecraft(.@craft);
---------------------------------------
*findcraftentry id, flag
Search craft entry in craft db for craft object with id 'id' and flag 'flag'.
Retrun craft entry id what was found. If error happend, return -1.
Player must be attached.
Example:
.@str$ = requestcraft(9);
.@craft = initcraft(.@str$);
.@entry = findcraftentry(.@craft, 0);
deletecraft(.@craft);
---------------------------------------
*usecraft id
This command can be used after checked craft object and found craft entry.
It apply craft entry. May delete or give items and do other things.
Player must be attached.
Example:
.@str$ = requestcraft(9);
.@craft = initcraft(.@str$);
.@entry = findcraftentry(.@craft, 0);
usecraft .@craft;
deletecraft(.@craft);
---------------------------------------
*getcraftcode id
After craft object was used by function usecraft, this function based on craft entry id
can return special number configured for craft entry in craft db.
Based on this value script may do additional things.
Player must be attached.
Example:
.@str$ = requestcraft(9);
.@craft = initcraft(.@str$);
.@entry = findcraftentry(.@craft, 0);
usecraft .@craft;
.@code = getcraftcode(.@entry);
deletecraft(.@craft);
---------------------------------------
*getcraftslotid id, slot
Return item id selected in craft object 'id' and in slot 'slot'.
On error return 0.
Player must be attached.
Example:
.@str$ = requestcraft(9);
.@craft = initcraft(.@str$);
.@item = getcraftslotid(.@craft, 0);
deletecraft(.@craft);
---------------------------------------
*getcraftslotamount id, slot
Return amount selected in craft object 'id' and in slot 'slot'.
On error return 0.
Player must be attached.
Example:
.@str$ = requestcraft(9);
.@craft = initcraft(.@str$);
.@item = getcraftslotid(.@craft, 0);
.@amount = getcraftslotamount(.@craft, 0);
deletecraft(.@craft);
---------------------------------------
*validatecraft id
Validate craft object and current player inventory.
It can be used after "next" command between init and use craft.
Return 0 if craft object now invalid, 1 if craft object can be used for player.
Player must be attached.
Example:
.@str$ = requestcraft(9);
.@craft = initcraft(.@str$);
next;
if (valudatecraft(.@craft) == 0)
{
deletecraft(.@craft);
close;
}
.@item = getcraftslotid(.@craft, 1);
deletecraft(.@craft);
---------------------------------------
*getq quest
Return quest state for attached player.
Example:
mes getq(ShipQuests_Julia);
---------------------------------------
*setq quest, value
Set quest state for attached player.
Example:
setq ShipQuests_Julia, 1;
---------------------------------------
*setnpcdir [npc,] dir
Set direction 'dir' for npc with name 'npc' or attached npc.
Example:
setnpcdir DOWN;
setnpcdir "npc1", LEFT;
---------------------------------------
*npcsit [name]
Set npc it sit state. 'name' is npc name. If 'name' missing it using attached npc.
Example:
npcsit;
npcsit "alige";
---------------------------------------
*npcstand [name]
Set npc it stand state. 'name' is npc name. If 'name' missing it using attached npc.
Example:
npcstand;
npcstand "alige";
---------------------------------------
*setnpcsex npcName, gender
Set gender 'gender' for npc 'npcName'
Supported genders:
G_FEMALE - female
G_MALE - male
G_OTHER - no gender or other
Example:
setnpcsex "npc1", G_MALE;
---------------------------------------
*npcwalkto x, y
This command start walking attached npc to position x,y.
Example:
npcwalkto 10, 10;
---------------------------------------
*setnpcdialogtitle title
Set dialog title for attached npc to 'title'.
Player must be attached.
Example:
setnpcdialogtitle "Hello";
---------------------------------------
*rif condition, trueValue [, falseValue]
Check condition and if it true, then return 'trueValue' string
If condition false, it return 'falseValue' if present, or empty string.
This command can be used in menu and select commands. Empty lines in this commands hidden.
Example:
.@ret = select(rif(countitem(Acorn) > 0, "I can give you acorn."),
"Nothing");
---------------------------------------
*misceffect effect [, name]
*misceffect effect [, id]
Start paritcle effect with id 'effect' on any being with name 'name' or with id 'id'.
Example:
misceffect 4, getcharid(3);
---------------------------------------
*setmapmask mapName, mask
Allow change map mask. Based on this mask layers in client can be visible or hidden.
Command 'setmapmask' set mask for 'mapName' to value 'mask'.
Default mask is 1.
Example:
setmapmask "test", 1; // default
setmapmask "test", 3; // 1 + 2
---------------------------------------
*addmapmask mapName, mask
Allow change map mask. Based on this mask layers in client can be visible or hidden.
Command 'addmapmask' add bit mask 'mask' to map 'mapName'.
Default mask is 1.
Example:
setmapmask "test", 1; // now mask 1
addmapmask "test", 2; // now mask is 1|2 = 3
addmapmask "test", 2; // now mask is 3|2 = 3
---------------------------------------
*removemapmask mapName, mask
Allow change map mask. Based on this mask layers in client can be visible or hidden.
Command 'removemapmask' remove bit mask 'mask' from map 'mapName'.
Default mask is 1.
Example:
setmapmask "test", 1; // now mask 1
addmapmask "test", 2; // now mask is 1|2 = 3
removemapmask "test", 1; // now mask is 3|1^1 = 2
removemapmask "test", 1; // now mask is 2|1^1 = 2
---------------------------------------
*getmapmask mapName
Return current mask what was set to map 'mapName'.
Example:
mes "test map mask: " + getmapmask("test");
---------------------------------------
*showavatar [id]
Show avatar in npc dialog for attached npc.
if 'id' misisng or 0 it hide avatar.
Player must be attached.
Example:
showavatar 1; // show 1
showavatar; // hide
---------------------------------------
*setavatardir dir
Set avatar direction 'dir' in npc dialog for attached npc.
Player must be attached.
Example:
setavatardir UPRIGHT;
---------------------------------------
*setavataraction action
Set avatar action to 'action' in npc dialog for attached npc.
Player must be attached.
Example:
setavataraction ACTION_SIT;
---------------------------------------
*changemusic map, file
Change background music on map 'map' to file 'file'.
Example:
changemusic "music1.ogg";
---------------------------------------
*getmapname
Return attached player current map name.
Example:
mes "You located in map: " + getmapname();
---------------------------------------
*unequipbyid id
Unequip from attached player item with id 'id'.
Example:
unequipbyid VneckJumper;
---------------------------------------
*ispcdead
Return true if attached player is dead. In other cases return false.
---------------------------------------
*areatimer mapName, x1, y1, x2, y2, time, eventLabel
Create one time timer in map 'mapName' for players in rectangle (x1,y1) - (x2,y2)
Timer will call label 'eventLabel' after time 'time'.
This function probably will be removed in future.
Example:
areatimer "test", 10, 10, 20, 20, 5, "npc1:AreaLabel"
---------------------------------------
*getareadropitem mapName, x1, y1, x2, y2, itemId [, delFlag]
*getareadropitem mapName, x1, y1, x2, y2, itemName [, delFlag]
Return number of floor items with id 'itemId' or name 'itemName' in map 'mapName'
in rectangle (x1,y1) - (x2,y2). If delFlag set to 1, it also delete floor items.
This function probably will be removed in future.
Example:
mes "Acorns amount: " + getareadropitem("test", 10, 10, 20, 20, Acorn);
---------------------------------------
*clientcommand command
Send client side command to client. It allow send only safe commands.
Player must be attached.
Example:
clientcommand "emote 1"; // show first emote on attached player
---------------------------------------
*isunitwalking [unitId]
Return true if unit with id 'unitId' in walking progress.
If 'unitId' missing it using attached npc.
This function can be used in walking npc scripts.
Example:
mes "Current npc walking? " + (isunitwalking() ? "yes" : "no");
---------------------------------------
*failedrefindex index
This function do fail refine action on item with inventory index 'index'.
Index start count from 0.
Player must be attached.
Example:
failedrefindex 3;
---------------------------------------
*downrefindex index, levels
This function lower refine item level with inventory index 'index' for 'levels' levels.
Index start count from 0.
Player must be attached.
Example:
downrefindex 3, 1;
---------------------------------------
*successrefindex index, levels
This function up refine item level with inventory index 'index' for 'levels' levels.
Index start count from 0.
Player must be attached.
Example:
successrefindex 3, 1;
---------------------------------------
*isstr var
Return true if 'var' is string, in other case return false.
Can be usefull for check functions arguments.
Example:
mes "is string is string? " + isstr("text");
---------------------------------------
*setbgteam bgId, teamId;
Set id 'teamId' for battle ground group 'bgId'.
After battle ground start, teamId will be sent to client.
Example:
$@bgid1 = waitingroom2bg("testbg", 10, 10, "bgnpc1::OnLogout","bgnpc1:OnDie");
setbgteam $@bgid1, 1;
bg_warp $@bgid1, "testbg", 10, 10;
---------------------------------------
*checknpccell
Check given cell in map for flag for attached npc.
Most time it used for check is this cell walkable for npc or not.
Example:
.@canWalk = checknpccell("test", 10, 10, cell_chkpass);
---------------------------------------
*setcells mapName, x1, y1, x2, y2, mask, wallName
Add to map with name 'mapName' new "wall" in rectangle (x1,y1) - (x2,y2).
Set to this rectangle mask 'mask'. 'wallName' is name for this "wall".
Mask is client side collision types.
After it can be removed by this name.
Example:
setcells "test", 14, 11, 17, 11, 3, "wall1";
---------------------------------------
*delcells wallName
Remove wall created by command setcells.
Example:
setcells "test", 14, 11, 17, 11, 3, "wall1";
delcells "wall1";
---------------------------------------
*setmount id
Set mount (horse) for attached player.
If id is zero, mount removed.
Example:
setmount 1;
---------------------------------------
*setskin name
Set skin with name 'name' for attached npc for attached player.
Example:
setskin "test2";
---------------------------------------
*emotion id [, flag [, name]]
This command works same like hercules emotion command, except it removed limit for emotes.
---------------------------------------
*successremovecardsindex index
This command remove all cards from item by inventory index and put all cards in inventory.
Also show status effect 3.
---------------------------------------
*failedremovecardsindex index, flag
This command remove all cards from item by inventory index.
Also show status effect 2.
It also may remove item or cards depend on flag.
flag value:
0 - will remove item and cards.
1 - will remove cards and keep item.
2 - will remove item and keep cards.
3 - do nothing except status effect.
---------------------------------------
*getcardbyindex itemIndex, cardIndex
This command return card id by item index and card (slot) index.
If no cards found or error happend, return zero.
Example:
.@item = requestitemindex();
mes "slot 0 = card " + str(getcardbyindex(.@item, 0));
---------------------------------------
*removecardbyindex itemIndex, cardIndex
This command remove card from invetory and slot index.
If error happend, return -1.
If no errors, return 0.
Example:
.@item = requestitemindex();
removecardbyindex .@item, 0;
---------------------------------------
*htnew
Create a new hash table (hash map, associative array), and return it's ID.
All hashtable functions (htdelete, htget, htput, htclear, htsize, htiterator)
will use this ID (as first argument). Remember to use htdelete to free memory,
when you don't need the hash table anymore.
Example:
.@ht_id = htnew;
---------------------------------------
*htdelete id
Delete a hashtable with given ID, and free the memory.
Example:
.@ht_id = htnew;
htdelete(.@ht_id);
---------------------------------------
*htget id, key [, default]
Return the value, associated with the given key. If there is no such value,
return 0. If the (optional) third argument is given, and no value was found,
return this third argument.
Example:
.@val1 = htget(.@ht_id, "key1");
.@val2 = htget(.@ht_id, "key2", 7);
.@val3$ = htget(.@ht_id, "key3", "");
---------------------------------------
*htput id, key, newval
Set a new value, associated with given key. If a previous value existed,
it will be replaced. If newval is empty string or 0, the given key and
it's associated value are removed.
Example:
htput(.@ht_id, "key1", 77);
htput(.@ht_id, "key1", "test");
htput(.@ht_id, "key1", 0); // delete given entry from hashtable
---------------------------------------
*htsize id
Get the number of elements in the given hash table. When you set a given
value to 0 or "", it's removed from the hash table, so it won't count when
calculating the size.
Example:
.@len = htsize .@ht_id;
---------------------------------------
*htclear id
Remove all elements (keys and values) from the given hash table. After it
it's size will be 0.
Example:
htclear(.@ht_id);
---------------------------------------
*htiterator id
Create an iterator over a hash table keys, and return it's ID (don't confuse
iterator ID with hash table ID, those are different). Iterators are used
to traverse over hash tables, get keys and possibly modify values. Remember
to use htidelete to remove the iterator and free the resources.
Example: see below.
---------------------------------------
*htinextkey it
Get the next key of the hash table, that the given iterator is attached to.
If the iterator traversed over all elements, return "".
Example: see below.
---------------------------------------
*hticheck it
Check if the iterator traversed over all keys. Returns 1, if it didn't,
0 otherwise.
Example: see below
---------------------------------------
*htidelete it
Delete the iterator and free resources.
Example:
.@it = htiterator(.@ht_id);
for (.@key$ = htinextkey(.@it); hticheck(.@it); .@key$ = htinextkey(.@it))
{
.@oldval = htget(.@ht_id, .@key$);
htput(.@ht_id, .@key$, .@oldval + .@oldval); // concatenate each value with itself
}
htidelete(.@it)
---------------------------------------
*setfakecells x1, y1 [, x2, y2 ], mask
Send fake collision data to the client. Sets the cells of square
area 'x1', 'y1' [, 'x2', 'y2'] to BlockType 'mask'. Only exists client-side.
For real collision, use the setcells & delcells commands.
Example:
setfakecells 25, 45, 29, 50, 1; // block
setfakecells 25, 45, 29, 50, 0; // allow
---------------------------------------
*getlabel label
Get label and return int.
Example:
.@var = getlabel(OnInit);
---------------------------------------
*tolabel num
Get number and return label.
Example:
goto tolabel(.@var);
---------------------------------------
|