summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgumi <mekolat@users.noreply.github.com>2017-01-15 19:34:30 +0000
committergumi <mekolat@users.noreply.github.com>2017-01-15 19:34:30 +0000
commit0b18d7b7a7dd14f3875584da6262775bfe39b15e (patch)
tree65a69067d4d5650ab7c02f3892234ce2ba3141b4
parentdbf252c0621fc5ebd003f9bda3cef9423ab467ee (diff)
parentfc4c06b12d35e62bcf52e19bd8a8754166b55efc (diff)
downloadserverdata-0b18d7b7a7dd14f3875584da6262775bfe39b15e.tar.gz
serverdata-0b18d7b7a7dd14f3875584da6262775bfe39b15e.tar.bz2
serverdata-0b18d7b7a7dd14f3875584da6262775bfe39b15e.tar.xz
serverdata-0b18d7b7a7dd14f3875584da6262775bfe39b15e.zip
Merge branch 'format' into 'master'
moar consistency See merge request !91
-rw-r--r--npc/000-0-0/sailors.txt4
-rw-r--r--npc/000-0-1/narrator.txt4
-rw-r--r--npc/000-0/sailors.txt2
-rw-r--r--npc/000-2-0/julia.txt22
-rw-r--r--npc/000-2-1/arpan.txt8
-rw-r--r--npc/000-2-1/peter.txt30
-rw-r--r--npc/000-2-1/story_save.txt2
-rw-r--r--npc/000-2-2/doors.txt2
-rw-r--r--npc/000-2-2/ratto.txt16
-rw-r--r--npc/000-2-3/nard.txt6
-rw-r--r--npc/001-1/cookiemaster.txt2
-rw-r--r--npc/001-2-22/note.txt2
-rw-r--r--npc/001-2-22/peter.txt30
-rw-r--r--npc/001-2-23/doors.txt2
-rw-r--r--npc/001-2-23/ratto.txt16
-rw-r--r--npc/001-2-24/nard.txt6
-rw-r--r--npc/001-2-28/plush.txt2
-rw-r--r--npc/001-2-29/savepoint.txt8
-rw-r--r--npc/001-2-32/doors.txt2
-rw-r--r--npc/001-2-34/doors.txt13
-rw-r--r--npc/001-2-36/training_room_npc.txt2
-rw-r--r--npc/commands/debug-look.txt8
-rw-r--r--npc/commands/debug-quest.txt8
-rw-r--r--npc/commands/debug-skill.txt4
-rw-r--r--npc/commands/debug.txt8
-rw-r--r--npc/commands/motd.txt14
-rw-r--r--npc/commands/scheduled-broadcasts.txt10
-rw-r--r--npc/dev/ci_test.txt8
-rw-r--r--npc/dev/test.txt1416
-rw-r--r--npc/functions/masks.txt24
-rw-r--r--npc/functions/npcmovegraph.txt4
31 files changed, 842 insertions, 843 deletions
diff --git a/npc/000-0-0/sailors.txt b/npc/000-0-0/sailors.txt
index 5e8f3867..5805994c 100644
--- a/npc/000-0-0/sailors.txt
+++ b/npc/000-0-0/sailors.txt
@@ -65,8 +65,8 @@ OnTalk:
restorecam;
adddefaultskills;
setq General_Narrator, 0;
- warp "000-2-1.gat", 50, 38;
- savepoint "000-2-1.gat", 50, 38;
+ warp "000-2-1", 50, 38;
+ savepoint "000-2-1", 50, 38;
closedialog;
close;
diff --git a/npc/000-0-1/narrator.txt b/npc/000-0-1/narrator.txt
index 4445a549..c83dbac7 100644
--- a/npc/000-0-1/narrator.txt
+++ b/npc/000-0-1/narrator.txt
@@ -26,8 +26,8 @@
if (countitem(JohanneKey) == 1) delitem JohanneKey, 1;
setq General_Narrator, 1;
setq ShipQuests_Nard, 6;
- savepoint "001-2-22.gat", 50, 38;
- warp "001-2-22.gat", 50, 38;
+ savepoint "001-2-22", 50, 38;
+ warp "001-2-22", 50, 38;
closedialog;
close;
diff --git a/npc/000-0/sailors.txt b/npc/000-0/sailors.txt
index cac7ff8c..a8b9a820 100644
--- a/npc/000-0/sailors.txt
+++ b/npc/000-0/sailors.txt
@@ -69,7 +69,7 @@ OnTouch:
mes col(l("Click on the NPCs (Non-Player Characters) around you to continue the introduction."), 9);
next;
- warp "000-0-0.gat", 26, 28;
+ warp "000-0-0", 26, 28;
closedialog;
close;
diff --git a/npc/000-2-0/julia.txt b/npc/000-2-0/julia.txt
index fd69beff..94ae91b2 100644
--- a/npc/000-2-0/julia.txt
+++ b/npc/000-2-0/julia.txt
@@ -34,14 +34,14 @@
000-2-0,27,24,0 script Julia NPC_JULIA,2,10,{
- function ynMenu {
+ function ynMenu {
if (select(l("Yes, I do."), l("No, none.")) == 1) {
return;
}
closedialog;
}
- function poisonJulia {
+ function poisonJulia {
mes "";
mesn;
mesq l("Seems yummy! Let me taste it!");
@@ -52,7 +52,7 @@
close;
}
- function gotoSleep {
+ function gotoSleep {
speech 5,
l("You already did enough for us, follow Nard's advice and get some rest."),
l("We are at half a day from our final destination, by the time that you wake up I'm sure that we will be there!"),
@@ -61,7 +61,7 @@
return;
}
- function heardRumors {
+ function heardRumors {
mes "";
mesn;
mesq l("You shouldn't believe every tale drunken sailors tell you.");
@@ -102,7 +102,7 @@
close;
}
- function gotRegrets {
+ function gotRegrets {
mes "";
mesn;
mesq l("Why? And who should you bring it back to?");
@@ -124,7 +124,7 @@
close;
}
- function basicSkill {
+ function basicSkill {
mes "";
mesn;
mesq l("Let me check into it...");
@@ -139,7 +139,7 @@
return;
}
- function chooseLang {
+ function chooseLang {
mes "";
mesn;
mesq l("Of course! Tell me which language you speak and I will change the note on the ship passenger list.");
@@ -185,7 +185,7 @@
return;
}
- function whereAmI {
+ function whereAmI {
mes "";
mesn;
mesq l("You're on a ship, we're on our way to the commercial capital of Artis.");
@@ -200,7 +200,7 @@
return;
}
- function whatHappened {
+ function whatHappened {
mes "";
mesn;
mesq l("We thought that you could help us understand this, all we know is that we found you cast in the sea, adrift on your raft.");
@@ -222,7 +222,7 @@
return;
}
- function readRules {
+ function readRules {
mes "";
mesn;
mesq l("Of course, they are on the left wall, go have a look at them.");
@@ -233,7 +233,7 @@
return;
}
- function mainMenu {
+ function mainMenu {
do
{
.@q2 = getq(ShipQuests_ChefGado);
diff --git a/npc/000-2-1/arpan.txt b/npc/000-2-1/arpan.txt
index e9f79e3b..b72e0b63 100644
--- a/npc/000-2-1/arpan.txt
+++ b/npc/000-2-1/arpan.txt
@@ -40,13 +40,13 @@
doevent "Magic Arpan::OnClothNotTaken";
L_Equip:
- warp "000-2-1.gat", 49, 32;
+ warp "000-2-1", 49, 32;
doevent "Magic Arpan::OnEquip";
close;
L_GetCloth:
- warp "000-2-1.gat", 49, 32;
+ warp "000-2-1", 49, 32;
doevent "Magic Arpan::OnClothNotTaken";
close;
@@ -67,13 +67,13 @@ L_EquipDone:
doevent "Magic Arpan::OnClothNotTaken";
L_Equip:
- warp "000-2-1.gat", 55, 32;
+ warp "000-2-1", 55, 32;
doevent "Magic Arpan::OnEquip";
close;
L_GetCloth:
- warp "000-2-1.gat", 55, 32;
+ warp "000-2-1", 55, 32;
doevent "Magic Arpan::OnClothNotTaken";
close;
diff --git a/npc/000-2-1/peter.txt b/npc/000-2-1/peter.txt
index 49f3575e..341087a2 100644
--- a/npc/000-2-1/peter.txt
+++ b/npc/000-2-1/peter.txt
@@ -1,4 +1,4 @@
-// Evol scripts.
+// Evol scripts.
// Authors:
// 4144
// Ablu
@@ -22,7 +22,7 @@
// 6 Did not start the quest.
// Others:
// .@peter = Peter variable.
-// "000-2-2.gat" - map with mobs.
+// "000-2-2" - map with mobs.
// "$@RAT_SAILOR_HELPER$" - Name of the participant.
// "$@RAT_SAILOR_DEATHS - Number of deaths when the participant starts the fight.
// "$@RAT_SAILOR_CONTROL" - Explanation of each index of the array.
@@ -211,7 +211,7 @@ OnStartOutside:
$@RAT_SAILOR_HELPER$ = strcharinfo(0);
$@RAT_SAILOR_DEATHS = PC_DIE_COUNTER;
initnpctimer;
- warp "000-2-2.gat", 48, 28;
+ warp "000-2-2", 48, 28;
doevent "RattosControl::OnSpawn";
goto L_Quit;
@@ -222,7 +222,7 @@ OnTimer2000:
if ($@RAT_SAILOR_CONTROL[9] > 100) goto L_Timeout;
if (PC_DIE_COUNTER > $@RAT_SAILOR_DEATHS) goto L_Dead;
if ($@RAT_SAILOR_CONTROL[1] && $@RAT_SAILOR_CONTROL[2] && $@RAT_SAILOR_CONTROL[3] && $@RAT_SAILOR_CONTROL[4]) goto L_Done;
- if (getmapusers("000-2-2.gat") == 0) goto L_CleaningEnd;
+ if (getmapusers("000-2-2") == 0) goto L_CleaningEnd;
goto L_CheckRattos;
end;
@@ -262,7 +262,7 @@ L_Logoff:
L_Dead:
// Warps the dead body outside, so it does not interfere with the getmapusers check.
- if (getmapusers("000-2-2.gat") > 0) warp "000-2-1", 72, 36;
+ if (getmapusers("000-2-2") > 0) warp "000-2-1", 72, 36;
goto L_CleaningEnd;
@@ -271,7 +271,7 @@ L_Done:
if($@RAT_SAILOR_CONTROL[10] < 5) goto L_NotYet;
.@peter = getq(ShipQuests_Peter);
if (.@peter == 2 || .@peter == 4) goto L_Reward;
- warp "000-2-1.gat", 72, 36;
+ warp "000-2-1", 72, 36;
goto L_Thanks;
@@ -280,10 +280,10 @@ L_CleaningEnd:
$@RAT_SAILOR_HELPER$ = "";
$@RAT_SAILOR_DEATHS = 0;
cleararray $@RAT_SAILOR_CONTROL, 0, 11;
- killmonster "000-2-2.gat", "RattosControl::OnRatto1Death";
- killmonster "000-2-2.gat", "RattosControl::OnRatto2Death";
- killmonster "000-2-2.gat", "RattosControl::OnRatto3Death";
- killmonster "000-2-2.gat", "RattosControl::OnRatto4Death";
+ killmonster "000-2-2", "RattosControl::OnRatto1Death";
+ killmonster "000-2-2", "RattosControl::OnRatto2Death";
+ killmonster "000-2-2", "RattosControl::OnRatto3Death";
+ killmonster "000-2-2", "RattosControl::OnRatto4Death";
end;
@@ -293,16 +293,16 @@ L_CleaningClose:
$@RAT_SAILOR_HELPER$ = "";
$@RAT_SAILOR_DEATHS = 0;
cleararray $@RAT_SAILOR_CONTROL, 0, 11;
- killmonster "000-2-2.gat", "RattosControl::OnRatto1Death";
- killmonster "000-2-2.gat", "RattosControl::OnRatto2Death";
- killmonster "000-2-2.gat", "RattosControl::OnRatto3Death";
- killmonster "000-2-2.gat", "RattosControl::OnRatto4Death";
+ killmonster "000-2-2", "RattosControl::OnRatto1Death";
+ killmonster "000-2-2", "RattosControl::OnRatto2Death";
+ killmonster "000-2-2", "RattosControl::OnRatto3Death";
+ killmonster "000-2-2", "RattosControl::OnRatto4Death";
$@RAT_SAILOR_COUNTDOWN = gettimetick(2);
close;
L_Reward:
- warp "000-2-1.gat", 72, 36;
+ warp "000-2-1", 72, 36;
setq ShipQuests_Peter, 5;
.@peter = getq(ShipQuests_Peter);
mesn;
diff --git a/npc/000-2-1/story_save.txt b/npc/000-2-1/story_save.txt
index e46841c1..de2c1693 100644
--- a/npc/000-2-1/story_save.txt
+++ b/npc/000-2-1/story_save.txt
@@ -20,7 +20,7 @@ OnClick:
}
else
{
- savepointparticle "000-2-1.gat", 50, 38;
+ savepointparticle "000-2-1", 50, 38;
}
close;
diff --git a/npc/000-2-2/doors.txt b/npc/000-2-2/doors.txt
index 5c57b66f..1dbef832 100644
--- a/npc/000-2-2/doors.txt
+++ b/npc/000-2-2/doors.txt
@@ -9,7 +9,7 @@
000-2-2,48,29,0 script DoorUpwards NPC_HIDDEN,0,0,{
OnTouch:
- if (mobcount("000-2-2.gat","all") > 0) goto L_Warn;
+ if (mobcount("000-2-2","all") > 0) goto L_Warn;
goto L_Warp;
diff --git a/npc/000-2-2/ratto.txt b/npc/000-2-2/ratto.txt
index 2ff5c572..1392d571 100644
--- a/npc/000-2-2/ratto.txt
+++ b/npc/000-2-2/ratto.txt
@@ -20,32 +20,32 @@
000-2-2,47,30,0 script RattosControl NPC_HIDDEN,{
OnSpawn:
- areamonster "000-2-2.gat", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl::OnRatto1Death";
- areamonster "000-2-2.gat", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl::OnRatto2Death";
- areamonster "000-2-2.gat", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl::OnRatto3Death";
- areamonster "000-2-2.gat", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl::OnRatto4Death";
+ areamonster "000-2-2", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl::OnRatto1Death";
+ areamonster "000-2-2", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl::OnRatto2Death";
+ areamonster "000-2-2", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl::OnRatto3Death";
+ areamonster "000-2-2", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl::OnRatto4Death";
close;
OnRatto1Respawn:
- areamonster "000-2-2.gat", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl::OnRatto1Death";
+ areamonster "000-2-2", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl::OnRatto1Death";
$@RAT_SAILOR_CONTROL[1] = 0;
$@RAT_SAILOR_CONTROL[5] = 0;
end;
OnRatto2Respawn:
- areamonster "000-2-2.gat", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl::OnRatto2Death";
+ areamonster "000-2-2", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl::OnRatto2Death";
$@RAT_SAILOR_CONTROL[2] = 0;
$@RAT_SAILOR_CONTROL[6] = 0;
end;
OnRatto3Respawn:
- areamonster "000-2-2.gat", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl::OnRatto3Death";
+ areamonster "000-2-2", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl::OnRatto3Death";
$@RAT_SAILOR_CONTROL[3] = 0;
$@RAT_SAILOR_CONTROL[7] = 0;
end;
OnRatto4Respawn:
- areamonster "000-2-2.gat", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl::OnRatto4Death";
+ areamonster "000-2-2", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl::OnRatto4Death";
$@RAT_SAILOR_CONTROL[4] = 0;
$@RAT_SAILOR_CONTROL[8] = 0;
end;
diff --git a/npc/000-2-3/nard.txt b/npc/000-2-3/nard.txt
index 66fc2a80..0526b790 100644
--- a/npc/000-2-3/nard.txt
+++ b/npc/000-2-3/nard.txt
@@ -238,14 +238,14 @@ L_GoBackArtis:
speech 5,
l("Let's set sail then!");
- savepoint "001-2-22.gat", 50, 38;
+ savepoint "001-2-22", 50, 38;
if (!getmapxy(.@map$, .@x, .@y, 0))
{
- warp "001-2-24.gat", .@x, .@y;
+ warp "001-2-24", .@x, .@y;
}
else
{
- warp "001-2-24.gat", 22, 27;
+ warp "001-2-24", 22, 27;
}
closedialog;
diff --git a/npc/001-1/cookiemaster.txt b/npc/001-1/cookiemaster.txt
index 118d7377..77f95baa 100644
--- a/npc/001-1/cookiemaster.txt
+++ b/npc/001-1/cookiemaster.txt
@@ -208,7 +208,7 @@ L_Kick:
closedialog;
npctalk3 l("No cookie for you!");
- warp "001-1.gat", 39, 41;
+ warp "001-1", 39, 41;
close;
diff --git a/npc/001-2-22/note.txt b/npc/001-2-22/note.txt
index c330ecf5..36d62029 100644
--- a/npc/001-2-22/note.txt
+++ b/npc/001-2-22/note.txt
@@ -4,7 +4,7 @@
// Description:
//
-001-2-22.gat,22,33,0 script Note#001-2-22 NPC_NO_SPRITE,{
+001-2-22,22,33,0 script Note#001-2-22 NPC_NO_SPRITE,{
mesn;
mesq l("This note was left by somebody.");
next;
diff --git a/npc/001-2-22/peter.txt b/npc/001-2-22/peter.txt
index c71fc446..0365392a 100644
--- a/npc/001-2-22/peter.txt
+++ b/npc/001-2-22/peter.txt
@@ -1,4 +1,4 @@
-// Evol scripts.
+// Evol scripts.
// Authors:
// 4144
// Ablu
@@ -22,7 +22,7 @@
// 6 Did not start the quest.
// Others:
// .@peter = Peter#001-2-22 variable.
-// "001-2-23.gat" - map with mobs.
+// "001-2-23" - map with mobs.
// "$@ARTIS_RAT1_HELPER$" - Name of the participant.
// "$@ARTIS_RAT1_DEATHS - Number of deaths when the participant starts the fight.
// "$@ARTIS_RAT1_CONTROL" - Explanation of each index of the array.
@@ -207,7 +207,7 @@ OnStartOutside:
$@ARTIS_RAT1_HELPER$ = strcharinfo(0);
$@ARTIS_RAT1_DEATHS = PC_DIE_COUNTER;
initnpctimer;
- warp "001-2-23.gat", 48, 28;
+ warp "001-2-23", 48, 28;
doevent "RattosControl#001-2-23::OnSpawn";
goto L_Quit;
@@ -218,7 +218,7 @@ OnTimer2000:
if ($@ARTIS_RAT1_CONTROL[9] > 100) goto L_Timeout;
if (PC_DIE_COUNTER > $@ARTIS_RAT1_DEATHS) goto L_Dead;
if ($@ARTIS_RAT1_CONTROL[1] && $@ARTIS_RAT1_CONTROL[2] && $@ARTIS_RAT1_CONTROL[3] && $@ARTIS_RAT1_CONTROL[4]) goto L_Done;
- if (getmapusers("001-2-23.gat") == 0) goto L_CleaningEnd;
+ if (getmapusers("001-2-23") == 0) goto L_CleaningEnd;
goto L_CheckRattos;
end;
@@ -258,7 +258,7 @@ L_Logoff:
L_Dead:
// Warps the dead body outside, so it does not interfere with the getmapusers check.
- if (getmapusers("001-2-23.gat") > 0) warp "001-2-22", 72, 36;
+ if (getmapusers("001-2-23") > 0) warp "001-2-22", 72, 36;
goto L_CleaningEnd;
@@ -267,7 +267,7 @@ L_Done:
if($@ARTIS_RAT1_CONTROL[10] < 5) goto L_NotYet;
.@peter = getq(ShipQuests_Peter);
if (.@peter == 2 || .@peter == 4) goto L_Reward;
- warp "001-2-22.gat", 72, 36;
+ warp "001-2-22", 72, 36;
goto L_Thanks;
@@ -276,10 +276,10 @@ L_CleaningEnd:
$@ARTIS_RAT1_HELPER$ = "";
$@ARTIS_RAT1_DEATHS = 0;
cleararray $@ARTIS_RAT1_CONTROL, 0, 11;
- killmonster "001-2-23.gat", "RattosControl#001-2-23::OnRatto1Death";
- killmonster "001-2-23.gat", "RattosControl#001-2-23::OnRatto2Death";
- killmonster "001-2-23.gat", "RattosControl#001-2-23::OnRatto3Death";
- killmonster "001-2-23.gat", "RattosControl#001-2-23::OnRatto4Death";
+ killmonster "001-2-23", "RattosControl#001-2-23::OnRatto1Death";
+ killmonster "001-2-23", "RattosControl#001-2-23::OnRatto2Death";
+ killmonster "001-2-23", "RattosControl#001-2-23::OnRatto3Death";
+ killmonster "001-2-23", "RattosControl#001-2-23::OnRatto4Death";
end;
@@ -289,16 +289,16 @@ L_CleaningClose:
$@ARTIS_RAT1_HELPER$ = "";
$@ARTIS_RAT1_DEATHS = 0;
cleararray $@ARTIS_RAT1_CONTROL, 0, 11;
- killmonster "001-2-23.gat", "RattosControl#001-2-23::OnRatto1Death";
- killmonster "001-2-23.gat", "RattosControl#001-2-23::OnRatto2Death";
- killmonster "001-2-23.gat", "RattosControl#001-2-23::OnRatto3Death";
- killmonster "001-2-23.gat", "RattosControl#001-2-23::OnRatto4Death";
+ killmonster "001-2-23", "RattosControl#001-2-23::OnRatto1Death";
+ killmonster "001-2-23", "RattosControl#001-2-23::OnRatto2Death";
+ killmonster "001-2-23", "RattosControl#001-2-23::OnRatto3Death";
+ killmonster "001-2-23", "RattosControl#001-2-23::OnRatto4Death";
$@ARTIS_RAT1_COUNTDOWN = gettimetick(2);
close;
L_Reward:
- warp "001-2-22.gat", 72, 36;
+ warp "001-2-22", 72, 36;
setq ShipQuests_Peter, 5;
.@peter = getq(ShipQuests_Peter);
mesn;
diff --git a/npc/001-2-23/doors.txt b/npc/001-2-23/doors.txt
index e7a7bbea..bb192082 100644
--- a/npc/001-2-23/doors.txt
+++ b/npc/001-2-23/doors.txt
@@ -9,7 +9,7 @@
001-2-23,48,29,0 script DoorUpwards#001-2-23 NPC_HIDDEN,0,0,{
OnTouch:
- if (mobcount("001-2-23.gat","all") > 0) goto L_Warn;
+ if (mobcount("001-2-23","all") > 0) goto L_Warn;
goto L_Warp;
diff --git a/npc/001-2-23/ratto.txt b/npc/001-2-23/ratto.txt
index 3b5e6e8d..91a822d3 100644
--- a/npc/001-2-23/ratto.txt
+++ b/npc/001-2-23/ratto.txt
@@ -20,32 +20,32 @@
001-2-23,47,30,0 script RattosControl#001-2-23 NPC_HIDDEN,{
OnSpawn:
- areamonster "001-2-23.gat", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl#001-2-23::OnRatto1Death";
- areamonster "001-2-23.gat", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl#001-2-23::OnRatto2Death";
- areamonster "001-2-23.gat", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl#001-2-23::OnRatto3Death";
- areamonster "001-2-23.gat", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl#001-2-23::OnRatto4Death";
+ areamonster "001-2-23", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl#001-2-23::OnRatto1Death";
+ areamonster "001-2-23", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl#001-2-23::OnRatto2Death";
+ areamonster "001-2-23", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl#001-2-23::OnRatto3Death";
+ areamonster "001-2-23", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl#001-2-23::OnRatto4Death";
close;
OnRatto1Respawn:
- areamonster "001-2-23.gat", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl#001-2-23::OnRatto1Death";
+ areamonster "001-2-23", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl#001-2-23::OnRatto1Death";
$@ARTIS_RAT1_CONTROL[1] = 0;
$@ARTIS_RAT1_CONTROL[5] = 0;
end;
OnRatto2Respawn:
- areamonster "001-2-23.gat", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl#001-2-23::OnRatto2Death";
+ areamonster "001-2-23", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl#001-2-23::OnRatto2Death";
$@ARTIS_RAT1_CONTROL[2] = 0;
$@ARTIS_RAT1_CONTROL[6] = 0;
end;
OnRatto3Respawn:
- areamonster "001-2-23.gat", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl#001-2-23::OnRatto3Death";
+ areamonster "001-2-23", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl#001-2-23::OnRatto3Death";
$@ARTIS_RAT1_CONTROL[3] = 0;
$@ARTIS_RAT1_CONTROL[7] = 0;
end;
OnRatto4Respawn:
- areamonster "001-2-23.gat", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl#001-2-23::OnRatto4Death";
+ areamonster "001-2-23", 23, 19, 50, 40, "Ratto", 1005, 1, "RattosControl#001-2-23::OnRatto4Death";
$@ARTIS_RAT1_CONTROL[4] = 0;
$@ARTIS_RAT1_CONTROL[8] = 0;
end;
diff --git a/npc/001-2-24/nard.txt b/npc/001-2-24/nard.txt
index f999e542..422eca36 100644
--- a/npc/001-2-24/nard.txt
+++ b/npc/001-2-24/nard.txt
@@ -54,14 +54,14 @@
speech 5,
l("Let's set sail then!");
- savepoint "000-2-1.gat", 50, 38;
+ savepoint "000-2-1", 50, 38;
if (!getmapxy(.@map$, .@x, .@y, 0))
{
- warp "000-2-3.gat", .@x, .@y;
+ warp "000-2-3", .@x, .@y;
}
else
{
- warp "000-2-3.gat", 22, 27;
+ warp "000-2-3", 22, 27;
}
closedialog;
diff --git a/npc/001-2-28/plush.txt b/npc/001-2-28/plush.txt
index 1bfb097d..3c6fd5ea 100644
--- a/npc/001-2-28/plush.txt
+++ b/npc/001-2-28/plush.txt
@@ -35,7 +35,7 @@
lg("I registered you on the @@ room of the upper level.",
(Sex == G_FEMALE) ? "4th" : "2nd"),
l("You can go upstairs and choose a different room if you want.");
- savepoint "001-2-29.gat", 29, (Sex == G_FEMALE) ? 49 : 35;
+ savepoint "001-2-29", 29, (Sex == G_FEMALE) ? 49 : 35;
}
}
diff --git a/npc/001-2-29/savepoint.txt b/npc/001-2-29/savepoint.txt
index 01af2b8b..a3206b12 100644
--- a/npc/001-2-29/savepoint.txt
+++ b/npc/001-2-29/savepoint.txt
@@ -5,7 +5,7 @@
// Saves locations in 001-2-29 map.
001-2-29,29,28,0 script #001-2-29-1 NPC_SAVE_POINT,0,0,{
- bedClic ("001-2-29.gat", 29, 28, REDPLUSH_INN);
+ bedClic ("001-2-29", 29, 28, REDPLUSH_INN);
OnInit:
.distance = 2;
@@ -20,7 +20,7 @@ OnPCDieEvent:
}
001-2-29,29,35,0 script #001-2-29-2 NPC_SAVE_POINT,0,0,{
- bedClic ("001-2-29.gat", 29, 35, REDPLUSH_INN);
+ bedClic ("001-2-29", 29, 35, REDPLUSH_INN);
OnInit:
.distance = 2;
@@ -31,7 +31,7 @@ OnTouch:
}
001-2-29,29,42,0 script #001-2-29-3 NPC_SAVE_POINT,0,0,{
- bedClic ("001-2-29.gat", 29, 42, REDPLUSH_INN);
+ bedClic ("001-2-29", 29, 42, REDPLUSH_INN);
OnInit:
.distance = 2;
@@ -42,7 +42,7 @@ OnTouch:
}
001-2-29,29,49,0 script #001-2-29-4 NPC_SAVE_POINT,0,0,{
- bedClic ("001-2-29.gat", 29, 49, REDPLUSH_INN);
+ bedClic ("001-2-29", 29, 49, REDPLUSH_INN);
OnInit:
.distance = 2;
diff --git a/npc/001-2-32/doors.txt b/npc/001-2-32/doors.txt
index 45d7415a..59ee35eb 100644
--- a/npc/001-2-32/doors.txt
+++ b/npc/001-2-32/doors.txt
@@ -7,7 +7,7 @@
001-2-32,33,29,0 script ToFightRoom#001-2-32 NPC_HIDDEN,0,0,{
OnTouch:
- if (mobcount("001-2-35.gat","all") > 0)
+ if (mobcount("001-2-35","all") > 0)
{
narrator
l("You hear some sound behind the door."),
diff --git a/npc/001-2-34/doors.txt b/npc/001-2-34/doors.txt
index b4a483e9..3e4fef7b 100644
--- a/npc/001-2-34/doors.txt
+++ b/npc/001-2-34/doors.txt
@@ -7,14 +7,13 @@
001-2-34,23,29,0 script ToTrainingRoom#001-2-34 NPC_HIDDEN,0,0,{
OnTouch:
- if ((getmapusers($@MAP_NAME$) == 0) && ($@FightingIsActive > 0))
- {
- set $@FightingIsActive, 0;
- killmonsterall "001-2-36.gat";
-
- }
+ if ((getmapusers($@MAP_NAME$) == 0) && ($@FightingIsActive > 0))
+ {
+ set $@FightingIsActive, 0;
+ killmonsterall "001-2-36";
+ }
- if (mobcount("001-2-36.gat","all") > 0 && $@FightingIsActive > 0)
+ if (mobcount("001-2-36","all") > 0 && $@FightingIsActive > 0)
{
narrator
l("You hear some sound behind the door."),
diff --git a/npc/001-2-36/training_room_npc.txt b/npc/001-2-36/training_room_npc.txt
index d7ec9690..ce56651c 100644
--- a/npc/001-2-36/training_room_npc.txt
+++ b/npc/001-2-36/training_room_npc.txt
@@ -30,7 +30,7 @@
//Room and Mobspawn Coordinates
// TL BR
setarray $@MOB_SPAWN_COORDINATES, 24, 34, 31, 41;
- setarray $@MAP_NAME$, "001-2-36.gat";
+ setarray $@MAP_NAME$, "001-2-36";
set @roomPlayers, getmapusers($@MAP_NAME$);
diff --git a/npc/commands/debug-look.txt b/npc/commands/debug-look.txt
index 3c4640c5..ef12e83e 100644
--- a/npc/commands/debug-look.txt
+++ b/npc/commands/debug-look.txt
@@ -1,6 +1,6 @@
function script BarberDebug {
- function setGender {
+ function setGender {
//clear;
//setnpcdialogtitle l("Appearance Debug - Sex Change");
//mes l("Please choose the desired gender:");
@@ -18,7 +18,7 @@ function script BarberDebug {
closedialog;
changecharsex;
}
- function setStyle {
+ function setStyle {
clear;
setnpcdialogtitle l("Appearance Debug - Barber");
mes l("Hair style") + ": " + getlook (LOOK_HAIR);
@@ -28,7 +28,7 @@ function script BarberDebug {
setlook LOOK_HAIR, max(1, min(0xFF, .@h));
return;
}
- function setColor {
+ function setColor {
clear;
setnpcdialogtitle l("Appearance Debug - Barber");
mes l("Hair color") + ": " + getlook (LOOK_HAIR_COLOR);
@@ -38,7 +38,7 @@ function script BarberDebug {
setlook LOOK_HAIR_COLOR, max(0, min(0xFF, .@h));
return;
}
- function setRace {
+ function setRace {
clear;
setnpcdialogtitle l("Appearance Debug - Race");
mes l("Race") + ": " + Class;
diff --git a/npc/commands/debug-quest.txt b/npc/commands/debug-quest.txt
index a37b09bf..041879d2 100644
--- a/npc/commands/debug-quest.txt
+++ b/npc/commands/debug-quest.txt
@@ -1,7 +1,7 @@
function script GlobalQuestDebug {
- function qDebugShip {
- function qDebugGugli {
+ function qDebugShip {
+ function qDebugGugli {
do
{
clear;
@@ -60,7 +60,7 @@ function script GlobalQuestDebug {
} while (1);
}
- function qDebugArtis {
+ function qDebugArtis {
do
{
clear;
@@ -90,7 +90,7 @@ function script GlobalQuestDebug {
} while (1);
}
- function qDebugGeneral {
+ function qDebugGeneral {
do
{
clear;
diff --git a/npc/commands/debug-skill.txt b/npc/commands/debug-skill.txt
index 187c4009..f4a55a50 100644
--- a/npc/commands/debug-skill.txt
+++ b/npc/commands/debug-skill.txt
@@ -1,8 +1,8 @@
function script GlobalSkillDebug {
- function modifySkill {
+ function modifySkill {
- function setSkill {
+ function setSkill {
clear;
mes l("Enter desired skill level:");
input .@y;
diff --git a/npc/commands/debug.txt b/npc/commands/debug.txt
index b768542b..83387d26 100644
--- a/npc/commands/debug.txt
+++ b/npc/commands/debug.txt
@@ -1,6 +1,6 @@
function script GlobalDebugMenu {
- function resetAll {
- function doReset {
+ function resetAll {
+ function doReset {
resetstatus;
resetskill;
resetlvl 1;
@@ -35,7 +35,7 @@ function script GlobalDebugMenu {
return;
}
- function changeLevel {
+ function changeLevel {
clear;
setnpcdialogtitle l("Debug - Change level");
mes l("To change your base level, use this command:");
@@ -60,7 +60,7 @@ function script GlobalDebugMenu {
next;
return;
}
- function changeStats {
+ function changeStats {
clear;
setnpcdialogtitle l("Debug - Change stats");
mes l("To change your stats, use these commands:");
diff --git a/npc/commands/motd.txt b/npc/commands/motd.txt
index 98a63e87..0e2f5134 100644
--- a/npc/commands/motd.txt
+++ b/npc/commands/motd.txt
@@ -25,12 +25,12 @@ function script displayMOTD {
function script MOTDConfig {
- function toggleMOTD {
+ function toggleMOTD {
$MOTD_Disabled = !($MOTD_Disabled);
// FIXME: log to GM log
}
- function addNewLine {
+ function addNewLine {
clear;
mes l("Please enter the new line.");
input .@s$;
@@ -44,9 +44,9 @@ function script MOTDConfig {
}
}
- function modifyLine {
+ function modifyLine {
- function removeLine {
+ function removeLine {
.@l = getarg(0);
deletearray $MOTD_Messages$[.@l], 1; // remove and shift
mes l("Line @@ has been removed.", .@l);
@@ -54,21 +54,21 @@ function script MOTDConfig {
// FIXME: log to GM log
}
- function moveUp {
+ function moveUp {
.@l = getarg(0);
.@top$ = $MOTD_Messages$[.@l - 1];
$MOTD_Messages$[.@l - 1] = $MOTD_Messages$[.@l];
$MOTD_Messages$[.@l] = .@top$;
}
- function moveDown {
+ function moveDown {
.@l = getarg(0);
.@bottom$ = $MOTD_Messages$[.@l + 1];
$MOTD_Messages$[.@l + 1] = $MOTD_Messages$[.@l];
$MOTD_Messages$[.@l] = .@bottom$;
}
- function editLine {
+ function editLine {
.@l = getarg(0);
clear;
mes l("Old line:");
diff --git a/npc/commands/scheduled-broadcasts.txt b/npc/commands/scheduled-broadcasts.txt
index 51f1f6a6..370da41a 100644
--- a/npc/commands/scheduled-broadcasts.txt
+++ b/npc/commands/scheduled-broadcasts.txt
@@ -1,6 +1,6 @@
function script StoneBoard {
- function setMessage {
+ function setMessage {
do
{
clear;
@@ -17,7 +17,7 @@ function script StoneBoard {
} while (1);
}
- function setInterval {
+ function setInterval {
clear;
mes l("Please select the interval:");
next;
@@ -33,7 +33,7 @@ function script StoneBoard {
return @menuret;
}
- function setMaxRep {
+ function setMaxRep {
if (getarg(0,0) == 0)
{
return 0;
@@ -53,7 +53,7 @@ function script StoneBoard {
return @menuret;
}
- function setOnLogin {
+ function setOnLogin {
if (getarg(0,0) == 0)
{
return 1;
@@ -68,7 +68,7 @@ function script StoneBoard {
return (@menu - 1);
}
- function newBroadcast {
+ function newBroadcast {
do
{
setnpcdialogtitle l("Scheduled broadcasts - Create new");
diff --git a/npc/dev/ci_test.txt b/npc/dev/ci_test.txt
index c55c87e5..6ee12452 100644
--- a/npc/dev/ci_test.txt
+++ b/npc/dev/ci_test.txt
@@ -38,10 +38,10 @@
//=========================================================================
- script HerculesSelfTestCI FAKE_NPC,{
- end;
+ end;
OnInit:
- .@val = callfunc("HerculesSelfTestHelper");
- mapquit(.@val);
- end;
+ .@val = callfunc("HerculesSelfTestHelper");
+ mapquit(.@val);
+ end;
}
diff --git a/npc/dev/test.txt b/npc/dev/test.txt
index 6342bc58..e9058aee 100644
--- a/npc/dev/test.txt
+++ b/npc/dev/test.txt
@@ -34,781 +34,781 @@
//=========================================================================
function script F_TestReturnValue {
- return getarg(0);
+ return getarg(0);
}
function script F_TestScopeVars {
- .@x = 2;
- return .@x+1;
+ .@x = 2;
+ return .@x+1;
}
function script F_TestNPCVars {
- .xt = 2;
- return .xt+1;
+ .xt = 2;
+ return .xt+1;
}
function script F_TestDeepNestedScope {
- if (getarg(0) <= 0)
- return getarg(1); // Stop recursion
- if (getarg(1))
- return callfunc("F_TestDeepNestedScope", getarg(0)-1, getarg(1)); // Recursion step
- .@x = 1;
- return callfunc("F_TestDeepNestedScope", getarg(0)-1, .@x); // First step
+ if (getarg(0) <= 0)
+ return getarg(1); // Stop recursion
+ if (getarg(1))
+ return callfunc("F_TestDeepNestedScope", getarg(0)-1, getarg(1)); // Recursion step
+ .@x = 1;
+ return callfunc("F_TestDeepNestedScope", getarg(0)-1, .@x); // First step
}
function script F_TestDeepNestedScopeNPC2 {
- if (getarg(0) <= 0)
- return getarg(1); // Stop recursion
- if (getarg(1))
- return callfunc("F_TestDeepNestedScopeNPC", getarg(0)-1, getarg(1)); // Recursion step
- .xt = 1;
- return callfunc("F_TestDeepNestedScopeNPC", getarg(0)-1, .xt); // First step
+ if (getarg(0) <= 0)
+ return getarg(1); // Stop recursion
+ if (getarg(1))
+ return callfunc("F_TestDeepNestedScopeNPC", getarg(0)-1, getarg(1)); // Recursion step
+ .xt = 1;
+ return callfunc("F_TestDeepNestedScopeNPC", getarg(0)-1, .xt); // First step
}
function script F_TestDeepNestedScopeNPC {
- if (getarg(0) <= 0)
- return getarg(1); // Stop recursion
- if (getarg(1))
- return callfunc("F_TestDeepNestedScopeNPC2", getarg(0)-1, getarg(1)); // Recursion step
- .xt = 1;
- return callfunc("F_TestDeepNestedScopeNPC2", getarg(0)-1, .xt); // First step
+ if (getarg(0) <= 0)
+ return getarg(1); // Stop recursion
+ if (getarg(1))
+ return callfunc("F_TestDeepNestedScopeNPC2", getarg(0)-1, getarg(1)); // Recursion step
+ .xt = 1;
+ return callfunc("F_TestDeepNestedScopeNPC2", getarg(0)-1, .xt); // First step
}
function script F_TestNestedScope {
- .@x = 1;
- .@y = callfunc("F_TestReturnValue", .@x);
- return .@y;
+ .@x = 1;
+ .@y = callfunc("F_TestReturnValue", .@x);
+ return .@y;
}
function script F_TestNestedScopeNPC {
- .xt = 1;
- .yt = callfunc("F_TestReturnValue", .xt);
- return .yt;
+ .xt = 1;
+ .yt = callfunc("F_TestReturnValue", .xt);
+ return .yt;
}
function script F_TestArrayRefs {
- return getelementofarray(getarg(0), getarraysize(getarg(0)) - 1);
+ return getelementofarray(getarg(0), getarraysize(getarg(0)) - 1);
}
function script F_TestReturnArrayRef {
- setarray getarg(0), 5, 6, 7, 8;
- return getarraysize(getarg(0));
+ setarray getarg(0), 5, 6, 7, 8;
+ return getarraysize(getarg(0));
}
function script F_TestScopeArrays {
- setarray .@x, 1, 2, 3, 4;
- copyarray .@y, getarg(0), getarraysize(getarg(0));
- return getarraysize(.@y);
+ setarray .@x, 1, 2, 3, 4;
+ copyarray .@y, getarg(0), getarraysize(getarg(0));
+ return getarraysize(.@y);
}
function script F_TestNPCArrays {
- setarray .xt, 1, 2, 3, 4;
- copyarray .yt, getarg(0), getarraysize(getarg(0));
- return getarraysize(.yt);
+ setarray .xt, 1, 2, 3, 4;
+ copyarray .yt, getarg(0), getarraysize(getarg(0));
+ return getarraysize(.yt);
}
function script F_TestVarOfAnotherNPC {
- return getvariableofnpc(.xt, getarg(0));
+ return getvariableofnpc(.xt, getarg(0));
}
- script TestVarOfAnotherNPC FAKE_NPC,{
- // Used to test getvariableofnpc()
- end;
+ // Used to test getvariableofnpc()
+ end;
}
function script HerculesSelfTestHelper {
- if (.once > 0)
- return .errors;
- .once = 1;
- .errors = 0;
-
- // Callsub (basic)
- callsub(OnCheck, "Callsub", 1, 1);
- callsub(OnCheck, "Callsub (getarg default values)", 1);
-
-
- // Array subscript
- setarray .@a, 3, 2, 1;
- callsub(OnCheck, "Array subscript", .@a[2]);
-
-
- // Increment and decrement operators ++, --
- .@x = 1;
- .@y = .@x++; // .@y = .@x; .@x = .@x + 1;
- callsub(OnCheck, "Suffix increment ++", .@y);
- callsub(OnCheck, "Suffix increment ++", .@x, 2);
- .@x = 1;
- .@y = .@x--; // .@y = .@x; .@x = .@x - 1;
- callsub(OnCheck, "Suffix decrement --", .@y);
- callsub(OnCheck, "Suffix decrement --", .@x, 0);
- .@x = 0;
- .@y = ++.@x; // .@x = .@x + 1; .@y = .@x;
- callsub(OnCheck, "Prefix increment ++", .@y);
- callsub(OnCheck, "Prefix increment ++", .@x);
- .@x = 2;
- .@y = --.@x; // .@x = .@x - 1; .@y = .@x;
- callsub(OnCheck, "Prefix decrement --", .@y);
- callsub(OnCheck, "Prefix decrement --", .@x);
-
- // Order of [] and --/++
- .@a[1] = 0;
- .@a[1]++; // .@a[1] = .@a[1] + 1;
- callsub(OnCheck, "Order of [] and ++", .@a[1]);
- .@a[1] = 2;
- .@a[1]--; // .@a[1] = .@a[1] - 1;
- callsub(OnCheck, "Order of [] and --", .@a[1]);
-
-
- // Unary operators -, !, ~
- .@x = 1;
- .@y = -.@x; // .@y = 0 - .@x;
- callsub(OnCheck, "Unary operator -", .@y, -1);
- .@x = 1;
- .@y = !.@x; // if(.@x == 0) .@y = 1; else .@y = 0;
- callsub(OnCheck, "Unary operator !", .@y, 0);
- .@x = 0x00000001;
- .@y = ~.@x; // One's complement of 0x00000001 is 0xfffffffe, which is -2
- callsub(OnCheck, "Unary operator ~", .@y, -2);
-
- // Associativity of unary operators -, !, ~
- .@x = 1;
- .@y = ~ ! .@x; // .@y = ~(!.@x);
- callsub(OnCheck, "Associativity of unary ~ and !", .@y, -1);
- .@x = 0;
- .@y = - ! .@x; // .@y = -(!.@x);
- callsub(OnCheck, "Associativity of unary - and !", .@y, -1);
- .@x = 1;
- .@y = ~ - .@x; // .@y = ~(-.@x);
- callsub(OnCheck, "Associativity of unary ~ and -", .@y, 0);
- .@x = 1;
- .@y = - ~ .@x; // .@y = -(~.@x);
- callsub(OnCheck, "Associativity of unary - and ~", .@y, 2);
-
- // Order of unary -, !, ~ and prefix/suffix ++/--
- .@x = 2;
- .@y = - --.@x; // .@y = -(--.@x);
- callsub(OnCheck, "Order of unary - and prefix --", .@y, -1);
- callsub(OnCheck, "Order of unary - and prefix --", .@x);
- .@x = 1;
- .@y = - .@x--; // .@y = -(.@x--);
- callsub(OnCheck, "Order of unary - and suffix --", .@y, -1);
- callsub(OnCheck, "Order of unary - and suffix --", .@x, 0);
- .@x = 0;
- .@y = - ++.@x; // .@y = -(++.@x);
- callsub(OnCheck, "Order of unary - and prefix ++", .@y, -1);
- callsub(OnCheck, "Order of unary - and prefix ++", .@x);
- .@x = 1;
- .@y = - .@x++; // .@y = -(.@x++);
- callsub(OnCheck, "Order of unary - and suffix ++", .@y, -1);
- callsub(OnCheck, "Order of unary - and suffix ++", .@x, 2);
- .@x = 1;
- .@y = !--.@x; // .@y = !(--.@x);
- callsub(OnCheck, "Order of unary ! and prefix --", .@y);
- callsub(OnCheck, "Order of unary ! and prefix --", .@x, 0);
- .@x = 1;
- .@y = !.@x--; // .@y = !(.@x--);
- callsub(OnCheck, "Order of unary ! and suffix --", .@y, 0);
- callsub(OnCheck, "Order of unary ! and suffix --", .@x, 0);
- .@x = 0;
- .@y = !++.@x; // .@y = !(++.@x);
- callsub(OnCheck, "Order of unary ! and prefix ++", .@y, 0);
- callsub(OnCheck, "Order of unary ! and prefix ++", .@x);
- .@x = 0;
- .@y = !.@x++; // .@y = !(.@x++);
- callsub(OnCheck, "Order of unary ! and suffix ++", .@y);
- callsub(OnCheck, "Order of unary ! and suffix ++", .@x);
- .@x = 2;
- .@y = ~--.@x; // .@y = ~(--.@x);
- callsub(OnCheck, "Order of unary ~ and prefix --", .@y, -2);
- callsub(OnCheck, "Order of unary ~ and prefix --", .@x, 1);
- .@x = 1;
- .@y = ~.@x--; // .@y = ~(.@x--);
- callsub(OnCheck, "Order of unary ~ and suffix --", .@y, -2);
- callsub(OnCheck, "Order of unary ~ and suffix --", .@x, 0);
- .@x = 0;
- .@y = ~++.@x; // .@y = ~(++.@x);
- callsub(OnCheck, "Order of unary ~ and prefix ++", .@y, -2);
- callsub(OnCheck, "Order of unary ~ and prefix ++", .@x, 1);
- .@x = 1;
- .@y = ~.@x++; // .@y = ~(.@x++);
- callsub(OnCheck, "Order of unary ~ and suffix ++", .@y, -2);
- callsub(OnCheck, "Order of unary ~ and suffix ++", .@x, 2);
-
- // Binary *, /, % operators
- .@x = 2 * 3; // .@x = 6;
- callsub(OnCheck, "Binary * operator", .@x, 6);
- .@x = 7 / 2; // .@x = 3;
- callsub(OnCheck, "Binary / operator", .@x, 3);
- .@x = 7 % 2; // .@x = 1;
- callsub(OnCheck, "Binary % operator", .@x, 1);
-
- // Associativity of *, /, %
- .@x = 8 * 3 / 2; // .@x = (8 * 3) / 2;
- callsub(OnCheck, "Associativity of * and /", .@x, 12);
-
- // Order of binary *%/ and unary !-~
- .@x = 2 * ! 3; // .@x = 2 * (!3);
- callsub(OnCheck, "Order of binary * and unary !", .@x, 0);
- .@x = ~ 1 * 2; // .@x = (~1) * 2;
- callsub(OnCheck, "Order of unary ~ and binary *", .@x, -4);
-
-
- // Binary +, - operators
- .@x = 1 + 3; // .@x = 4;
- callsub(OnCheck, "Binary + operator", .@x, 4);
- .@x = 1 - 3; // .@x = -2;
- callsub(OnCheck, "Binary - operator", .@x, -2);
-
- // Associativity of +,-
- .@x = 0x7fffffff - 0x7ffffff0 + 1; // .@x = (0x7fffffff - 0x7ffffff0) + 1; (without overflow)
- callsub(OnCheck, "Associativity of + and -", .@x, 16);
-
- // Order of +, - and *, /, %
- .@x = 1 + 3 * 2; // .@x = 1 + (3 * 2);
- callsub(OnCheck, "Order of + and *", .@x, 7);
-
-
- // << and >> operators
- .@x = 1<<3; // .@x = 1*2*2*2;
- callsub(OnCheck, "Left shift << operator", .@x, 8);
- .@x = 12>>2; // .@x = 12/2/2;
- callsub(OnCheck, "Right shift >> operator", .@x, 3);
-
- // Associativity of << and >>
- .@x = 0x40000000 >> 4 << 2; // .@x = (0x40000000 >> 4) << 2
- callsub(OnCheck, "Associativity of >> and <<", .@x, 0x10000000);
-
- // Order of <</>> and +/-
- .@x = 4 << 2 + 1; // .@x = 4 << (2+1);
- callsub(OnCheck, "Order of << and +", .@x, 32);
-
-
- // <, <=, >, >= operators
- .@x = (1 < 2); // true
- .@y = (2 < 2); // false
- callsub(OnCheck, "< operator", .@x);
- callsub(OnCheck, "< operator", .@y, 0);
- .@x = (1 <= 2); // true
- .@y = (2 <= 2); // true
- callsub(OnCheck, "<= operator", .@x);
- callsub(OnCheck, "<= operator", .@y);
- .@x = (2 > 1); // true
- .@y = (2 > 2); // false
- callsub(OnCheck, "> operator", .@x);
- callsub(OnCheck, "> operator", .@y, 0);
- .@x = (2 >= 1); // true
- .@y = (2 >= 2); // true
- callsub(OnCheck, ">= operator", .@x);
- callsub(OnCheck, ">= operator", .@y);
-
- // Associativity of <,<=,>,>=
- .@x = 1 > 0 > 0; // (1 > 0) > 0 --> 1 > 0 --> true
- callsub(OnCheck, "Associativity of > operators", .@x);
-
- // Order of >>/<< and </<=/>/>=
- .@x = 1 < 1 << 2; // .@x = 1 < (1<<2);
- callsub(OnCheck, "Order of < and <<", .@x);
-
-
- // ==, !=, ~=, ~! operators
- .@x = (0 == 0); // true
- .@y = (1 == 0); // false
- callsub(OnCheck, "== operator", .@x);
- callsub(OnCheck, "== operator", .@y, 0);
- .@x = (1 != 0); // true
- .@y = (1 != 1); // false
- callsub(OnCheck, "!= operator", .@x);
- callsub(OnCheck, "!= operator", .@y, 0);
- .@x$ = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. "
- "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. "
- "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. "
- "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
- .@y = (.@x$ ~= "^Lorem.*, ([a-z]*).*(Duis).* ([a-z.]*)$");
- callsub(OnCheck, "~= operator", .@y, 4);
- callsub(OnCheck, "~= operator", $@regexmatchcount, 4);
- if( $@regexmatchcount == 4 ) {
- callsub(OnCheck, "~= operator", $@regexmatch$[0], .@x$);
- callsub(OnCheck, "~= operator", $@regexmatch$[1], "quis");
- callsub(OnCheck, "~= operator", $@regexmatch$[2], "Duis");
- callsub(OnCheck, "~= operator", $@regexmatch$[3], "laborum.");
- }
- .@y = (.@x$ ~! "^Not Lorem.*, ([a-z]*).*(Duis).* ([a-z.]*)$");
- callsub(OnCheck, "~! operator", .@y);
-
- // Associativity of ==, !=
- .@x = (1 == 0 == 0); // (1 == 0) == 0 --> 0 == 0 --> 1
- .@y = (1 != 0 == 0); // (1 != 0) == 0 --> 1 == 0 --> 0
- callsub(OnCheck, "Associativity of != and == operators", .@x);
- callsub(OnCheck, "Associativity of != and == operators", .@y, 0);
-
- // Order of </<=/>/>= and ==/!=
- .@x = (1 == 2 > 1); // true
- .@y = (1 < 2 == 1); // true
- callsub(OnCheck, "Order of <,>,==", .@x);
- callsub(OnCheck, "Order of <,>,==", .@y);
-
-
- .@x$ = "string "
- "concatenation" /* test */ " succeeded";
- callsub(OnCheckStr, "String concatenation", .@x$, "string concatenation succeeded");
-
-
- // Bitwise & operator
- .@x = (7&4); // 0111 & 0100 --> 0100
- .@y = (4&1); // 0100 & 0001 --> 0000
- callsub(OnCheck, "Bitwise & operator", .@x, 4);
- callsub(OnCheck, "Bitwise & operator", .@y, 0);
-
- // Order of & and ==/!=
- .@x = (4 == 7 & 4); // (4 == 7)&4
- .@y = (1 & 3 != 1); // 1 & (3 != 1)
- callsub(OnCheck, "Order of ==/!= and &", .@x, 0);
- callsub(OnCheck, "Order of ==/!= and &", .@y);
-
-
- // Bitwise ^ operator
- .@x = (3^1); // 0011 ^ 0001 --> 0010
- callsub(OnCheck, "Bitwise ^ operator", .@x, 2);
-
- // Order of ^ and &
- .@x = (0 & 2 ^ 2); // (0 & 2) ^ 2 --> (0000 & 0010) | 0010 --> 0000 ^ 0010 --> 0010
- .@y = (2 ^ 2 & 0); // 2 ^ (2 & 0) --> 0010 | (0010 & 0000) --> 0010 ^ 0000 --> 0010
- callsub(OnCheck, "Order of ^ and &", .@x, 2);
- callsub(OnCheck, "Order of ^ and &", .@y, 2);
-
-
- // Bitwise | operator
- .@x = (3|4); // 0011 | 0100 --> 0111
- .@y = (4|1); // 0100 | 0001 --> 0101
- callsub(OnCheck, "Bitwise | operator", .@x, 7);
- callsub(OnCheck, "Bitwise | operator", .@y, 5);
-
- // Order of ^ and |
- .@x = (2 ^ 2 | 2); // (2 ^ 1) | 4 --> (0010 ^ 0010) | 0010 --> 0000 | 0010 --> 0010
- .@y = (2 | 2 ^ 2); // 4 | (1 ^ 2) --> 0010 | (0010 ^ 0010) --> 0010 | 0000 --> 0010
- callsub(OnCheck, "Order of | and ^", .@x, 2);
- callsub(OnCheck, "Order of | and ^", .@y, 2);
-
-
- // Logical && operator
- .@x = (1 && 1); // true
- .@y = (0 && 1); // false
- callsub(OnCheck, "Logical && operator", .@x);
- callsub(OnCheck, "Logical && operator", .@y, 0);
-
- // Associativity of && and short-circuit
- .@x = 0;
- .@y = (1 && 0 && (.@x = 1)); // should short circuit as false before evaluating the assignment
- //FIXME callsub(OnCheck, "Short-circuit of &&", .@x, 0);
- callsub(OnCheck, "Associativity of &&", .@y, 0);
-
- // Order of bitwise | and logical &&
- .@x = (1 && 0 | 4); // 1 && (0|4)
- .@y = (4 | 0 && 1); // (4|0) && 1
- callsub(OnCheck, "Order of && and |", .@x);
- callsub(OnCheck, "Order of && and |", .@y);
-
-
- // Logical || operator
- .@x = (1 || 1); // true
- .@y = (0 || 1); // true
- callsub(OnCheck, "Logical || operator", .@x);
- callsub(OnCheck, "Logical || operator", .@y);
-
- // Associativity of || and short-circuit
- .@x = 0;
- .@y = (1 || 0 || (.@x = 1)); // should short circuit as true before evaluating the assignment
- //FIXME callsub(OnCheck, "Short-circuit of ||", .@x, 0);
- callsub(OnCheck, "Associativity of ||", .@y);
-
- // Order of logical && and ||
- .@x = (0 && 1 || 1); // (0 && 1) || 1
- .@y = (1 || 1 && 0); // 1 || (1 && 0)
- callsub(OnCheck, "Order of && and ||", .@x);
- callsub(OnCheck, "Order of && and ||", .@y);
-
- // Ternary conditional operator ?:
- .@x = (1 ? 2 : 3); // 2
- .@y = (0 ? 2 : 3); // 3
- callsub(OnCheck, "Ternary conditional operator", .@x, 2);
- callsub(OnCheck, "Ternary conditional operator", .@y, 3);
-
- // Associativity of ?:
- .@x = (1 ? 2 : 0 ? 3 : 4);
- .@y = (1 ? 1 ? 2 : 3 : 5);
- callsub(OnCheck, "Associativity of ?:", .@x, 2);
- callsub(OnCheck, "Associativity of ?:", .@y, 2);
-
- // Order of logical || and ternary ?:
- .@x = (1 ? 0 : 0 || 1); // 1 ? 0 : (0 || 1) --> false
- callsub(OnCheck, "Order of || and ?:", .@x, 0);
-
-
- // Assignment operators
- .@x = 1;
- callsub(OnCheck, "Direct assignment operator =", .@x);
- .@x += 7; // 1 + 7
- callsub(OnCheck, "Assignment by sum +=", .@x, 8);
- .@x -= 1; // 8 - 1
- callsub(OnCheck, "Assignment by difference -=", .@x, 7);
- .@x *= 2; // 7 * 2
- callsub(OnCheck, "Assignment by product *=", .@x, 14);
- .@x /= 2; // 14 / 2
- callsub(OnCheck, "Assignment by quotient /=", .@x, 7);
- .@x %= 4; // 7 % 4
- callsub(OnCheck, "Assignment by remainder %=", .@x, 3);
- .@x <<= 2; // 3 << 2
- callsub(OnCheck, "Assignment by bitwise left shift <<=", .@x, 12);
- .@x >>= 1; // 12 >> 1
- callsub(OnCheck, "Assignment by bitwise right shift >>=", .@x, 6);
- .@x &= 5; // 6 & 5 (0110 & 0101 --> 0100)
- callsub(OnCheck, "Assignment by bitwise and &=", .@x, 4);
- .@x ^= 5; // 4 ^ 5 (0100 ^ 0101 --> 0001)
- callsub(OnCheck, "Assignment by bitwise xor ^=", .@x, 1);
- .@x |= 2; // 1 | 2 (0001 | 0010 --> 0011)
- callsub(OnCheck, "Assignment by bitwise or |=", .@x, 3);
-
- // Associativity of assignment operators
- .@x = 0; .@y = 0;
- .@x = .@y = 1;
- callsub(OnCheck, "Associativity of =", .@x);
- callsub(OnCheck, "Associativity of =", .@y);
- .@x = 0; .@y = 1;
- .@x = .@y += 4;
- callsub(OnCheck, "Associativity of = and +=", .@x, 5);
- callsub(OnCheck, "Associativity of = and +=", .@y, 5);
- .@x = 5; .@y = 3;
- .@z = 8;
- .@x *= .@y += 1;
- callsub(OnCheck, "Associativity of *= and +=", .@x, 20);
- callsub(OnCheck, "Associativity of *= and +=", .@y, 4);
-
- .@x = 1; .@y = 3;
- .@x += .@y * 10;
- callsub(OnCheck, "Order of += and *", .@x, 31);
- .@x = 1; .@y = 3;
- .@x = .@y != 3 ? .@y = 2 : 4;
- callsub(OnCheck, "Order of = and ?:", .@x, 4);
- // FIXME callsub(OnCheck, "Short-circuit of ?:", .@y, 3);
-
- .@x = 0;
- if (0)
- if (1)
- .@x = 2;
- else
- .@x = 3;
- callsub(OnCheck, "Dangling else", .@x, 0);
-
-
- // Array operations
- .@x[0] = 1;
- callsub(OnCheck, "Array size (single value)", getarraysize(.@x), 1);
- .@x[0] = 0;
- callsub(OnCheck, "Array size (single value removal)", getarraysize(.@x), 0);
-
- .@x[0] = 1;
- .@x[1] = 2;
- .@x[2] = 3;
- .@x[5] = 4;
- .@x[8] = 5;
- .@x[9] = 0;
- setarray .@y[0], 1, 2, 3, 0, 0, 4, 0, 0, 5;
- callsub(OnCheck, "Array size (assignment)", getarraysize(.@x), 9);
- callsub(OnCheck, "Array size (setarray)", getarraysize(.@y), 9);
- for (.@i = 0; .@i < 10; ++.@i) {
- callsub(OnCheck, "Array subscript and setarray [" + .@i + "]", .@x[.@i], .@y[.@i]);
- }
-
- cleararray .@x[1], 8, 6;
- callsub(OnCheck, "cleararray (value) [0]", .@x[0], 1);
- for (.@i = 1; .@i < 7; ++.@i) {
- callsub(OnCheck, "cleararray (value) [" + .@i + "]", .@x[.@i], 8);
- }
- callsub(OnCheck, "cleararray (value) [7]", .@x[7], 0);
- callsub(OnCheck, "cleararray (value) [8]", .@x[8], 5);
- callsub(OnCheck, "cleararray (value) [9]", .@x[9], 0);
-
- cleararray .@x, 0, getarraysize(.@x);
- cleararray .@y, 0, getarraysize(.@y);
- callsub(OnCheck, "cleararray and getarraysize", getarraysize(.@x), 0);
- for (.@i = 0; .@i < 10; ++.@i) {
- callsub(OnCheck, "cleararray (zero) [" + .@i + "]", .@x[.@i], 0);
- }
-
- cleararray .@x, 0, getarraysize(.@x);
- setarray .@x[1], 1, 2, 0, 0, 0, 6, 7, 8, 0, 0, 0, 13, 14, 15, 16;
- deletearray .@x;
- callsub(OnCheck, "deletearray (clear) and getarraysize", getarraysize(.@x), 0);
- for (.@i = 0; .@i < 18; ++.@i) {
- callsub(OnCheck, "deletearray (clear) [" + .@i + "]", .@x[.@i], 0);
- }
-
- deletearray .@x;
- deletearray .@y;
- setarray .@x[1], 1, 2, 0, 0, 0, 6, 7, 8, 0, 0, 0, 0, 13, 14, 15, 16;
- setarray .@y, 0, 1, 2, 0, 0, 0, 6, 7, 8, 0, 0, 0, 13, 14, 15, 16;
- deletearray .@x[9], 1;
- callsub(OnCheck, "deletearray (single) and getarraysize", getarraysize(.@x), 16);
- for (.@i = 0; .@i < 18; ++.@i) {
- callsub(OnCheck, "deletearray (single) [" + .@i + "]", .@x[.@i], .@y[.@i]);
- }
-
- deletearray .@x;
- deletearray .@y;
- setarray .@x[1], 1, 2, 0, 0, 0, 6, 7, 8, 0, 0, 0, 13, 14, 15, 16;
- setarray .@y, 0, 1, 6, 7, 8, 0, 0, 0, 13, 14, 15, 16;
- deletearray .@x[2], 4;
- callsub(OnCheck, "deletearray (multiple) and getarraysize", getarraysize(.@x), 12);
- for (.@i = 0; .@i < 18; ++.@i) {
- callsub(OnCheck, "deletearray (multiple) [" + .@i + "]", .@x[.@i], .@y[.@i]);
- }
-
- deletearray .@x;
- deletearray .@y;
- setarray .@x[1], 1, 2, 0, 0, 0, 6, 7, 8, 0, 0, 0, 13, 14, 15, 16;
- setarray .@y, 0, 1;
- deletearray .@x[2], 1000;
- callsub(OnCheck, "deletearray (large count) and getarraysize", getarraysize(.@x), 2);
- for (.@i = 0; .@i < 18; ++.@i) {
- callsub(OnCheck, "deletearray (large count) [" + .@i + "]", .@x[.@i], .@y[.@i]);
- }
-
- deletearray .@x;
- deletearray .@y;
- setarray .@x[1], 1, 2, 0, 0, 0, 6, 7, 8, 0, 0, 0, 13, 14, 15, 16;
- setarray .@y, 0, 1;
- deletearray .@x[2];
- callsub(OnCheck, "deletearray (truncate) and getarraysize", getarraysize(.@x), 2);
- for (.@i = 0; .@i < 18; ++.@i) {
- callsub(OnCheck, "deletearray (truncate) [" + .@i + "]", .@x[.@i], .@y[.@i]);
- }
-
- deletearray .@x;
- .@x[1] = 2;
- .@x[65536] = 1;
- callsub(OnCheck, "large array index", .@x[65536], 1);
- callsub(OnCheck, "large array index and getarraysize", getarraysize(.@x), 65537);
- .@x[65536] = 0;
- callsub(OnCheck, "large array index (shrink)", .@x[65536], 0);
- callsub(OnCheck, "large array index and getarraysize (shrink)", getarraysize(.@x), 2);
- .@x[1] = 0;
- callsub(OnCheck, "array shrink", .@x[1], 0);
- callsub(OnCheck, "array shrink and getarraysize", getarraysize(.@x), 0);
-
- // min and max
- callsub(OnCheck, "min()", min(5, -10, 8, 3, -2, 1000), -10);
- callsub(OnCheck, "max()", max(5, -10, 8, 3, -2, 1000), 1000);
-
-
- // Constants
- callsub(OnCheck, "'true' constant", true, 1);
- callsub(OnCheck, "'false' constant", false, 0);
- callsub(OnCheck, "'Piou' mob ID", Piou, 1002);
- callsub(OnCheck, "'NV_BASIC' skill ID", NV_BASIC, 1);
- callsub(OnCheck, "'Acorn' item ID", Acorn, 501);
- callsub(OnCheck, "'Bread' item ID", Bread, 502);
-
-
- // setd/getd
- .@x = 1; .@x$ = ".@x";
- callsub(OnCheck, "getd", getd(".@x"), 1);
- callsub(OnCheck, "getd arguments", getd(.@x$), 1);
- .@y = 0; .@y$ = ".@y";
- setd(".@y", .@x);
- callsub(OnCheck, "setd", .@y, 1);
- setd(.@y$, 2);
- callsub(OnCheck, "setd arguments", .@y, 2);
- set getd(".@x"), getd(".@y");
- callsub(OnCheck, "set getd", .@x, .@y);
- .@y = 1;
- setd(".@x", getd(".@y"));
- callsub(OnCheck, "setd getd", .@x, .@y);
-
- // getvariableofnpc
- .xt = 2;
- set getvariableofnpc(.xt, "TestVarOfAnotherNPC"), 1;
- callsub(OnCheck, "Setting NPC variables of another NPC", getvariableofnpc(.xt, "TestVarOfAnotherNPC"), 1);
- callsub(OnCheck, "Setting NPC variables of another NPC (local variable overwrite check)", .xt, 2);
-
- // Callsub (advanced)
- callsub(OnCheck, "Callsub return value", callsub(OnTestReturnValue, 1));
- .@x = 1;
- callsub(OnCheck, "Callsub return with scope variables", callsub(OnTestScopeVars), 3);
- callsub(OnCheck, "Callsub (parent scope vars isolation)", .@x, 1);
- callsub(OnCheck, "Callsub (nested scopes)", callsub(OnTestNestedScope), 1);
- callsub(OnCheck, "Callsub (deeply nested scopes)", callsub(OnTestDeepNestedScope, 30, 0), 1);
- .@x = 1;
- .@y = callsub(OnSetReference, .@x);
- callsub(OnCheck, "Callsub (setting references)", .@y, 2);
- callsub(OnCheck, "Callsub (setting references)", .@x, 2);
- deletearray .@x;
- setarray .@x, 1, 2, 3, 4;
- callsub(OnCheck, "Callsub (array references)", callsub(OnTestArrayRefs, .@x), 4);
- deletearray .@x;
- .@y = callsub(OnTestReturnArrayRef, .@x);
- callsub(OnCheck, "Callsub return array references (size check)", getarraysize(.@x), .@y);
- callsub(OnCheck, "Callsub return array references", getelementofarray(.@x, 3), 8);
- deletearray .@x;
- deletearray .@y;
- setarray .@x, 1, 2;
- .@z = getarraysize(.@x);
- setarray .@y, 5, 6, 7, 8, 9;
- callsub(OnCheck, "Callsub (copyarray from reference with the same name)", getarraysize(.@y), callsub(OnTestScopeArrays, .@y));
- callsub(OnCheck, "Callsub (parent array vars isolation)", getarraysize(.@x), .@z);
- deletearray .@x;
- deletearray .@y;
- .xt = 2;
- set getvariableofnpc(.xt, "TestVarOfAnotherNPC"), 1;
- callsub(OnCheck, "Callsub (return NPC variables from another NPC)", callsub(OnTestVarOfAnotherNPC, "TestVarOfAnotherNPC"), 1);
- callsub(OnCheck, "Callsub (return NPC variables from another NPC - local variable overwrite check)", .xt, 2);
-
- // Callfunc
- callsub(OnCheck, "Callfunc return value", callfunc("F_TestReturnValue", 1));
- .@x = 1;
- callsub(OnCheck, "Callfunc return with scope variables", callfunc("F_TestScopeVars"), 3);
- callsub(OnCheck, "Callfunc (parent scope vars isolation)", .@x, 1);
- callsub(OnCheck, "Callfunc (nested scopes)", callfunc("F_TestNestedScope"), 1);
- callsub(OnCheck, "Callfunc (deeply nested scopes)", callfunc("F_TestDeepNestedScope", 30, 0), 1);
- deletearray .@x;
- setarray .@x, 1, 2, 3, 4;
- callsub(OnCheck, "Callfunc (array references)", callfunc("F_TestArrayRefs", .@x), 4);
- deletearray .@x;
- .@y = callfunc("F_TestReturnArrayRef", .@x);
- callsub(OnCheck, "Callfunc return array references (size check)", getarraysize(.@x), .@y);
- callsub(OnCheck, "Callfunc return array references", getelementofarray(.@x, 3), 8);
- deletearray .@x;
- deletearray .@y;
- setarray .@x, 1, 2;
- .@z = getarraysize(.@x);
- setarray .@y, 5, 6, 7, 8, 9;
- callsub(OnCheck, "Callfunc (copyarray from reference with the same name)", getarraysize(.@y), callfunc("F_TestScopeArrays", .@y));
- callsub(OnCheck, "Callfunc (parent array vars isolation)", getarraysize(.@x), .@z);
- deletearray .@x;
- deletearray .@y;
- .xt = 1;
- callsub(OnCheck, "Callfunc return with NPC variables", callfunc("F_TestNPCVars"), 3);
- callsub(OnCheck, "Callfunc (parent NPC vars isolation)", .xt, 1);
- callsub(OnCheck, "Callfunc (nested scopes and NPC variables)", callfunc("F_TestNestedScopeNPC"), 1);
- callsub(OnCheck, "Callfunc (deeply nested scopes and NPC variables)", callfunc("F_TestDeepNestedScopeNPC", 30, 0), 1);
- deletearray .xt;
- setarray .xt, 1, 2, 3, 4;
- callsub(OnCheck, "Callfunc (array references and NPC variables)", callfunc("F_TestArrayRefs", .xt), 4);
- deletearray .xt;
- .yt = callfunc("F_TestReturnArrayRef", .xt);
- callsub(OnCheck, "Callfunc return array references with NPC variables (size check)", getarraysize(.xt), .yt);
- callsub(OnCheck, "Callfunc return array references wuth NPC variables", getelementofarray(.xt, 3), 8);
- deletearray .xt;
- deletearray .yt;
- setarray .xt, 1, 2;
- .@z = getarraysize(.@x);
- setarray .yt, 5, 6, 7, 8, 9;
- callsub(OnCheck, "Callfunc (copyarray from NPC variable reference with the same name)", getarraysize(.@y), callfunc("F_TestNPCArrays", .@y));
- callsub(OnCheck, "Callfunc (parent array NPC vars isolation)", getarraysize(.@x), .@z);
- deletearray .xt;
- deletearray .yt;
- .xt = 2;
- set getvariableofnpc(.xt, "TestVarOfAnotherNPC"), 1;
- callsub(OnCheck, "Callfunc (return NPC variables from another NPC)", callfunc("F_TestVarOfAnotherNPC", "TestVarOfAnotherNPC"), 1);
- callsub(OnCheck, "Callfunc (return NPC variables from another NPC - local variable overwrite check)", .xt, 2);
-
- callsub(OnCheckStr, "sprintf (%%)", sprintf("'%%'"), "'%'");
- callsub(OnCheckStr, "sprintf (%d)", sprintf("'%d'", 5), "'5'");
- callsub(OnCheckStr, "sprintf (neg. %d)", sprintf("'%d'", -5), "'-5'");
- callsub(OnCheckStr, "sprintf (%u)", sprintf("'%u'", 5), "'5'");
- callsub(OnCheckStr, "sprintf (%x)", sprintf("'%x'", 10), "'a'");
- callsub(OnCheckStr, "sprintf (%X)", sprintf("'%X'", 31), "'1F'");
- callsub(OnCheckStr, "sprintf (%s)", sprintf("'%s'", "Hello World!"), "'Hello World!'");
- callsub(OnCheckStr, "sprintf (%c)", sprintf("'%c'", "Hello World!"), "'H'");
- callsub(OnCheckStr, "sprintf (%+d)", sprintf("'%+d'", 5), "'+5'");
- callsub(OnCheckStr, "sprintf (%{n}d)", sprintf("'%5d'", 5), "' 5'");
- callsub(OnCheckStr, "sprintf (%-{n}d)", sprintf("'%-5d'", 5), "'5 '");
- callsub(OnCheckStr, "sprintf (%-+{n}d)", sprintf("'%-+5d'", 5), "'+5 '");
- callsub(OnCheckStr, "sprintf (%+0{n}d)", sprintf("'%+05d'", 5), "'+0005'");
- callsub(OnCheckStr, "sprintf (%0*d)", sprintf("'%0*d'", 5, 10), "'00010'");
- callsub(OnCheckStr, "sprintf (Two args)", sprintf("'%+05d' '%x'", 5, 0x7f), "'+0005' '7f'");
- callsub(OnCheckStr, "sprintf (positional)", sprintf("'%2$+05d'", 5, 6), "'+0006'");
- callsub(OnCheckStr, "sprintf (positional)", sprintf("'%2$s' '%1$c'", "First", "Second"), "'Second' 'F'");
-
- if (.errors) {
- debugmes "Script engine self-test [ \033[0;31mFAILED\033[0m ]";
- debugmes "**** The test was completed with " + .errors + " errors. ****";
- } else {
- debugmes "Script engine self-test [ \033[0;32mPASSED\033[0m ]";
- }
- return .errors;
- end;
+ if (.once > 0)
+ return .errors;
+ .once = 1;
+ .errors = 0;
+
+ // Callsub (basic)
+ callsub(OnCheck, "Callsub", 1, 1);
+ callsub(OnCheck, "Callsub (getarg default values)", 1);
+
+
+ // Array subscript
+ setarray .@a, 3, 2, 1;
+ callsub(OnCheck, "Array subscript", .@a[2]);
+
+
+ // Increment and decrement operators ++, --
+ .@x = 1;
+ .@y = .@x++; // .@y = .@x; .@x = .@x + 1;
+ callsub(OnCheck, "Suffix increment ++", .@y);
+ callsub(OnCheck, "Suffix increment ++", .@x, 2);
+ .@x = 1;
+ .@y = .@x--; // .@y = .@x; .@x = .@x - 1;
+ callsub(OnCheck, "Suffix decrement --", .@y);
+ callsub(OnCheck, "Suffix decrement --", .@x, 0);
+ .@x = 0;
+ .@y = ++.@x; // .@x = .@x + 1; .@y = .@x;
+ callsub(OnCheck, "Prefix increment ++", .@y);
+ callsub(OnCheck, "Prefix increment ++", .@x);
+ .@x = 2;
+ .@y = --.@x; // .@x = .@x - 1; .@y = .@x;
+ callsub(OnCheck, "Prefix decrement --", .@y);
+ callsub(OnCheck, "Prefix decrement --", .@x);
+
+ // Order of [] and --/++
+ .@a[1] = 0;
+ .@a[1]++; // .@a[1] = .@a[1] + 1;
+ callsub(OnCheck, "Order of [] and ++", .@a[1]);
+ .@a[1] = 2;
+ .@a[1]--; // .@a[1] = .@a[1] - 1;
+ callsub(OnCheck, "Order of [] and --", .@a[1]);
+
+
+ // Unary operators -, !, ~
+ .@x = 1;
+ .@y = -.@x; // .@y = 0 - .@x;
+ callsub(OnCheck, "Unary operator -", .@y, -1);
+ .@x = 1;
+ .@y = !.@x; // if(.@x == 0) .@y = 1; else .@y = 0;
+ callsub(OnCheck, "Unary operator !", .@y, 0);
+ .@x = 0x00000001;
+ .@y = ~.@x; // One's complement of 0x00000001 is 0xfffffffe, which is -2
+ callsub(OnCheck, "Unary operator ~", .@y, -2);
+
+ // Associativity of unary operators -, !, ~
+ .@x = 1;
+ .@y = ~ ! .@x; // .@y = ~(!.@x);
+ callsub(OnCheck, "Associativity of unary ~ and !", .@y, -1);
+ .@x = 0;
+ .@y = - ! .@x; // .@y = -(!.@x);
+ callsub(OnCheck, "Associativity of unary - and !", .@y, -1);
+ .@x = 1;
+ .@y = ~ - .@x; // .@y = ~(-.@x);
+ callsub(OnCheck, "Associativity of unary ~ and -", .@y, 0);
+ .@x = 1;
+ .@y = - ~ .@x; // .@y = -(~.@x);
+ callsub(OnCheck, "Associativity of unary - and ~", .@y, 2);
+
+ // Order of unary -, !, ~ and prefix/suffix ++/--
+ .@x = 2;
+ .@y = - --.@x; // .@y = -(--.@x);
+ callsub(OnCheck, "Order of unary - and prefix --", .@y, -1);
+ callsub(OnCheck, "Order of unary - and prefix --", .@x);
+ .@x = 1;
+ .@y = - .@x--; // .@y = -(.@x--);
+ callsub(OnCheck, "Order of unary - and suffix --", .@y, -1);
+ callsub(OnCheck, "Order of unary - and suffix --", .@x, 0);
+ .@x = 0;
+ .@y = - ++.@x; // .@y = -(++.@x);
+ callsub(OnCheck, "Order of unary - and prefix ++", .@y, -1);
+ callsub(OnCheck, "Order of unary - and prefix ++", .@x);
+ .@x = 1;
+ .@y = - .@x++; // .@y = -(.@x++);
+ callsub(OnCheck, "Order of unary - and suffix ++", .@y, -1);
+ callsub(OnCheck, "Order of unary - and suffix ++", .@x, 2);
+ .@x = 1;
+ .@y = !--.@x; // .@y = !(--.@x);
+ callsub(OnCheck, "Order of unary ! and prefix --", .@y);
+ callsub(OnCheck, "Order of unary ! and prefix --", .@x, 0);
+ .@x = 1;
+ .@y = !.@x--; // .@y = !(.@x--);
+ callsub(OnCheck, "Order of unary ! and suffix --", .@y, 0);
+ callsub(OnCheck, "Order of unary ! and suffix --", .@x, 0);
+ .@x = 0;
+ .@y = !++.@x; // .@y = !(++.@x);
+ callsub(OnCheck, "Order of unary ! and prefix ++", .@y, 0);
+ callsub(OnCheck, "Order of unary ! and prefix ++", .@x);
+ .@x = 0;
+ .@y = !.@x++; // .@y = !(.@x++);
+ callsub(OnCheck, "Order of unary ! and suffix ++", .@y);
+ callsub(OnCheck, "Order of unary ! and suffix ++", .@x);
+ .@x = 2;
+ .@y = ~--.@x; // .@y = ~(--.@x);
+ callsub(OnCheck, "Order of unary ~ and prefix --", .@y, -2);
+ callsub(OnCheck, "Order of unary ~ and prefix --", .@x, 1);
+ .@x = 1;
+ .@y = ~.@x--; // .@y = ~(.@x--);
+ callsub(OnCheck, "Order of unary ~ and suffix --", .@y, -2);
+ callsub(OnCheck, "Order of unary ~ and suffix --", .@x, 0);
+ .@x = 0;
+ .@y = ~++.@x; // .@y = ~(++.@x);
+ callsub(OnCheck, "Order of unary ~ and prefix ++", .@y, -2);
+ callsub(OnCheck, "Order of unary ~ and prefix ++", .@x, 1);
+ .@x = 1;
+ .@y = ~.@x++; // .@y = ~(.@x++);
+ callsub(OnCheck, "Order of unary ~ and suffix ++", .@y, -2);
+ callsub(OnCheck, "Order of unary ~ and suffix ++", .@x, 2);
+
+ // Binary *, /, % operators
+ .@x = 2 * 3; // .@x = 6;
+ callsub(OnCheck, "Binary * operator", .@x, 6);
+ .@x = 7 / 2; // .@x = 3;
+ callsub(OnCheck, "Binary / operator", .@x, 3);
+ .@x = 7 % 2; // .@x = 1;
+ callsub(OnCheck, "Binary % operator", .@x, 1);
+
+ // Associativity of *, /, %
+ .@x = 8 * 3 / 2; // .@x = (8 * 3) / 2;
+ callsub(OnCheck, "Associativity of * and /", .@x, 12);
+
+ // Order of binary *%/ and unary !-~
+ .@x = 2 * ! 3; // .@x = 2 * (!3);
+ callsub(OnCheck, "Order of binary * and unary !", .@x, 0);
+ .@x = ~ 1 * 2; // .@x = (~1) * 2;
+ callsub(OnCheck, "Order of unary ~ and binary *", .@x, -4);
+
+
+ // Binary +, - operators
+ .@x = 1 + 3; // .@x = 4;
+ callsub(OnCheck, "Binary + operator", .@x, 4);
+ .@x = 1 - 3; // .@x = -2;
+ callsub(OnCheck, "Binary - operator", .@x, -2);
+
+ // Associativity of +,-
+ .@x = 0x7fffffff - 0x7ffffff0 + 1; // .@x = (0x7fffffff - 0x7ffffff0) + 1; (without overflow)
+ callsub(OnCheck, "Associativity of + and -", .@x, 16);
+
+ // Order of +, - and *, /, %
+ .@x = 1 + 3 * 2; // .@x = 1 + (3 * 2);
+ callsub(OnCheck, "Order of + and *", .@x, 7);
+
+
+ // << and >> operators
+ .@x = 1<<3; // .@x = 1*2*2*2;
+ callsub(OnCheck, "Left shift << operator", .@x, 8);
+ .@x = 12>>2; // .@x = 12/2/2;
+ callsub(OnCheck, "Right shift >> operator", .@x, 3);
+
+ // Associativity of << and >>
+ .@x = 0x40000000 >> 4 << 2; // .@x = (0x40000000 >> 4) << 2
+ callsub(OnCheck, "Associativity of >> and <<", .@x, 0x10000000);
+
+ // Order of <</>> and +/-
+ .@x = 4 << 2 + 1; // .@x = 4 << (2+1);
+ callsub(OnCheck, "Order of << and +", .@x, 32);
+
+
+ // <, <=, >, >= operators
+ .@x = (1 < 2); // true
+ .@y = (2 < 2); // false
+ callsub(OnCheck, "< operator", .@x);
+ callsub(OnCheck, "< operator", .@y, 0);
+ .@x = (1 <= 2); // true
+ .@y = (2 <= 2); // true
+ callsub(OnCheck, "<= operator", .@x);
+ callsub(OnCheck, "<= operator", .@y);
+ .@x = (2 > 1); // true
+ .@y = (2 > 2); // false
+ callsub(OnCheck, "> operator", .@x);
+ callsub(OnCheck, "> operator", .@y, 0);
+ .@x = (2 >= 1); // true
+ .@y = (2 >= 2); // true
+ callsub(OnCheck, ">= operator", .@x);
+ callsub(OnCheck, ">= operator", .@y);
+
+ // Associativity of <,<=,>,>=
+ .@x = 1 > 0 > 0; // (1 > 0) > 0 --> 1 > 0 --> true
+ callsub(OnCheck, "Associativity of > operators", .@x);
+
+ // Order of >>/<< and </<=/>/>=
+ .@x = 1 < 1 << 2; // .@x = 1 < (1<<2);
+ callsub(OnCheck, "Order of < and <<", .@x);
+
+
+ // ==, !=, ~=, ~! operators
+ .@x = (0 == 0); // true
+ .@y = (1 == 0); // false
+ callsub(OnCheck, "== operator", .@x);
+ callsub(OnCheck, "== operator", .@y, 0);
+ .@x = (1 != 0); // true
+ .@y = (1 != 1); // false
+ callsub(OnCheck, "!= operator", .@x);
+ callsub(OnCheck, "!= operator", .@y, 0);
+ .@x$ = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. "
+ "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. "
+ "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. "
+ "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
+ .@y = (.@x$ ~= "^Lorem.*, ([a-z]*).*(Duis).* ([a-z.]*)$");
+ callsub(OnCheck, "~= operator", .@y, 4);
+ callsub(OnCheck, "~= operator", $@regexmatchcount, 4);
+ if( $@regexmatchcount == 4 ) {
+ callsub(OnCheck, "~= operator", $@regexmatch$[0], .@x$);
+ callsub(OnCheck, "~= operator", $@regexmatch$[1], "quis");
+ callsub(OnCheck, "~= operator", $@regexmatch$[2], "Duis");
+ callsub(OnCheck, "~= operator", $@regexmatch$[3], "laborum.");
+ }
+ .@y = (.@x$ ~! "^Not Lorem.*, ([a-z]*).*(Duis).* ([a-z.]*)$");
+ callsub(OnCheck, "~! operator", .@y);
+
+ // Associativity of ==, !=
+ .@x = (1 == 0 == 0); // (1 == 0) == 0 --> 0 == 0 --> 1
+ .@y = (1 != 0 == 0); // (1 != 0) == 0 --> 1 == 0 --> 0
+ callsub(OnCheck, "Associativity of != and == operators", .@x);
+ callsub(OnCheck, "Associativity of != and == operators", .@y, 0);
+
+ // Order of </<=/>/>= and ==/!=
+ .@x = (1 == 2 > 1); // true
+ .@y = (1 < 2 == 1); // true
+ callsub(OnCheck, "Order of <,>,==", .@x);
+ callsub(OnCheck, "Order of <,>,==", .@y);
+
+
+ .@x$ = "string "
+ "concatenation" /* test */ " succeeded";
+ callsub(OnCheckStr, "String concatenation", .@x$, "string concatenation succeeded");
+
+
+ // Bitwise & operator
+ .@x = (7&4); // 0111 & 0100 --> 0100
+ .@y = (4&1); // 0100 & 0001 --> 0000
+ callsub(OnCheck, "Bitwise & operator", .@x, 4);
+ callsub(OnCheck, "Bitwise & operator", .@y, 0);
+
+ // Order of & and ==/!=
+ .@x = (4 == 7 & 4); // (4 == 7)&4
+ .@y = (1 & 3 != 1); // 1 & (3 != 1)
+ callsub(OnCheck, "Order of ==/!= and &", .@x, 0);
+ callsub(OnCheck, "Order of ==/!= and &", .@y);
+
+
+ // Bitwise ^ operator
+ .@x = (3^1); // 0011 ^ 0001 --> 0010
+ callsub(OnCheck, "Bitwise ^ operator", .@x, 2);
+
+ // Order of ^ and &
+ .@x = (0 & 2 ^ 2); // (0 & 2) ^ 2 --> (0000 & 0010) | 0010 --> 0000 ^ 0010 --> 0010
+ .@y = (2 ^ 2 & 0); // 2 ^ (2 & 0) --> 0010 | (0010 & 0000) --> 0010 ^ 0000 --> 0010
+ callsub(OnCheck, "Order of ^ and &", .@x, 2);
+ callsub(OnCheck, "Order of ^ and &", .@y, 2);
+
+
+ // Bitwise | operator
+ .@x = (3|4); // 0011 | 0100 --> 0111
+ .@y = (4|1); // 0100 | 0001 --> 0101
+ callsub(OnCheck, "Bitwise | operator", .@x, 7);
+ callsub(OnCheck, "Bitwise | operator", .@y, 5);
+
+ // Order of ^ and |
+ .@x = (2 ^ 2 | 2); // (2 ^ 1) | 4 --> (0010 ^ 0010) | 0010 --> 0000 | 0010 --> 0010
+ .@y = (2 | 2 ^ 2); // 4 | (1 ^ 2) --> 0010 | (0010 ^ 0010) --> 0010 | 0000 --> 0010
+ callsub(OnCheck, "Order of | and ^", .@x, 2);
+ callsub(OnCheck, "Order of | and ^", .@y, 2);
+
+
+ // Logical && operator
+ .@x = (1 && 1); // true
+ .@y = (0 && 1); // false
+ callsub(OnCheck, "Logical && operator", .@x);
+ callsub(OnCheck, "Logical && operator", .@y, 0);
+
+ // Associativity of && and short-circuit
+ .@x = 0;
+ .@y = (1 && 0 && (.@x = 1)); // should short circuit as false before evaluating the assignment
+ //FIXME callsub(OnCheck, "Short-circuit of &&", .@x, 0);
+ callsub(OnCheck, "Associativity of &&", .@y, 0);
+
+ // Order of bitwise | and logical &&
+ .@x = (1 && 0 | 4); // 1 && (0|4)
+ .@y = (4 | 0 && 1); // (4|0) && 1
+ callsub(OnCheck, "Order of && and |", .@x);
+ callsub(OnCheck, "Order of && and |", .@y);
+
+
+ // Logical || operator
+ .@x = (1 || 1); // true
+ .@y = (0 || 1); // true
+ callsub(OnCheck, "Logical || operator", .@x);
+ callsub(OnCheck, "Logical || operator", .@y);
+
+ // Associativity of || and short-circuit
+ .@x = 0;
+ .@y = (1 || 0 || (.@x = 1)); // should short circuit as true before evaluating the assignment
+ //FIXME callsub(OnCheck, "Short-circuit of ||", .@x, 0);
+ callsub(OnCheck, "Associativity of ||", .@y);
+
+ // Order of logical && and ||
+ .@x = (0 && 1 || 1); // (0 && 1) || 1
+ .@y = (1 || 1 && 0); // 1 || (1 && 0)
+ callsub(OnCheck, "Order of && and ||", .@x);
+ callsub(OnCheck, "Order of && and ||", .@y);
+
+ // Ternary conditional operator ?:
+ .@x = (1 ? 2 : 3); // 2
+ .@y = (0 ? 2 : 3); // 3
+ callsub(OnCheck, "Ternary conditional operator", .@x, 2);
+ callsub(OnCheck, "Ternary conditional operator", .@y, 3);
+
+ // Associativity of ?:
+ .@x = (1 ? 2 : 0 ? 3 : 4);
+ .@y = (1 ? 1 ? 2 : 3 : 5);
+ callsub(OnCheck, "Associativity of ?:", .@x, 2);
+ callsub(OnCheck, "Associativity of ?:", .@y, 2);
+
+ // Order of logical || and ternary ?:
+ .@x = (1 ? 0 : 0 || 1); // 1 ? 0 : (0 || 1) --> false
+ callsub(OnCheck, "Order of || and ?:", .@x, 0);
+
+
+ // Assignment operators
+ .@x = 1;
+ callsub(OnCheck, "Direct assignment operator =", .@x);
+ .@x += 7; // 1 + 7
+ callsub(OnCheck, "Assignment by sum +=", .@x, 8);
+ .@x -= 1; // 8 - 1
+ callsub(OnCheck, "Assignment by difference -=", .@x, 7);
+ .@x *= 2; // 7 * 2
+ callsub(OnCheck, "Assignment by product *=", .@x, 14);
+ .@x /= 2; // 14 / 2
+ callsub(OnCheck, "Assignment by quotient /=", .@x, 7);
+ .@x %= 4; // 7 % 4
+ callsub(OnCheck, "Assignment by remainder %=", .@x, 3);
+ .@x <<= 2; // 3 << 2
+ callsub(OnCheck, "Assignment by bitwise left shift <<=", .@x, 12);
+ .@x >>= 1; // 12 >> 1
+ callsub(OnCheck, "Assignment by bitwise right shift >>=", .@x, 6);
+ .@x &= 5; // 6 & 5 (0110 & 0101 --> 0100)
+ callsub(OnCheck, "Assignment by bitwise and &=", .@x, 4);
+ .@x ^= 5; // 4 ^ 5 (0100 ^ 0101 --> 0001)
+ callsub(OnCheck, "Assignment by bitwise xor ^=", .@x, 1);
+ .@x |= 2; // 1 | 2 (0001 | 0010 --> 0011)
+ callsub(OnCheck, "Assignment by bitwise or |=", .@x, 3);
+
+ // Associativity of assignment operators
+ .@x = 0; .@y = 0;
+ .@x = .@y = 1;
+ callsub(OnCheck, "Associativity of =", .@x);
+ callsub(OnCheck, "Associativity of =", .@y);
+ .@x = 0; .@y = 1;
+ .@x = .@y += 4;
+ callsub(OnCheck, "Associativity of = and +=", .@x, 5);
+ callsub(OnCheck, "Associativity of = and +=", .@y, 5);
+ .@x = 5; .@y = 3;
+ .@z = 8;
+ .@x *= .@y += 1;
+ callsub(OnCheck, "Associativity of *= and +=", .@x, 20);
+ callsub(OnCheck, "Associativity of *= and +=", .@y, 4);
+
+ .@x = 1; .@y = 3;
+ .@x += .@y * 10;
+ callsub(OnCheck, "Order of += and *", .@x, 31);
+ .@x = 1; .@y = 3;
+ .@x = .@y != 3 ? .@y = 2 : 4;
+ callsub(OnCheck, "Order of = and ?:", .@x, 4);
+ // FIXME callsub(OnCheck, "Short-circuit of ?:", .@y, 3);
+
+ .@x = 0;
+ if (0)
+ if (1)
+ .@x = 2;
+ else
+ .@x = 3;
+ callsub(OnCheck, "Dangling else", .@x, 0);
+
+
+ // Array operations
+ .@x[0] = 1;
+ callsub(OnCheck, "Array size (single value)", getarraysize(.@x), 1);
+ .@x[0] = 0;
+ callsub(OnCheck, "Array size (single value removal)", getarraysize(.@x), 0);
+
+ .@x[0] = 1;
+ .@x[1] = 2;
+ .@x[2] = 3;
+ .@x[5] = 4;
+ .@x[8] = 5;
+ .@x[9] = 0;
+ setarray .@y[0], 1, 2, 3, 0, 0, 4, 0, 0, 5;
+ callsub(OnCheck, "Array size (assignment)", getarraysize(.@x), 9);
+ callsub(OnCheck, "Array size (setarray)", getarraysize(.@y), 9);
+ for (.@i = 0; .@i < 10; ++.@i) {
+ callsub(OnCheck, "Array subscript and setarray [" + .@i + "]", .@x[.@i], .@y[.@i]);
+ }
+
+ cleararray .@x[1], 8, 6;
+ callsub(OnCheck, "cleararray (value) [0]", .@x[0], 1);
+ for (.@i = 1; .@i < 7; ++.@i) {
+ callsub(OnCheck, "cleararray (value) [" + .@i + "]", .@x[.@i], 8);
+ }
+ callsub(OnCheck, "cleararray (value) [7]", .@x[7], 0);
+ callsub(OnCheck, "cleararray (value) [8]", .@x[8], 5);
+ callsub(OnCheck, "cleararray (value) [9]", .@x[9], 0);
+
+ cleararray .@x, 0, getarraysize(.@x);
+ cleararray .@y, 0, getarraysize(.@y);
+ callsub(OnCheck, "cleararray and getarraysize", getarraysize(.@x), 0);
+ for (.@i = 0; .@i < 10; ++.@i) {
+ callsub(OnCheck, "cleararray (zero) [" + .@i + "]", .@x[.@i], 0);
+ }
+
+ cleararray .@x, 0, getarraysize(.@x);
+ setarray .@x[1], 1, 2, 0, 0, 0, 6, 7, 8, 0, 0, 0, 13, 14, 15, 16;
+ deletearray .@x;
+ callsub(OnCheck, "deletearray (clear) and getarraysize", getarraysize(.@x), 0);
+ for (.@i = 0; .@i < 18; ++.@i) {
+ callsub(OnCheck, "deletearray (clear) [" + .@i + "]", .@x[.@i], 0);
+ }
+
+ deletearray .@x;
+ deletearray .@y;
+ setarray .@x[1], 1, 2, 0, 0, 0, 6, 7, 8, 0, 0, 0, 0, 13, 14, 15, 16;
+ setarray .@y, 0, 1, 2, 0, 0, 0, 6, 7, 8, 0, 0, 0, 13, 14, 15, 16;
+ deletearray .@x[9], 1;
+ callsub(OnCheck, "deletearray (single) and getarraysize", getarraysize(.@x), 16);
+ for (.@i = 0; .@i < 18; ++.@i) {
+ callsub(OnCheck, "deletearray (single) [" + .@i + "]", .@x[.@i], .@y[.@i]);
+ }
+
+ deletearray .@x;
+ deletearray .@y;
+ setarray .@x[1], 1, 2, 0, 0, 0, 6, 7, 8, 0, 0, 0, 13, 14, 15, 16;
+ setarray .@y, 0, 1, 6, 7, 8, 0, 0, 0, 13, 14, 15, 16;
+ deletearray .@x[2], 4;
+ callsub(OnCheck, "deletearray (multiple) and getarraysize", getarraysize(.@x), 12);
+ for (.@i = 0; .@i < 18; ++.@i) {
+ callsub(OnCheck, "deletearray (multiple) [" + .@i + "]", .@x[.@i], .@y[.@i]);
+ }
+
+ deletearray .@x;
+ deletearray .@y;
+ setarray .@x[1], 1, 2, 0, 0, 0, 6, 7, 8, 0, 0, 0, 13, 14, 15, 16;
+ setarray .@y, 0, 1;
+ deletearray .@x[2], 1000;
+ callsub(OnCheck, "deletearray (large count) and getarraysize", getarraysize(.@x), 2);
+ for (.@i = 0; .@i < 18; ++.@i) {
+ callsub(OnCheck, "deletearray (large count) [" + .@i + "]", .@x[.@i], .@y[.@i]);
+ }
+
+ deletearray .@x;
+ deletearray .@y;
+ setarray .@x[1], 1, 2, 0, 0, 0, 6, 7, 8, 0, 0, 0, 13, 14, 15, 16;
+ setarray .@y, 0, 1;
+ deletearray .@x[2];
+ callsub(OnCheck, "deletearray (truncate) and getarraysize", getarraysize(.@x), 2);
+ for (.@i = 0; .@i < 18; ++.@i) {
+ callsub(OnCheck, "deletearray (truncate) [" + .@i + "]", .@x[.@i], .@y[.@i]);
+ }
+
+ deletearray .@x;
+ .@x[1] = 2;
+ .@x[65536] = 1;
+ callsub(OnCheck, "large array index", .@x[65536], 1);
+ callsub(OnCheck, "large array index and getarraysize", getarraysize(.@x), 65537);
+ .@x[65536] = 0;
+ callsub(OnCheck, "large array index (shrink)", .@x[65536], 0);
+ callsub(OnCheck, "large array index and getarraysize (shrink)", getarraysize(.@x), 2);
+ .@x[1] = 0;
+ callsub(OnCheck, "array shrink", .@x[1], 0);
+ callsub(OnCheck, "array shrink and getarraysize", getarraysize(.@x), 0);
+
+ // min and max
+ callsub(OnCheck, "min()", min(5, -10, 8, 3, -2, 1000), -10);
+ callsub(OnCheck, "max()", max(5, -10, 8, 3, -2, 1000), 1000);
+
+
+ // Constants
+ callsub(OnCheck, "'true' constant", true, 1);
+ callsub(OnCheck, "'false' constant", false, 0);
+ callsub(OnCheck, "'Piou' mob ID", Piou, 1002);
+ callsub(OnCheck, "'NV_BASIC' skill ID", NV_BASIC, 1);
+ callsub(OnCheck, "'Acorn' item ID", Acorn, 501);
+ callsub(OnCheck, "'Bread' item ID", Bread, 502);
+
+
+ // setd/getd
+ .@x = 1; .@x$ = ".@x";
+ callsub(OnCheck, "getd", getd(".@x"), 1);
+ callsub(OnCheck, "getd arguments", getd(.@x$), 1);
+ .@y = 0; .@y$ = ".@y";
+ setd(".@y", .@x);
+ callsub(OnCheck, "setd", .@y, 1);
+ setd(.@y$, 2);
+ callsub(OnCheck, "setd arguments", .@y, 2);
+ set getd(".@x"), getd(".@y");
+ callsub(OnCheck, "set getd", .@x, .@y);
+ .@y = 1;
+ setd(".@x", getd(".@y"));
+ callsub(OnCheck, "setd getd", .@x, .@y);
+
+ // getvariableofnpc
+ .xt = 2;
+ set getvariableofnpc(.xt, "TestVarOfAnotherNPC"), 1;
+ callsub(OnCheck, "Setting NPC variables of another NPC", getvariableofnpc(.xt, "TestVarOfAnotherNPC"), 1);
+ callsub(OnCheck, "Setting NPC variables of another NPC (local variable overwrite check)", .xt, 2);
+
+ // Callsub (advanced)
+ callsub(OnCheck, "Callsub return value", callsub(OnTestReturnValue, 1));
+ .@x = 1;
+ callsub(OnCheck, "Callsub return with scope variables", callsub(OnTestScopeVars), 3);
+ callsub(OnCheck, "Callsub (parent scope vars isolation)", .@x, 1);
+ callsub(OnCheck, "Callsub (nested scopes)", callsub(OnTestNestedScope), 1);
+ callsub(OnCheck, "Callsub (deeply nested scopes)", callsub(OnTestDeepNestedScope, 30, 0), 1);
+ .@x = 1;
+ .@y = callsub(OnSetReference, .@x);
+ callsub(OnCheck, "Callsub (setting references)", .@y, 2);
+ callsub(OnCheck, "Callsub (setting references)", .@x, 2);
+ deletearray .@x;
+ setarray .@x, 1, 2, 3, 4;
+ callsub(OnCheck, "Callsub (array references)", callsub(OnTestArrayRefs, .@x), 4);
+ deletearray .@x;
+ .@y = callsub(OnTestReturnArrayRef, .@x);
+ callsub(OnCheck, "Callsub return array references (size check)", getarraysize(.@x), .@y);
+ callsub(OnCheck, "Callsub return array references", getelementofarray(.@x, 3), 8);
+ deletearray .@x;
+ deletearray .@y;
+ setarray .@x, 1, 2;
+ .@z = getarraysize(.@x);
+ setarray .@y, 5, 6, 7, 8, 9;
+ callsub(OnCheck, "Callsub (copyarray from reference with the same name)", getarraysize(.@y), callsub(OnTestScopeArrays, .@y));
+ callsub(OnCheck, "Callsub (parent array vars isolation)", getarraysize(.@x), .@z);
+ deletearray .@x;
+ deletearray .@y;
+ .xt = 2;
+ set getvariableofnpc(.xt, "TestVarOfAnotherNPC"), 1;
+ callsub(OnCheck, "Callsub (return NPC variables from another NPC)", callsub(OnTestVarOfAnotherNPC, "TestVarOfAnotherNPC"), 1);
+ callsub(OnCheck, "Callsub (return NPC variables from another NPC - local variable overwrite check)", .xt, 2);
+
+ // Callfunc
+ callsub(OnCheck, "Callfunc return value", callfunc("F_TestReturnValue", 1));
+ .@x = 1;
+ callsub(OnCheck, "Callfunc return with scope variables", callfunc("F_TestScopeVars"), 3);
+ callsub(OnCheck, "Callfunc (parent scope vars isolation)", .@x, 1);
+ callsub(OnCheck, "Callfunc (nested scopes)", callfunc("F_TestNestedScope"), 1);
+ callsub(OnCheck, "Callfunc (deeply nested scopes)", callfunc("F_TestDeepNestedScope", 30, 0), 1);
+ deletearray .@x;
+ setarray .@x, 1, 2, 3, 4;
+ callsub(OnCheck, "Callfunc (array references)", callfunc("F_TestArrayRefs", .@x), 4);
+ deletearray .@x;
+ .@y = callfunc("F_TestReturnArrayRef", .@x);
+ callsub(OnCheck, "Callfunc return array references (size check)", getarraysize(.@x), .@y);
+ callsub(OnCheck, "Callfunc return array references", getelementofarray(.@x, 3), 8);
+ deletearray .@x;
+ deletearray .@y;
+ setarray .@x, 1, 2;
+ .@z = getarraysize(.@x);
+ setarray .@y, 5, 6, 7, 8, 9;
+ callsub(OnCheck, "Callfunc (copyarray from reference with the same name)", getarraysize(.@y), callfunc("F_TestScopeArrays", .@y));
+ callsub(OnCheck, "Callfunc (parent array vars isolation)", getarraysize(.@x), .@z);
+ deletearray .@x;
+ deletearray .@y;
+ .xt = 1;
+ callsub(OnCheck, "Callfunc return with NPC variables", callfunc("F_TestNPCVars"), 3);
+ callsub(OnCheck, "Callfunc (parent NPC vars isolation)", .xt, 1);
+ callsub(OnCheck, "Callfunc (nested scopes and NPC variables)", callfunc("F_TestNestedScopeNPC"), 1);
+ callsub(OnCheck, "Callfunc (deeply nested scopes and NPC variables)", callfunc("F_TestDeepNestedScopeNPC", 30, 0), 1);
+ deletearray .xt;
+ setarray .xt, 1, 2, 3, 4;
+ callsub(OnCheck, "Callfunc (array references and NPC variables)", callfunc("F_TestArrayRefs", .xt), 4);
+ deletearray .xt;
+ .yt = callfunc("F_TestReturnArrayRef", .xt);
+ callsub(OnCheck, "Callfunc return array references with NPC variables (size check)", getarraysize(.xt), .yt);
+ callsub(OnCheck, "Callfunc return array references wuth NPC variables", getelementofarray(.xt, 3), 8);
+ deletearray .xt;
+ deletearray .yt;
+ setarray .xt, 1, 2;
+ .@z = getarraysize(.@x);
+ setarray .yt, 5, 6, 7, 8, 9;
+ callsub(OnCheck, "Callfunc (copyarray from NPC variable reference with the same name)", getarraysize(.@y), callfunc("F_TestNPCArrays", .@y));
+ callsub(OnCheck, "Callfunc (parent array NPC vars isolation)", getarraysize(.@x), .@z);
+ deletearray .xt;
+ deletearray .yt;
+ .xt = 2;
+ set getvariableofnpc(.xt, "TestVarOfAnotherNPC"), 1;
+ callsub(OnCheck, "Callfunc (return NPC variables from another NPC)", callfunc("F_TestVarOfAnotherNPC", "TestVarOfAnotherNPC"), 1);
+ callsub(OnCheck, "Callfunc (return NPC variables from another NPC - local variable overwrite check)", .xt, 2);
+
+ callsub(OnCheckStr, "sprintf (%%)", sprintf("'%%'"), "'%'");
+ callsub(OnCheckStr, "sprintf (%d)", sprintf("'%d'", 5), "'5'");
+ callsub(OnCheckStr, "sprintf (neg. %d)", sprintf("'%d'", -5), "'-5'");
+ callsub(OnCheckStr, "sprintf (%u)", sprintf("'%u'", 5), "'5'");
+ callsub(OnCheckStr, "sprintf (%x)", sprintf("'%x'", 10), "'a'");
+ callsub(OnCheckStr, "sprintf (%X)", sprintf("'%X'", 31), "'1F'");
+ callsub(OnCheckStr, "sprintf (%s)", sprintf("'%s'", "Hello World!"), "'Hello World!'");
+ callsub(OnCheckStr, "sprintf (%c)", sprintf("'%c'", "Hello World!"), "'H'");
+ callsub(OnCheckStr, "sprintf (%+d)", sprintf("'%+d'", 5), "'+5'");
+ callsub(OnCheckStr, "sprintf (%{n}d)", sprintf("'%5d'", 5), "' 5'");
+ callsub(OnCheckStr, "sprintf (%-{n}d)", sprintf("'%-5d'", 5), "'5 '");
+ callsub(OnCheckStr, "sprintf (%-+{n}d)", sprintf("'%-+5d'", 5), "'+5 '");
+ callsub(OnCheckStr, "sprintf (%+0{n}d)", sprintf("'%+05d'", 5), "'+0005'");
+ callsub(OnCheckStr, "sprintf (%0*d)", sprintf("'%0*d'", 5, 10), "'00010'");
+ callsub(OnCheckStr, "sprintf (Two args)", sprintf("'%+05d' '%x'", 5, 0x7f), "'+0005' '7f'");
+ callsub(OnCheckStr, "sprintf (positional)", sprintf("'%2$+05d'", 5, 6), "'+0006'");
+ callsub(OnCheckStr, "sprintf (positional)", sprintf("'%2$s' '%1$c'", "First", "Second"), "'Second' 'F'");
+
+ if (.errors) {
+ debugmes "Script engine self-test [ \033[0;31mFAILED\033[0m ]";
+ debugmes "**** The test was completed with " + .errors + " errors. ****";
+ } else {
+ debugmes "Script engine self-test [ \033[0;32mPASSED\033[0m ]";
+ }
+ return .errors;
+ end;
OnTestReturnValue:
- return getarg(0);
+ return getarg(0);
OnTestScopeVars:
- .@x = 2;
- return .@x+1;
+ .@x = 2;
+ return .@x+1;
OnTestDeepNestedScope:
- if (getarg(0) <= 0)
- return getarg(1); // Stop recursion
- if (getarg(1))
- return callsub(OnTestDeepNestedScope, getarg(0)-1, getarg(1)); // Recursion step
- .@x = 1;
- return callsub(OnTestDeepNestedScope, getarg(0)-1, .@x); // First step
+ if (getarg(0) <= 0)
+ return getarg(1); // Stop recursion
+ if (getarg(1))
+ return callsub(OnTestDeepNestedScope, getarg(0)-1, getarg(1)); // Recursion step
+ .@x = 1;
+ return callsub(OnTestDeepNestedScope, getarg(0)-1, .@x); // First step
OnTestNestedScope:
- .@x = 1;
- .@y = callsub(OnTestReturnValue, .@x);
- return .@y;
+ .@x = 1;
+ .@y = callsub(OnTestReturnValue, .@x);
+ return .@y;
OnTestArrayRefs:
- return getelementofarray(getarg(0), getarraysize(getarg(0)) - 1);
+ return getelementofarray(getarg(0), getarraysize(getarg(0)) - 1);
OnTestReturnArrayRef:
- setarray getarg(0), 5, 6, 7, 8;
- return getarraysize(getarg(0));
+ setarray getarg(0), 5, 6, 7, 8;
+ return getarraysize(getarg(0));
OnTestScopeArrays:
- setarray .@x, 1, 2, 3, 4;
- copyarray .@y, getarg(0), getarraysize(getarg(0));
- return getarraysize(.@y);
+ setarray .@x, 1, 2, 3, 4;
+ copyarray .@y, getarg(0), getarraysize(getarg(0));
+ return getarraysize(.@y);
OnTestVarOfAnotherNPC:
- return getvariableofnpc(.xt, getarg(0));
+ return getvariableofnpc(.xt, getarg(0));
OnReportError:
- .@msg$ = getarg(0,"Unknown Error");
- .@val$ = getarg(1,"");
- .@ref$ = getarg(2,"");
- if (.errors == 1)
- debugmes "**** WARNING: Any self-test results past this point are unreliable because of previous errors. ****";
- debugmes "Error: "+.@msg$+": '"+.@val$+"' (found) != '"+.@ref$+"' (expected)";
- ++.errors;
- //end;
- return;
+ .@msg$ = getarg(0,"Unknown Error");
+ .@val$ = getarg(1,"");
+ .@ref$ = getarg(2,"");
+ if (.errors == 1)
+ debugmes "**** WARNING: Any self-test results past this point are unreliable because of previous errors. ****";
+ debugmes "Error: "+.@msg$+": '"+.@val$+"' (found) != '"+.@ref$+"' (expected)";
+ ++.errors;
+ //end;
+ return;
OnCheck:
- .@msg$ = getarg(0,"Unknown Error");
- .@val = getarg(1,0);
- .@ref = getarg(2,1);
- if (.@val != .@ref) {
- callsub(OnReportError, .@msg$, ""+.@val, ""+.@ref); // String coercion
- }
- return;
+ .@msg$ = getarg(0,"Unknown Error");
+ .@val = getarg(1,0);
+ .@ref = getarg(2,1);
+ if (.@val != .@ref) {
+ callsub(OnReportError, .@msg$, ""+.@val, ""+.@ref); // String coercion
+ }
+ return;
OnCheckStr:
- .@msg$ = getarg(0,"Unknown Error");
- .@val$ = getarg(1,"");
- .@ref$ = getarg(2,"");
- if (.@val$ != .@ref$) {
- callsub(OnReportError, .@msg$, .@val$, .@ref$);
- }
- return;
+ .@msg$ = getarg(0,"Unknown Error");
+ .@val$ = getarg(1,"");
+ .@ref$ = getarg(2,"");
+ if (.@val$ != .@ref$) {
+ callsub(OnReportError, .@msg$, .@val$, .@ref$);
+ }
+ return;
OnSetReference:
- set getarg(0), getarg(0) + 1;
- return getarg(0);
+ set getarg(0), getarg(0) + 1;
+ return getarg(0);
}
- script HerculesSelfTest FAKE_NPC,{
- end;
+ end;
OnInit:
- callfunc("HerculesSelfTestHelper");
- end;
+ callfunc("HerculesSelfTestHelper");
+ end;
}
diff --git a/npc/functions/masks.txt b/npc/functions/masks.txt
index 23ecfcde..98e8bdf8 100644
--- a/npc/functions/masks.txt
+++ b/npc/functions/masks.txt
@@ -9,9 +9,9 @@
// Artis Aemil's Legion
function script artisALRemTopMask {
- if ((getareausers("001-2-33.gat", 23, 27, 45, 31) >= 1) ||
- (getareausers("001-2-33.gat", 23, 32, 26, 38) >= 1) ||
- (getareausers("001-2-33.gat", 42, 32, 45, 38) >= 1))
+ if ((getareausers("001-2-33", 23, 27, 45, 31) >= 1) ||
+ (getareausers("001-2-33", 23, 32, 26, 38) >= 1) ||
+ (getareausers("001-2-33", 42, 32, 45, 38) >= 1))
{
removemapmask "001-2-33", 4;
}
@@ -19,9 +19,9 @@ function script artisALRemTopMask {
}
function script artisALAddTopMask {
- if ((getareausers("001-2-33.gat", 23, 27, 45, 31) == 0) &&
- (getareausers("001-2-33.gat", 23, 32, 26, 38) == 0) &&
- (getareausers("001-2-33.gat", 42, 32, 45, 38) == 0))
+ if ((getareausers("001-2-33", 23, 27, 45, 31) == 0) &&
+ (getareausers("001-2-33", 23, 32, 26, 38) == 0) &&
+ (getareausers("001-2-33", 42, 32, 45, 38) == 0))
{
addmapmask "001-2-33", 4;
}
@@ -29,7 +29,7 @@ function script artisALAddTopMask {
}
function script artisALRemBotMask {
- if (getareausers("001-2-33.gat", 23, 32, 45, 46) >= 1)
+ if (getareausers("001-2-33", 23, 32, 45, 46) >= 1)
{
removemapmask "001-2-33", 8;
}
@@ -37,7 +37,7 @@ function script artisALRemBotMask {
}
function script artisALAddBotMask {
- if (getareausers("001-2-33.gat", 23, 32, 45, 46) == 0)
+ if (getareausers("001-2-33", 23, 32, 45, 46) == 0)
{
addmapmask "001-2-33", 8;
}
@@ -45,7 +45,7 @@ function script artisALAddBotMask {
}
function script artisALUpdateMask {
- if (getareausers("001-2-33.gat", 23, 32, 45, 46) >= 1)
+ if (getareausers("001-2-33", 23, 32, 45, 46) >= 1)
{
removemapmask "001-2-33", 8;
}
@@ -53,9 +53,9 @@ function script artisALUpdateMask {
{
addmapmask "001-2-33", 8;
}
- if ((getareausers("001-2-33.gat", 23, 27, 45, 31) >= 1) ||
- (getareausers("001-2-33.gat", 23, 32, 26, 38) >= 1) ||
- (getareausers("001-2-33.gat", 42, 32, 45, 38) >= 1))
+ if ((getareausers("001-2-33", 23, 27, 45, 31) >= 1) ||
+ (getareausers("001-2-33", 23, 32, 26, 38) >= 1) ||
+ (getareausers("001-2-33", 42, 32, 45, 38) >= 1))
{
removemapmask "001-2-33", 4;
}
diff --git a/npc/functions/npcmovegraph.txt b/npc/functions/npcmovegraph.txt
index 3f06c73f..b26f9a16 100644
--- a/npc/functions/npcmovegraph.txt
+++ b/npc/functions/npcmovegraph.txt
@@ -61,7 +61,7 @@ function script findmovegraphlabel {
* fromPositionLabel, toPositionLabel -- starting and ending position of NPC move
* moveChanceWeight -- positive integer, represents the chance of moving in given direction. (optional)
* moveFlags -- if .mg_flags & moveFlags != 0, move is possible. (optional)
- * postCommand -- either "moveon" (start moving to next location straight after arriving from
+ * postCommand -- either "moveon" (start moving to next location straight after arriving from
* fromPositionLabel to toPositionLabel) or a semicolon-separated set of commands
* ("wait 3", "emote 5" etc, see `execmovecmd') that will be executed after arrival.
* The commands don't have to end with ";moveon", it's executed in the end by default.
@@ -355,7 +355,7 @@ function script movetonextpoint {
if (!.@weight_sum)
{
npcdebug("error: cannot pick next walk point. flags=" +
- getvariableofnpc(.mg_flags, strnpcinfo(3)));
+ getvariableofnpc(.mg_flags, strnpcinfo(3)));
return;
}