From e47172e47bb6ee7c6840174e22d14c94686a9c37 Mon Sep 17 00:00:00 2001 From: gumi Date: Sat, 27 May 2017 13:07:47 -0400 Subject: remove the pow buildin from existing scripts --- npc/custom/quests/thq/THQS_TTShop.txt | 4 ++-- npc/other/Global_Functions.txt | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'npc') diff --git a/npc/custom/quests/thq/THQS_TTShop.txt b/npc/custom/quests/thq/THQS_TTShop.txt index c85a9c9fe..96e7346d3 100644 --- a/npc/custom/quests/thq/THQS_TTShop.txt +++ b/npc/custom/quests/thq/THQS_TTShop.txt @@ -67,11 +67,11 @@ function script thqs_trade_token { // 10^0, 10^1, 10^2 @type -= 1; - @price = pow(10, @type); + @price = (10 ** @type); // 10^3, 10^4, 10^5 @type += 3; // So we can use pow later to determine the qt of Zeny - @prize = pow(10, @type); + @prize = (10 ** @type); if( #Treasure_Token < @price ) { mes "You don't have enough tokens!"; diff --git a/npc/other/Global_Functions.txt b/npc/other/Global_Functions.txt index 544e3a672..bc19ff048 100644 --- a/npc/other/Global_Functions.txt +++ b/npc/other/Global_Functions.txt @@ -203,11 +203,11 @@ function script F_SaveQuestSkills { ADV_QSK = 0; ADV_QSK2 = 0; //1st classes quest skills for (.@i = 0; .@i < 14; ++.@i) { - if(getskilllv(144+.@i)) ADV_QSK |= pow(2,.@i); + if(getskilllv(144+.@i)) ADV_QSK |= (2 ** .@i); } //2nd classes quest skills for (.@i = 0; .@i < 19; ++.@i) { - if(getskilllv(1001+.@i)) ADV_QSK2 |= pow(2,.@i); + if(getskilllv(1001+.@i)) ADV_QSK2 |= (2 ** .@i); } return; } @@ -217,7 +217,7 @@ function script F_SaveQuestSkills { function script F_Load1Skills { //1st classes quest skills for(.@i = 0; .@i < 14; ++.@i) { - if(ADV_QSK|pow(2,.@i) == ADV_QSK) skill 144+.@i,1,0; + if(ADV_QSK|(2 ** .@i) == ADV_QSK) skill 144+.@i,1,0; } ADV_QSK = 0; //Clear var return; @@ -228,7 +228,7 @@ function script F_Load1Skills { function script F_Load2Skills { //2nd classes quest skills for (.@i = 0; .@i < 19; ++.@i) { - if(ADV_QSK2|pow(2,.@i) == ADV_QSK2) skill 1001+.@i,1,0; + if(ADV_QSK2|(2 ** .@i) == ADV_QSK2) skill 1001+.@i,1,0; } ADV_QSK2 = 0; //Clear var return; -- cgit v1.2.3-70-g09d2 From 392c4b225dfc99401faeef882b10ce0b6d6a2209 Mon Sep 17 00:00:00 2001 From: Haru Date: Sat, 3 Jun 2017 17:03:26 +0200 Subject: Add tests for the exponentiation operator Signed-off-by: Haru --- npc/dev/test.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'npc') diff --git a/npc/dev/test.txt b/npc/dev/test.txt index b711a0a28..b35beb8ed 100644 --- a/npc/dev/test.txt +++ b/npc/dev/test.txt @@ -268,6 +268,19 @@ function script HerculesSelfTestHelper { callsub(OnCheck, "Order of + and *", .@x, 7); + // Binary ** operator + .@x = 2 ** 3; // .@x = 8; + callsub(OnCheck, "Binary ** operator", .@x, 8); + + // Associativity of ** + .@x = 2 ** 3 ** 2; // .@x = (2 ** 3) ** 2; + callsub(OnCheck, "Associativity of **", .@x, 64); + + // Order of ** and * + .@x = 5 * 2 ** 3 * 2; // .@x = 5 * (2 ** 3) * 2; + callsub(OnCheck, "Order of ** and *", .@x, 80); + + // << and >> operators .@x = 1<<3; // .@x = 1*2*2*2; callsub(OnCheck, "Left shift << operator", .@x, 8); -- cgit v1.2.3-70-g09d2