summaryrefslogtreecommitdiff
path: root/npc/custom
diff options
context:
space:
mode:
Diffstat (limited to 'npc/custom')
-rw-r--r--npc/custom/breeder.txt6
-rw-r--r--npc/custom/card_remover.txt2
-rw-r--r--npc/custom/etc/bank.txt12
-rw-r--r--npc/custom/etc/bank_kafra.txt4
-rw-r--r--npc/custom/etc/blackjack.txt4
-rw-r--r--npc/custom/etc/lottery.txt6
-rw-r--r--npc/custom/etc/marriage.txt4
-rw-r--r--npc/custom/etc/monster_arena.txt4
-rw-r--r--npc/custom/etc/penal_servitude.txt2
-rw-r--r--npc/custom/etc/quest_warper.txt20
-rw-r--r--npc/custom/etc/shifty_assassin.txt2
-rw-r--r--npc/custom/etc/stock_market.txt44
-rw-r--r--npc/custom/events/valentinesdayexp.txt4
-rw-r--r--npc/custom/healer.txt2
-rw-r--r--npc/custom/item_signer.txt2
-rw-r--r--npc/custom/quests/hunting_missions.txt4
-rw-r--r--npc/custom/quests/kaho_balmung.txt2
-rw-r--r--npc/custom/quests/kahohorn.txt2
-rw-r--r--npc/custom/quests/quest_shop.txt2
-rw-r--r--npc/custom/quests/questboard.txt4
-rw-r--r--npc/custom/quests/sphinx_mask.txt2
-rw-r--r--npc/custom/quests/sunglasses.txt4
-rw-r--r--npc/custom/quests/thq/THQS_GuildNPC.txt2
-rw-r--r--npc/custom/quests/thq/THQS_QuestNPC.txt2
-rw-r--r--npc/custom/quests/thq/THQS_TTShop.txt6
-rw-r--r--npc/custom/resetnpc.txt6
-rw-r--r--npc/custom/test.txt430
27 files changed, 507 insertions, 77 deletions
diff --git a/npc/custom/breeder.txt b/npc/custom/breeder.txt
index 3eef8af0a..0222f5b3a 100644
--- a/npc/custom/breeder.txt
+++ b/npc/custom/breeder.txt
@@ -15,7 +15,7 @@ prontera,124,201,1 script Universal Rental NPC 4_F_JOB_BLACKSMITH,{
message strcharinfo(0),"You must first remove your mount.";
end;
}
- else if ((eaclass()&EAJ_THIRDMASK==EAJ_RANGER) && !countitem(6124)) {
+ else if ((eaclass()&EAJ_THIRDMASK) == EAJ_RANGER && !countitem(6124)) {
if (!checkfalcon() && getskilllv("HT_FALCON") && !checkoption(Option_Wug) && !checkoption(Option_Wugrider)) {
if(select(" ~ Falcon: ~ Warg")==1) setfalcon;
else getitem 6124,1;
@@ -24,7 +24,7 @@ prontera,124,201,1 script Universal Rental NPC 4_F_JOB_BLACKSMITH,{
}
else getitem 6124,1;
}
- else if ((eaclass()&EAJ_THIRDMASK==EAJ_MECHANIC) && !checkcart() && getskilllv("MC_PUSHCART")) {
+ else if ((eaclass()&EAJ_THIRDMASK) == EAJ_MECHANIC && !checkcart() && getskilllv("MC_PUSHCART")) {
if (!checkmadogear() && getskilllv("NC_MADOLICENCE")) {
if(select(" ~ Cart: ~ Mado")==1) setcart;
else setmadogear;
@@ -36,7 +36,7 @@ prontera,124,201,1 script Universal Rental NPC 4_F_JOB_BLACKSMITH,{
else if (!checkcart() && getskilllv("MC_PUSHCART")) setcart;
else if (!checkfalcon() && getskilllv("HT_FALCON") && !checkoption(Option_Wug) && !checkoption(Option_Wugrider)) setfalcon;
else if (!checkriding() && getskilllv("KN_RIDING")) {
- if (eaclass()&EAJ_THIRDMASK==EAJ_RUNE_KNIGHT) setdragon;
+ if ((eaclass()&EAJ_THIRDMASK) == EAJ_RUNE_KNIGHT) setdragon;
else setriding;
}
else if (!checkmadogear() && getskilllv("NC_MADOLICENCE")) setmadogear;
diff --git a/npc/custom/card_remover.txt b/npc/custom/card_remover.txt
index e1a74936b..887e03404 100644
--- a/npc/custom/card_remover.txt
+++ b/npc/custom/card_remover.txt
@@ -88,7 +88,7 @@ prt_in,28,73,4 script Wise Old Woman#eAcustom 1_F_ORIENT_04,{
}
mes "[Wise Old Woman]";
mes "Very well. I shall begin.";
- Zeny -= (.zenycost+(.@cardcount * .percardcost));
+ set Zeny,Zeny - (.zenycost+(.@cardcount * .percardcost));
delitem 1000,1;
delitem 715,1;
diff --git a/npc/custom/etc/bank.txt b/npc/custom/etc/bank.txt
index 7b569a3d5..51e3e7e74 100644
--- a/npc/custom/etc/bank.txt
+++ b/npc/custom/etc/bank.txt
@@ -42,8 +42,8 @@ switch(select("I'd like to make a deposit.:I'd like to make a withdrawl.:What's
close;
}
else {
- Zeny -= @deposit;
- Zeny -= @cost;
+ set Zeny,Zeny - @deposit;
+ set Zeny,Zeny - @cost;
set #bankstorage,#bankstorage + @deposit;
mes "[Banker]";
mes "Thank you very much... Your zeny is in good hands.";
@@ -80,8 +80,8 @@ switch(select("I'd like to make a deposit.:I'd like to make a withdrawl.:What's
set #bankstorage,#bankstorage - @cost;
set @cost,0;
next;
- Zeny -= @cost;
- Zeny += @withdrawl;
+ set Zeny,Zeny - @cost;
+ set Zeny,Zeny + @withdrawl;
set #bankstorage,#bankstorage - @withdrawl;
mes "[Banker]";
mes "There's your Zeny. Have a good day.";
@@ -93,8 +93,8 @@ switch(select("I'd like to make a deposit.:I'd like to make a withdrawl.:What's
}
}
else {
- Zeny -= @cost;
- Zeny += @withdrawl;
+ set Zeny,Zeny - @cost;
+ set Zeny,Zeny + @withdrawl;
set #bankstorage,#bankstorage - @withdrawl;
mes "[Banker]";
mes "There's your Zeny. Have a good day.";
diff --git a/npc/custom/etc/bank_kafra.txt b/npc/custom/etc/bank_kafra.txt
index 396d45de2..48086abbd 100644
--- a/npc/custom/etc/bank_kafra.txt
+++ b/npc/custom/etc/bank_kafra.txt
@@ -48,7 +48,7 @@ L_NoIncomeToday:
if(@kafrabank<1000) goto L_LESS_1000;
if(@kafrabank>Zeny) goto L_NOT_ENOUGH;
- Zeny -=@kafrabank;
+ set Zeny,Zeny-@kafrabank;
set #kafrabank,#kafrabank+@kafrabank;
mes"[Maniss]";
mes "You've made a deposit of ^135445" + @kafrabank + "z^000000.";
@@ -67,7 +67,7 @@ M_WITHDRAW:
if(@kafrabank<1) goto B_EXIT2;
if(@kafrabank>#kafrabank) goto L_NOT_ENOUGH;
set #kafrabank,#kafrabank-@kafrabank;
- Zeny +=@kafrabank;
+ set Zeny,Zeny+@kafrabank;
mes"[Maniss]";
mes "Here is your ^135445" + @kafrabank + "z^000000, put your sign here...";
//we log these zeny operations into the log db
diff --git a/npc/custom/etc/blackjack.txt b/npc/custom/etc/blackjack.txt
index b86316706..8fe70ad72 100644
--- a/npc/custom/etc/blackjack.txt
+++ b/npc/custom/etc/blackjack.txt
@@ -233,12 +233,12 @@ sL_Win:
mes "[Dealer]";
mes "Congratulations, you've won!";
next;
- Zeny += @bet;
+ set Zeny, Zeny + @bet;
goto L_Play;
sL_Lose:
mes "[Dealer]";
mes "I'm sorry but you've lost.";
- Zeny -= @bet;
+ set Zeny, Zeny - @bet;
next;
goto L_Play;
sL_Push:
diff --git a/npc/custom/etc/lottery.txt b/npc/custom/etc/lottery.txt
index 4ad9ec0d2..26c4afa9f 100644
--- a/npc/custom/etc/lottery.txt
+++ b/npc/custom/etc/lottery.txt
@@ -107,7 +107,7 @@ L_Buy:
next;
menu "Buy Ticket",-,"Cancel",L_Cancel;
if (Zeny < $L_TicketPrice) goto L_NoZeny;
- Zeny -=$L_TicketPrice;
+ set Zeny,Zeny-$L_TicketPrice;
mes "[Lottery]";
mes "Would you like your numbers hand picked or computer generated?";
next;
@@ -292,7 +292,7 @@ LWinBig:
mes "You have matched all six numbers!";
mes "Jackpot!";
mes "You've won ^0000FF" + $L_Prize_Money + "z^000000.";
- Zeny +=$L_Prize_Money;
+ set Zeny,Zeny+$L_Prize_Money;
announce "Lottery: " + strcharinfo(0) + " has won the JACKPOT of " + $L_Prize_Money + "z!",8;
set #LID,0;
close;
@@ -302,7 +302,7 @@ LWinSmall:
mes "[Lottery]";
mes "You have matched at least 4 numbers!";
mes "You've won ^0000FF" + $L_Prize_Money_Small + "z^000000.";
- Zeny +=$L_Prize_Money_Small;
+ set Zeny,Zeny+$L_Prize_Money_Small;
announce "Lottery: " + strcharinfo(0) + " has won a prize of " + $L_Prize_Money_Small + "z!",8;
set #LID,0;
close;
diff --git a/npc/custom/etc/marriage.txt b/npc/custom/etc/marriage.txt
index 97b6ca8de..f0ec34f0a 100644
--- a/npc/custom/etc/marriage.txt
+++ b/npc/custom/etc/marriage.txt
@@ -716,7 +716,7 @@ function SF_TryRegister {
mes "Come back once you have collected "+@cost+"z.";
close;
}
- Zeny -=@cost;
+ set Zeny,Zeny-@cost;
sc_start SC_WEDDING,3600000,1; //Start Wedding Effect (SC_WEDDING)
if (@bride) {
set $wed_bride_progress,1;
@@ -911,7 +911,7 @@ function SF_InProgress {
emotion e_swt2;
close;
}
- Zeny -=$@wed_divorce_fee;
+ set Zeny,Zeny-$@wed_divorce_fee;
announce $@divorcer$+" has just divorced "+strcharinfo(0)+"...", 8;
mes "["+@name$+"]";
mes "Your divorce has been filed. You are no longer wed.";
diff --git a/npc/custom/etc/monster_arena.txt b/npc/custom/etc/monster_arena.txt
index 81ac93eab..90fd500f6 100644
--- a/npc/custom/etc/monster_arena.txt
+++ b/npc/custom/etc/monster_arena.txt
@@ -289,7 +289,7 @@ gon_test,52,103,6 script Monster Trainer 4_M_BARBER,{
menu "Yes",-,"No",L_Exit;
if (Zeny < 1000) goto L_NoZeny;
- Zeny -=1000;
+ set Zeny,Zeny-1000;
set #monster,10;
mes "[Monster Trainer]";
mes "Congratulations!";
@@ -327,7 +327,7 @@ L_Sell:
if (@sellexp > #monpoints) goto L_NoExp;
set #monpoints,#monpoints-@sellexp;
set @sellearn,100*@sellexp; // Price of exp
- Zeny +=@sellearn;
+ set Zeny,Zeny+@sellearn;
mes "[Monster Trainer]";
mes "You earned ^0000FF" + @sellearn + "^000000z.";
close;
diff --git a/npc/custom/etc/penal_servitude.txt b/npc/custom/etc/penal_servitude.txt
index d64cd63d2..d86c9dc94 100644
--- a/npc/custom/etc/penal_servitude.txt
+++ b/npc/custom/etc/penal_servitude.txt
@@ -43,7 +43,7 @@ M_PAY:
M_PAYCASH:
if (@MUSTPAY>Zeny) goto L_NOCASH;
- Zeny -=@MUSTPAY;
+ set Zeny,Zeny-@MUSTPAY;
mes "[Saddeus]";
mes "OK, sing here and there.";
goto L_RELEASE;
diff --git a/npc/custom/etc/quest_warper.txt b/npc/custom/etc/quest_warper.txt
index c1b63ebed..62ea56c93 100644
--- a/npc/custom/etc/quest_warper.txt
+++ b/npc/custom/etc/quest_warper.txt
@@ -323,11 +323,11 @@ L_town:
if (@Tmenuref[@TWMenu-1] == 57005) goto L_End; // 57005='dead' in hex
if(Zeny<@pTprice[@Tmenuref[@TWMenu-1]]) callsub L_Short_on_zeny,0;
- Zeny -=@pTprice[@Tmenuref[@TWMenu-1]];
+ set Zeny, Zeny-@pTprice[@Tmenuref[@TWMenu-1]];
if ($QW_KPoint == 1) set RESRVPTS, RESRVPTS + (@pTprice[@Tmenuref[@TWMenu-1]]/16);
warp @pTmap$[@Tmenuref[@TWMenu-1]],@pTXcoords[@Tmenuref[@TWMenu-1]],@pTYcoords[@Tmenuref[@TWMenu-1]];
close2;
- Zeny +=@pTprice[@Tmenuref[@TWMenu-1]];
+ set Zeny, Zeny+@pTprice[@Tmenuref[@TWMenu-1]];
end;
//=========================Dungeons================================
@@ -361,11 +361,11 @@ L_dungeon:
set @warpprice, @pDprice[@Dmenuref[@DWMenu-1]]+(getd(@pDfee$[@Dmenuref[@DWMenu-1]])*(@DDepth[@Darrayref]));
if(Zeny<@warpprice) callsub L_Short_on_zeny,1;
- Zeny -=(@warpprice);
+ set Zeny, Zeny-(@warpprice);
if ($QW_KPoint == 1) set RESRVPTS, RESRVPTS + (@warpprice/16);
warp @DGat$[@Darrayref],@DXcoords[@Darrayref],@DYcoords[@Darrayref];
close2;
- Zeny +=@pTprice[@Tmenuref[@DWMenu-1]];
+ set Zeny, Zeny+@pTprice[@Tmenuref[@DWMenu-1]];
end;
//=============================Healing=============================
@@ -373,7 +373,7 @@ L_dungeon:
L_heal_Full:
set @healfee, $QW_HF_PRICE;
if(Zeny<@healfee) callsub L_Short_on_zeny,4;
- Zeny -=@healfee;
+ set Zeny, Zeny-@healfee;
if ($QW_KPoint == 1) set RESRVPTS, RESRVPTS + (@healfee/500);
next;
mes "[Warpra]";
@@ -408,7 +408,7 @@ PHeal:
if (getarg(0) == 1)&&(getarg(1) == 1)&&(Zeny<@healfee) goto Zeny_Short_Both;
if (getarg(0) == 1)&&(Zeny<@healfee) goto Zeny_short_HP;
if (getarg(1) == 1)&&(Zeny<@healfee) goto Zeny_short_SP;
- Zeny -=@healfee;
+ set Zeny, Zeny-@healfee;
if (getarg(0) == 1)&&(getarg(1) == 1) percentheal 100,100;
if (getarg(0) == 1) percentheal 100,0;
if (getarg(1) == 1) percentheal 0,100;
@@ -430,7 +430,7 @@ Zeny_short_HP:
set @HpPrice, @Hp*$QW_HP_H_PRICE;
if (@Hp == 1) mes "You're not worth the effort.";
if (@Hp == 1) goto L_End;
- Zeny -=@HpPrice;
+ set Zeny, Zeny-@HpPrice;
heal @Hp,0;
close;
end;
@@ -443,7 +443,7 @@ Zeny_short_SP:
set @SpPrice, @Sp*$QW_HP_S_PRICE;
if (@Sp == 1) mes "You're not worth the effort.";
if (@Sp == 1) goto L_End;
- Zeny -=@SpPrice;
+ set Zeny, Zeny-@SpPrice;
heal 0,@Sp;
close;
end;
@@ -457,7 +457,7 @@ L_Storage:
if ($QW_S_PRICE == 60)&&(BaseJob == Job_Novice) set @fee, 30;
if ($QW_S_PRICE == 60)&&(BaseJob != Job_Novice) set @fee, 60;
if(Zeny<@fee) callsub L_Short_on_zeny,2;
- Zeny -=@fee;
+ set Zeny, Zeny-@fee;
if ($QW_KPoint == 1) set RESRVPTS, RESRVPTS + (@fee/5);
mes "[Warpra]";
@@ -491,7 +491,7 @@ L_GStorage:
end;
}
if (Zeny<$QW_GS_PRICE) callsub L_Short_on_zeny,3;
- Zeny -=$QW_GS_PRICE;
+ set Zeny, Zeny-$QW_GS_PRICE;
if ($QW_KPoint == 1) set RESRVPTS, RESRVPTS + ($QW_GS_PRICE/5);
next;
mes "[Warpra]";
diff --git a/npc/custom/etc/shifty_assassin.txt b/npc/custom/etc/shifty_assassin.txt
index 8c2be6f9f..29b8384fe 100644
--- a/npc/custom/etc/shifty_assassin.txt
+++ b/npc/custom/etc/shifty_assassin.txt
@@ -55,7 +55,7 @@ M_Buy:
next;
menu "Continue",-,"Cancel",M_Exit;
- Zeny -=@price;
+ set Zeny,Zeny-@price;
set #ninjas,#ninjas+@buy;
set $ninja_avail,$ninja_avail-@buy;
diff --git a/npc/custom/etc/stock_market.txt b/npc/custom/etc/stock_market.txt
index 9d5208880..7cd284ef9 100644
--- a/npc/custom/etc/stock_market.txt
+++ b/npc/custom/etc/stock_market.txt
@@ -278,14 +278,14 @@ S_Sell:
input @sellamount;
if (@sellamount < 1) goto S_SellInv;
if (Zeny < $S_Trans) goto S_NoZeny;
- Zeny -=$S_Trans;
+ set Zeny,Zeny-$S_Trans;
SELLS1:
if (@sellname$ != $S1N$) goto SELLS2;
if (@sellamount > #S1) goto S_SellTooHigh;
set @price,@sellamount*$S1;
set #S1,#S1-@sellamount;
- Zeny +=@price;
+ set Zeny,Zeny+@price;
next;
mes "Sold " + @sellamount + " " + $S1N$ + " shares.";
mes "Earned ^0000FF"+@price+"z^000000.";
@@ -297,7 +297,7 @@ SELLS2:
if (@sellamount > #S2) goto S_SellTooHigh;
set @price,@sellamount*$S2;
set #S2,#S2-@sellamount;
- Zeny +=@price;
+ set Zeny,Zeny+@price;
next;
mes "Sold " + @sellamount + " " + $S2N$ + " shares.";
mes "Earned ^0000FF"+@price+"z^000000.";
@@ -309,7 +309,7 @@ SELLS3:
if (@sellamount > #S3) goto S_SellTooHigh;
set @price,@sellamount*$S3;
set #S3,#S3-@sellamount;
- Zeny +=@price;
+ set Zeny,Zeny+@price;
next;
mes "Sold " + @sellamount + " " + $S3N$ + " shares.";
mes "Earned ^0000FF"+@price+"z^000000.";
@@ -321,7 +321,7 @@ SELLS4:
if (@sellamount > #S4) goto S_SellTooHigh;
set @price,@sellamount*$S4;
set #S4,#S4-@sellamount;
- Zeny +=@price;
+ set Zeny,Zeny+@price;
next;
mes "Sold " + @sellamount + " " + $S4N$ + " shares.";
mes "Earned ^0000FF"+@price+"z^000000.";
@@ -333,7 +333,7 @@ SELLS5:
if (@sellamount > #S5) goto S_SellTooHigh;
set @price,@sellamount*$S5;
set #S5,#S5-@sellamount;
- Zeny +=@price;
+ set Zeny,Zeny+@price;
next;
mes "Sold " + @sellamount + " " + $S5N$ + " shares.";
mes "Earned ^0000FF"+@price+"z^000000.";
@@ -345,7 +345,7 @@ SELLS6:
if (@sellamount > #S6) goto S_SellTooHigh;
set @price,@sellamount*$S6;
set #S6,#S6-@sellamount;
- Zeny +=@price;
+ set Zeny,Zeny+@price;
next;
mes "Sold " + @sellamount + " " + $S6N$ + " shares.";
mes "Earned ^0000FF"+@price+"z^000000.";
@@ -357,7 +357,7 @@ SELLS7:
if (@sellamount > #S7) goto S_SellTooHigh;
set @price,@sellamount*$S7;
set #S7,#S7-@sellamount;
- Zeny +=@price;
+ set Zeny,Zeny+@price;
next;
mes "Sold " + @sellamount + " " + $S7N$ + " shares.";
mes "Earned ^0000FF"+@price+"z^000000.";
@@ -369,7 +369,7 @@ SELLS8:
if (@sellamount > #S8) goto S_SellTooHigh;
set @price,@sellamount*$S8;
set #S8,#S8-@sellamount;
- Zeny +=@price;
+ set Zeny,Zeny+@price;
next;
mes "Sold " + @sellamount + " " + $S8N$ + " shares.";
mes "Earned ^0000FF"+@price+"z^000000.";
@@ -381,7 +381,7 @@ SELLS9:
if (@sellamount > #S9) goto S_SellTooHigh;
set @price,@sellamount*$S9;
set #S9,#S9-@sellamount;
- Zeny +=@price;
+ set Zeny,Zeny+@price;
next;
mes "Sold " + @sellamount + " " + $S9N$ + " shares.";
mes "Earned ^0000FF"+@price+"z^000000.";
@@ -393,7 +393,7 @@ SELLS10:
if (@sellamount > #S10) goto S_SellTooHigh;
set @price,@sellamount*$S10;
set #S10,#S10-@sellamount;
- Zeny +=@price;
+ set Zeny,Zeny+@price;
next;
mes "Sold " + @sellamount + " " + $S10N$ + " shares.";
mes "Earned ^0000FF"+@price+"z^000000.";
@@ -443,7 +443,7 @@ S_Buy:
if (@buyamount < $S_BuyMin) goto S_TooLow;
if (@buyamount > $S_BuyMax) goto S_TooHigh;
if (Zeny < $S_Trans) goto S_NoZeny;
- Zeny -=$S_Trans;
+ set Zeny,Zeny-$S_Trans;
// Purchases the shares //
@@ -453,7 +453,7 @@ PURS1:
if (Zeny < @price) goto S_NoZeny;
set #S1,#S1+@buyamount;
set @price,@buyamount*$S1;
- Zeny -=@price;
+ set Zeny,Zeny-@price;
mes "Bought " + @buyamount + " " + $S1N$ + " shares.";
mes "Lost ^0000FF"+@price+"z^000000.";
next;
@@ -464,7 +464,7 @@ PURS2:
set @price,@buyamount*$S2;
if (Zeny < @price) goto S_NoZeny;
set #S2,#S2+@buyamount;
- Zeny -=@price;
+ set Zeny,Zeny-@price;
mes "Bought " + @buyamount + " " + $S2N$ + " shares.";
mes "Lost ^0000FF"+@price+"z^000000.";
next;
@@ -475,7 +475,7 @@ PURS3:
set @price,@buyamount*$S3;
if (Zeny < @price) goto S_NoZeny;
set #S3,#S3+@buyamount;
- Zeny -=@price;
+ set Zeny,Zeny-@price;
mes "Bought " + @buyamount + " " + $S3N$ + " shares.";
mes "Lost ^0000FF"+@price+"z^000000.";
next;
@@ -486,7 +486,7 @@ PURS4:
set @price,@buyamount*$S4;
if (Zeny < @price) goto S_NoZeny;
set #S4,#S4+@buyamount;
- Zeny -=@price;
+ set Zeny,Zeny-@price;
mes "Bought " + @buyamount + " " + $S4N$ + " shares.";
mes "Lost ^0000FF"+@price+"z^000000.";
next;
@@ -497,7 +497,7 @@ PURS5:
set @price,@buyamount*$S5;
if (Zeny < @price) goto S_NoZeny;
set #S5,#S5+@buyamount;
- Zeny -=@price;
+ set Zeny,Zeny-@price;
mes "Bought " + @buyamount + " " + $S5N$ + " shares.";
mes "Lost ^0000FF"+@price+"z^000000.";
next;
@@ -508,7 +508,7 @@ PURS6:
set @price,@buyamount*$S6;
if (Zeny < @price) goto S_NoZeny;
set #S6,#S6+@buyamount;
- Zeny -=@price;
+ set Zeny,Zeny-@price;
mes "Bought " + @buyamount + " " + $S6N$ + " shares.";
mes "Lost ^0000FF"+@price+"z^000000.";
next;
@@ -519,7 +519,7 @@ PURS7:
set @price,@buyamount*$S7;
if (Zeny < @price) goto S_NoZeny;
set #S7,#S7+@buyamount;
- Zeny -=@price;
+ set Zeny,Zeny-@price;
mes "Bought " + @buyamount + " " + $S7N$ + " shares.";
mes "Lost ^0000FF"+@price+"z^000000.";
next;
@@ -530,7 +530,7 @@ PURS8:
set @price,@buyamount*$S8;
if (Zeny < @price) goto S_NoZeny;
set #S8,#S8+@buyamount;
- Zeny -=@price;
+ set Zeny,Zeny-@price;
mes "Bought " + @buyamount + " " + $S8N$ + " shares.";
mes "Lost ^0000FF"+@price+"z^000000.";
next;
@@ -541,7 +541,7 @@ PURS9:
set @price,@buyamount*$S9;
if (Zeny < @price) goto S_NoZeny;
set #S9,#S9+@buyamount;
- Zeny -=@price;
+ set Zeny,Zeny-@price;
mes "Bought " + @buyamount + " " + $S9N$ + " shares.";
mes "Lost ^0000FF"+@price+"z^000000.";
next;
@@ -552,7 +552,7 @@ PURS10:
set @price,@buyamount*$S10;
if (Zeny < @price) goto S_NoZeny;
set #S10,#S10+@buyamount;
- Zeny -=@price;
+ set Zeny,Zeny-@price;
mes "Bought " + @buyamount + " " + $S10N$ + " shares.";
mes "Lost ^0000FF"+@price+"z^000000.";
next;
diff --git a/npc/custom/events/valentinesdayexp.txt b/npc/custom/events/valentinesdayexp.txt
index 5a94bc913..7f12e5325 100644
--- a/npc/custom/events/valentinesdayexp.txt
+++ b/npc/custom/events/valentinesdayexp.txt
@@ -105,7 +105,7 @@ M_CHOCO:
if (@flag_num > 5) goto L_ERR;
set @needmon,@flag_num*5000;
if (Zeny < @needmon) goto L_NOTENO;
- Zeny -= @needmon;
+ set Zeny,Zeny - @needmon;
getitem 558,@flag_num;
mes "[Stephen]";
mes "There you go!";
@@ -167,7 +167,7 @@ M_CHOCO:
set @needmon,@flag_num*4500;
if (Zeny < @needmon) goto L_NOTENO;
if (countitem(519) < @flag_num) goto L_NOMILK;
- Zeny -= @needmon;
+ set Zeny,Zeny - @needmon;
delitem 519,@flag_num;
getitem 561,@flag_num;
mes "[Jainie]";
diff --git a/npc/custom/healer.txt b/npc/custom/healer.txt
index 211b7c023..e11e2a647 100644
--- a/npc/custom/healer.txt
+++ b/npc/custom/healer.txt
@@ -22,7 +22,7 @@
message strcharinfo(0),"Healing costs "+.@price+" Zeny.";
if (Zeny < .@price) end;
if(select("^0055FFHeal^000000:^777777Cancel^000000") == 2) end;
- Zeny -=.@price;
+ set Zeny, Zeny-.@price;
}
specialeffect2 EF_HEAL2; percentheal 100,100;
if (.@Buffs) {
diff --git a/npc/custom/item_signer.txt b/npc/custom/item_signer.txt
index 6796a21c8..3cd66234b 100644
--- a/npc/custom/item_signer.txt
+++ b/npc/custom/item_signer.txt
@@ -121,7 +121,7 @@ prt_in,24,61,7 script Perchik 1_M_01,{
emotion e_wah;
close;
}
- if (.@price) Zeny -=.@price;
+ if (.@price) set Zeny, Zeny-.@price;
if (getarraysize(.@item)) for(set .@i,0; .@i<getarraysize(.@item); set .@i,.@i+2)
delitem .@item[.@i], .@item[.@i+1];
delitem2 .@id,1,1,.@ref,0,.@slot[0],.@slot[1],.@slot[2],.@slot[3];
diff --git a/npc/custom/quests/hunting_missions.txt b/npc/custom/quests/hunting_missions.txt
index 5f352b2a4..d5d466f73 100644
--- a/npc/custom/quests/hunting_missions.txt
+++ b/npc/custom/quests/hunting_missions.txt
@@ -92,7 +92,7 @@ function Chk; function Cm;
emotion e_sry;
close;
}
- Zeny -=.Reset;
+ set Zeny, Zeny-.Reset;
emotion e_cash;
}
mes "[Hunting Missions]";
@@ -173,7 +173,7 @@ Mission_Status:
set #Mission_Points, #Mission_Points+.@Mission_Points;
set BaseExp, BaseExp+.@Base_Exp;
set JobExp, JobExp+.@Job_Exp;
- Zeny +=.@zeny;
+ set Zeny, Zeny+.@zeny;
for(set .@i,0; .@i<.Quests; set .@i,.@i+1) {
setd "Mission"+.@i,0;
setd "Mission"+.@i+"_",0;
diff --git a/npc/custom/quests/kaho_balmung.txt b/npc/custom/quests/kaho_balmung.txt
index 624e71d1b..fac8b85ff 100644
--- a/npc/custom/quests/kaho_balmung.txt
+++ b/npc/custom/quests/kaho_balmung.txt
@@ -42,7 +42,7 @@ prontera,158,356,4 script Royal Messenger 8W_SOLDIER,{
close; }
for(set .@j,1; .@j<13; set .@j,.@j+2)
delitem getd(".@Req"+.@i+"["+.@j+"]"), getd(".@Req"+.@i+"["+(.@j+1)+"]");
- Zeny -=1000000;
+ set Zeny, Zeny-1000000;
mes "I see you already have all the items you need. Here's your "+getitemname(getd(".@Req"+.@i+"[0]"))+", as promised.";
getitem getd(".@Req"+.@i+"[0]"),1;
close;
diff --git a/npc/custom/quests/kahohorn.txt b/npc/custom/quests/kahohorn.txt
index 8cc2dae3f..882728925 100644
--- a/npc/custom/quests/kahohorn.txt
+++ b/npc/custom/quests/kahohorn.txt
@@ -59,7 +59,7 @@ geffen,115,107,5 script Lord Kaho's Servant 1_M_PUBMASTER,{
for(set .@i,0; .@i<18; set .@i,.@i+1)
delitem .@items[.@i],1;
delitem 714,3;
- Zeny -=5000000;
+ set Zeny, Zeny-5000000;
mes "Wow! You are brave indeed!";
getitem 5013,1;
mes "Enjoy being God of Rune-Midgard!";
diff --git a/npc/custom/quests/quest_shop.txt b/npc/custom/quests/quest_shop.txt
index e7017f2b6..9398826ba 100644
--- a/npc/custom/quests/quest_shop.txt
+++ b/npc/custom/quests/quest_shop.txt
@@ -138,7 +138,7 @@ OnBuyItem:
mes "^FF0000You need "+(((.@q[2]*getiteminfo(.@q[0],6))+Weight-MaxWeight)/10)+" additional weight capacity to complete this trade.^000000";
close;
}
- if (.@q[4]) Zeny -=(.@q[4]*.@q[1]);
+ if (.@q[4]) set Zeny, Zeny-(.@q[4]*.@q[1]);
if (.@q[5]) setd .Points$[0], getd(.Points$[0])-(.@q[5]*.@q[1]);
if (.@q[6]) for(set .@i,6; .@i<getarraysize(.@q); set .@i,.@i+2)
delitem .@q[.@i],.@q[.@i+1]*.@q[1];
diff --git a/npc/custom/quests/questboard.txt b/npc/custom/quests/questboard.txt
index 3ecb434c3..28a25cc28 100644
--- a/npc/custom/quests/questboard.txt
+++ b/npc/custom/quests/questboard.txt
@@ -194,7 +194,7 @@ L_checkitems:
mes "[^FF7700Questboard^000000]";
mes "Congratulation! Here is your Reward.";
if(getd("." +currentquest$+"_collectionprize")!=0) getitem(getd("." +currentquest$+"_collectionprize"),getd("." +currentquest$+"_collectionamount"));
- Zeny +=getd("." +currentquest$+"_collectionzeny");
+ set Zeny,Zeny+getd("." +currentquest$+"_collectionzeny");
getexp getd("." +currentquest$+"_collectionexp["+0+"]"),getd("." +currentquest$+"_collectionexp["+1+"]");
setd(currentquest$ + "_collection_delay"),gettimetick(2)+.quest_delay;
set currentquest$, "";
@@ -228,7 +228,7 @@ L_checkmobs2:
setd(currentquest$+"_"+.@currentmob+"_"+.@x+"_killcount", 0);
}
if(getd("." +currentquest$+"_huntingprize")!=0) getitem(getd("." +currentquest$+"_huntingprize"),getd("." +currentquest$+"_huntingamount"));
- Zeny +=getd("." +currentquest$+"_huntingzeny");
+ set Zeny, Zeny+getd("." +currentquest$+"_huntingzeny");
getexp getd("." +currentquest$+"_huntingexp["+0+"]"),getd("." +currentquest$+"_huntingexp["+1+"]");
setd(currentquest$ + "_hunting_delay"),gettimetick(2)+.quest_delay;
set currentquest$, "";
diff --git a/npc/custom/quests/sphinx_mask.txt b/npc/custom/quests/sphinx_mask.txt
index 49c8f2169..b4e9c118c 100644
--- a/npc/custom/quests/sphinx_mask.txt
+++ b/npc/custom/quests/sphinx_mask.txt
@@ -42,7 +42,7 @@ L_Menu:
if (Zeny < getarg(2)) {
mes "Are youz playin wit me? You don't have ze money!";
close; }
- Zeny -=getarg(2);
+ set Zeny, Zeny-getarg(2);
mes "O ho ho, it's a deal, then!";
getitem 7114,1;
set sphmask_q,1;
diff --git a/npc/custom/quests/sunglasses.txt b/npc/custom/quests/sunglasses.txt
index 0e661cec8..a4c828457 100644
--- a/npc/custom/quests/sunglasses.txt
+++ b/npc/custom/quests/sunglasses.txt
@@ -56,7 +56,7 @@ alberta,88,193,5 script Sunglasses Trader 1_F_MERCHANT_01,{
close; }
delitem 730,1;
delitem 949,50;
- Zeny -=100000;
+ set Zeny, Zeny-100000;
set SG_QUEST1,1;
mes "[Sunglasses Trader]";
mes "Great. Now, listen carefully.";
@@ -94,7 +94,7 @@ moc_fild07,334,186,5 script Maseph 4_F_GON,{
mes "You do not have enough Zeny. Come back to me when you do.";
close; }
delitem 2201,1;
- Zeny -=400000;
+ set Zeny, Zeny-400000;
mes "Thank you. I will get on it right away...";
next;
mes "[Maseph]";
diff --git a/npc/custom/quests/thq/THQS_GuildNPC.txt b/npc/custom/quests/thq/THQS_GuildNPC.txt
index 837a4d7fd..3e0723781 100644
--- a/npc/custom/quests/thq/THQS_GuildNPC.txt
+++ b/npc/custom/quests/thq/THQS_GuildNPC.txt
@@ -26,7 +26,7 @@ yuno_in01,124,164,6 script Guild Leader 1_M_PRON_KING,{
next;
menu "Pay ^FF000025,000z^000000.",-,"Thats way to high!!",N_HighPrice;
if (Zeny < 25000) goto N_NoZeny;
- Zeny -=25000;
+ set Zeny,Zeny-25000;
//getitem 7950, 1;
//getitem 7951, 1;
set Event_THQS,1;
diff --git a/npc/custom/quests/thq/THQS_QuestNPC.txt b/npc/custom/quests/thq/THQS_QuestNPC.txt
index 66a2cbbcc..9a09089b0 100644
--- a/npc/custom/quests/thq/THQS_QuestNPC.txt
+++ b/npc/custom/quests/thq/THQS_QuestNPC.txt
@@ -42,7 +42,7 @@ N_PayZeny:
set nine_qset, 0;
set ten_qset, 0;
set On_Quest, 0;
- Zeny -=2500;
+ set Zeny,Zeny-2500;
//add time delay penalty. You can get another quest after 2 - 3 hours. [Lupus]
set #THQ_DELAY, (gettime(7)*12*31*24+gettime(6)*31*24+gettime(5)*24+gettime(3)+rand(2,3));
mes "[Guy]";
diff --git a/npc/custom/quests/thq/THQS_TTShop.txt b/npc/custom/quests/thq/THQS_TTShop.txt
index 113e0be4d..25e080a8e 100644
--- a/npc/custom/quests/thq/THQS_TTShop.txt
+++ b/npc/custom/quests/thq/THQS_TTShop.txt
@@ -51,7 +51,7 @@ N_Shop:
close;
N_GetZeny1k:
set #Treasure_Token,#Treasure_Token-1;
- Zeny +=1000;
+ set Zeny,Zeny+1000;
close;
N_10T:
if (#Treasure_Token > 9) goto N_GetZeny10k;
@@ -59,7 +59,7 @@ N_10T:
close;
N_GetZeny10k:
set #Treasure_Token,#Treasure_Token-10;
- Zeny +=10000;
+ set Zeny,Zeny+10000;
close;
N_100T:
if (#Treasure_Token > 99) goto N_GetZeny100k;
@@ -67,7 +67,7 @@ N_100T:
close;
N_GetZeny100k:
set #Treasure_Token,#Treasure_Token-100;
- Zeny +=100000;
+ set Zeny,Zeny+100000;
close;
N_BuyWeps:
diff --git a/npc/custom/resetnpc.txt b/npc/custom/resetnpc.txt
index bd8f5e930..ae86ea035 100644
--- a/npc/custom/resetnpc.txt
+++ b/npc/custom/resetnpc.txt
@@ -33,7 +33,7 @@ prontera,150,193,4 script Reset Girl 4_F_TELEPORTER,{
mes "Sorry, you don't have enough Zeny.";
close;
}
- Zeny -=.@ResetSkill;
+ set Zeny, Zeny-.@ResetSkill;
sc_end SC_ALL;
resetskill;
mes "There you go!";
@@ -44,7 +44,7 @@ prontera,150,193,4 script Reset Girl 4_F_TELEPORTER,{
mes "Sorry, you don't have enough Zeny.";
close;
}
- Zeny -=.@ResetStat;
+ set Zeny, Zeny-.@ResetStat;
resetstatus;
mes "There you go!";
close;
@@ -54,7 +54,7 @@ prontera,150,193,4 script Reset Girl 4_F_TELEPORTER,{
mes "Sorry, you don't have enough Zeny.";
close;
}
- Zeny -=.@ResetBoth;
+ set Zeny, Zeny-.@ResetBoth;
sc_end SC_ALL;
resetskill;
resetstatus;
diff --git a/npc/custom/test.txt b/npc/custom/test.txt
new file mode 100644
index 000000000..0fffecf73
--- /dev/null
+++ b/npc/custom/test.txt
@@ -0,0 +1,430 @@
+//===== Hercules Script ======================================
+//= Script engine self-tests
+//===== By: ==================================================
+//= Haru
+//===== Current Version: =====================================
+//= 1.0
+//===== Description: =========================================
+//= Script to test operators and possibly other elements of
+//= the script engine, useful for regression testing.
+
+- script HerculesSelfTest -1,{
+ end;
+OnCheck:
+ .@msg$ = getarg(0,"Unknown Error");
+ .@val = getarg(1,0);
+ .@ref = getarg(2,1);
+ if (.@val != .@ref) {
+ debugmes "Error: "+.@msg$+": '"+.@val+"' != '"+.@ref+"'";
+ //end;
+ }
+ return;
+OnCheckStr:
+ .@msg$ = getarg(0,"Unknown Error");
+ .@val$ = getarg(1,"");
+ .@ref$ = getarg(2,"");
+ if (.@val$ != .@ref$) {
+ debugmes "Error: "+.@msg$+": '"+.@val$+"' != '"+.@ref$+"'";
+ //end;
+ }
+ return;
+OnInit:
+ // 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);
+
+ // 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, "1Associativity of =", .@x);
+ callsub(OnCheck, "2Associativity of =", .@y);
+ .@x = 0; .@y = 1;
+ .@x = .@y += 4;
+ callsub(OnCheck, "3Associativity of =", .@x, 5);
+ callsub(OnCheck, "4Associativity of =", .@y, 5);
+ .@x = 5; .@y = 3;
+ .@z = 8;
+/*
+ * 0001b4 C_NAME setr
+ * 0001b8 C_ARG
+ * 0001b9 C_NAME .@x
+ * 0001bd C_REF
+ * 0001bd C_INT 16
+ * 0001bf C_MUL
+ * 0001c0 C_FUNC
+ * 0001c1 C_EOL
+ */
+ /* FIXME
+ .@x *= (.@y += 1);
+ //set(.@x, .@x * set(.@y, .@y + 1));
+ //.@x = (.@x * (.@y = .@y + 1));
+ */
+/*
+ * 0001c2 C_NAME setr
+ * 0001c6 C_ARG
+ * 0001c7 C_NAME .@x
+ * 0001cb C_REF
+ * 0001cc C_NAME setr
+ * 0001d0 C_ARG
+ * 0001d1 C_NAME .@y
+ * 0001d5 C_REF
+ * 0001d5 C_INT 1
+ * 0001d7 C_ADD
+ * 0001d8 C_FUNC
+ * 0001d9 C_MUL
+ * 0001da C_FUNC
+ * 0001db C_EOL
+ */
+/*
+ * 0001c2 C_NAME setr
+ * 0001c6 C_ARG
+ * 0001c7 C_NAME .@x
+ * 0001cb C_REF
+ * 0001cc C_NAME setr
+ * 0001d0 C_ARG
+ * 0001d1 C_NAME .@y
+ * 0001d4 C_INT 2
+ * 0001d6 C_FUNC
+ * 0001d7 C_MUL
+ * 0001d8 C_FUNC
+ * 0001d9 C_EOL
+ */
+ /*
+ callsub(OnCheck, "5Associativity of =", .@x, 20);
+ callsub(OnCheck, "6Associativity of =", .@y, 4);
+ */
+
+ .@x = 0;
+ if (0)
+ if (1)
+ .@x = 2;
+ else
+ .@x = 3;
+ callsub(OnCheck, "Dangling else", .@x, 0);
+
+ debugmes "Script engine self-test [ PASSED ]";
+}
+
+// vim: set ft=ath :