Nezdeshniy Опубликовано 29 июля, 2012 Жалоба Поделиться Опубликовано 29 июля, 2012 Прошу прощения в НПЦ отвечающим за гембл камней, что находится в Паене в самом начале происходит проверка на вес игрока, и тут у меня несколько вопросов возникают:payon,173,238,5 script Jade#pay 754,{ if (checkweight(1201,1) == 0) { mes "^3355FFWait a second! Right now, you're carrying too many items with you. Please come back after putting some of your things into Kafra Storage.^000000"; close; }Что означает данная строка (checkweight(1201,1) == 0) ? Точнее что за числа и откуда они там ? не могу понять... И второе если нпц в принципе удаляет два камня и дает 1 зачем вообще проверка ? Ссылка на комментарий Поделиться на другие сайты Поделиться
Sanasol Опубликовано 29 июля, 2012 Жалоба Поделиться Опубликовано 29 июля, 2012 checkweight( item id , amount )Проверяет хватит ли у человека свободного веса для какого-то предмета.1201 это кажется новисовский нож или бронь.Если удаляет 2 и дает 1, то не зачем. 1 Ссылка на комментарий Поделиться на другие сайты Поделиться
Nezdeshniy Опубликовано 29 июля, 2012 Автор Жалоба Поделиться Опубликовано 29 июля, 2012 (изменено) checkweight( item id , amount )Проверяет хватит ли у человека свободного веса для какого-то предмета.1201 это кажется новисовский нож или бронь.Если удаляет 2 и дает 1, то не зачем.Да айди я посмотрел просто в ступоре нафига вообще проверять вес ножиком ?? если он вообще не участвует, нпц же не дает просто лут а удаляет и потом только дает...странно как то...Но спасибо за внимание к проблеме... щас подумаю может если убрать баг найдется... Изменено 29 июля, 2012 пользователем Nezdeshniy Ссылка на комментарий Поделиться на другие сайты Поделиться
Nezdeshniy Опубликовано 29 июля, 2012 Автор Жалоба Поделиться Опубликовано 29 июля, 2012 (изменено) Проверяя скрипт Gemstone trader, я нашел ошибку, в скрипте указано, что игрок может сам выбирать количество создаваемых камней и МАКСИМАЛЬНО количество может быть не более 100:payon,173,238,5 script Jade#pay 754,{ if (checkweight(1201,1) == 0) { mes "^3355FFWait a second! Right now, you're carrying too many items with you. Please come back after putting some of your things into Kafra Storage.^000000"; close; } mes "[Jade]"; mes "Bring me two"; mes "Gemstones of the"; mes "same color, and I will"; mes "change them to Gemstones"; mes "of a different color."; next; switch(select("Blue Gemstones into Red ones!:Red Gemstones into Yellow ones!:Yellow Gemstones into Blue ones!")) { case 1: callsub S_TradeGems,717,716; case 2: callsub S_TradeGems,716,715; case 3: callsub S_TradeGems,715,717; }S_TradeGems: if (countitem(getarg(0)) < 2) { mes "[Jade]"; mes "Hah...!"; mes "You're kidding me, right?"; mes "I can't provide you with this"; mes "service if you don't"; mes "give me at least"; mes "2 "+getitemname(getarg(0))+"s!"; close; } else { set .@gems,countitem(getarg(0))/2; mes "[Jade]"; mes "I believe I can create"; mes "a total of " + .@gems + " " + getitemname(getarg(1)) + "s"; mes "using the "+getitemname(getarg(0))+"s"; mes "that you currently have."; mes "What do you want to do?"; next; switch(select("Give me as many as you can.:I want to set the amount.:I quit.")) { case 1: delitem getarg(0),.@gems * 2; getitem getarg(1),.@gems; mes "[Jade]"; mes "There you go."; mes "Feel free to come"; mes "back any time."; mes "Hm, what's that look for?"; mes "Is there something on my face?"; close; case 2: mes "[Jade]"; mes "So how many"; mes "do you want?"; mes "The maximum number"; mes "that you can enter is 100."; next; while(1) { input .@input,0,101; if (.@input == 0) { mes "[Jade]"; mes "None at all?"; mes "I guess you"; mes "changed your mind..."; close; } else if (.@input > 100) { mes "[Jade]"; mes "Errm..."; mes "I asked you to enter"; mes "an amount no greater"; mes "than 100, remember...?"; next; } else { break; } } if (.@gems > .@input) { delitem getarg(0),.@input * 2; getitem getarg(1),.@input; mes "[Jade]"; mes "There you go."; mes "Feel free to come"; mes "back any time."; mes "Hm, what's that look for?"; mes "Is there something on my face?"; } close; case 3: mes "[Jade]"; mes "Sure, no problem."; mes "Come back any time."; close; } }}Как мы видим в скрипте реализовано это следующим образом:if (.@gems > .@input) { delitem getarg(0),.@input * 2; getitem getarg(1),.@input; mes "[Jade]"; mes "There you go."; mes "Feel free to come"; mes "back any time."; mes "Hm, what's that look for?"; mes "Is there something on my face?"; } close;Ошибка заключается в том что при вводе 100 нпц ничего не делает, исправляем выше приведенную часть на:if (.@gems >= .@input) { delitem getarg(0),.@input * 2; getitem getarg(1),.@input; mes "[Jade]"; mes "There you go."; mes "Feel free to come"; mes "back any time."; mes "Hm, what's that look for?"; mes "Is there something on my face?"; } close;На всякий случай все же спрошу знатоков - не приведет ли такое изменение к ошибке в ходе работы скрипта?P.S. - начал дальше проверять, вообще скрипт кривой, итак максимальное количество мы исправили и теперь он создает 100 нормально, но вот допустим я уберу требуемое количество лута так что не хватает на 100, а на 99 только и он уже не пишет ничего если напишу 100. Проще говоря смотрите что добавил:payon,173,238,5 script Jade#pay 754,{ if (checkweight(1201,1) == 0) { mes "^3355FFWait a second! Right now, you're carrying too many items with you. Please come back after putting some of your things into Kafra Storage.^000000"; close; } mes "[Jade]"; mes "Bring me two"; mes "Gemstones of the"; mes "same color, and I will"; mes "change them to Gemstones"; mes "of a different color."; next; switch(select("Blue Gemstones into Red ones!:Red Gemstones into Yellow ones!:Yellow Gemstones into Blue ones!")) { case 1: callsub S_TradeGems,717,716; case 2: callsub S_TradeGems,716,715; case 3: callsub S_TradeGems,715,717; }S_TradeGems: if (countitem(getarg(0)) < 2) { mes "[Jade]"; mes "Hah...!"; mes "You're kidding me, right?"; mes "I can't provide you with this"; mes "service if you don't"; mes "give me at least"; mes "2 "+getitemname(getarg(0))+"s!"; close; } else { set .@gems,countitem(getarg(0))/2; set .@gems1,countitem(getarg(0)); mes "[Jade]"; mes "I believe I can create"; mes "a total of " + .@gems + " " + getitemname(getarg(1)) + "s"; mes "using the "+getitemname(getarg(0))+"s"; mes "that you currently have."; mes "What do you want to do?"; next; switch(select("Give me as many as you can.:I want to set the amount.:I quit.")) { case 1: delitem getarg(0),.@gems * 2; getitem getarg(1),.@gems; mes "[Jade]"; mes "There you go."; mes "Feel free to come"; mes "back any time."; mes "Hm, what's that look for?"; mes "Is there something on my face?"; close; case 2: mes "[Jade]"; mes "So how many"; mes "do you want?"; mes "The maximum number"; mes "that you can enter is 100."; next; while(1) { input .@input,0,101; if (.@input == 0) { mes "[Jade]"; mes "None at all?"; mes "I guess you"; mes "changed your mind..."; close; } else if (.@input > 100) { mes "[Jade]"; mes "Errm..."; mes "I asked you to enter"; mes "an amount no greater"; mes "than 100, remember...?"; next; } else if ((.@input * 2 ) > .@gems1) { mes "[Jade]"; mes "You don't have soo many gem's..."; next; } else { break; } } if (.@gems >= .@input) { delitem getarg(0),.@input * 2; getitem getarg(1),.@input; mes "[Jade]"; mes "There you go."; mes "Feel free to come"; mes "back any time."; mes "Hm, what's that look for?"; mes "Is there something on my face?"; } close; case 3: mes "[Jade]"; mes "Sure, no problem."; mes "Come back any time."; close; } }} Изменено 29 июля, 2012 пользователем Nezdeshniy Ссылка на комментарий Поделиться на другие сайты Поделиться
Sanasol Опубликовано 29 июля, 2012 Жалоба Поделиться Опубликовано 29 июля, 2012 все правильно> 100 - не включая 100>= 100 - включительно Ссылка на комментарий Поделиться на другие сайты Поделиться
Nezdeshniy Опубликовано 29 июля, 2012 Автор Жалоба Поделиться Опубликовано 29 июля, 2012 (изменено) Темку закрыть можно, отправил в баг трекер.//===== rAthena Script =======================================//= Gemstone trader//===== By: ==================================================//= L0ne_W0lf//===== Current Version: =====================================//= 1.2//===== Compatible With: =====================================//= rAthena SVN//===== Description: =========================================//= [Aegis Conversion]//= Trade various colors of gemstones for other color gemstones.//===== Additional Comments: =================================//= 1.0 Rescripted to Aegis 10.3 standards. [L0ne_W0lf]//= Any notes pertaining to the prior trader may be found//= in the cities/payon.txt//= 1.1 Corrected NPC names to fall within proper restrictions. [L0ne_W0lf]//= 1.2 Updated input with min/max values. [L0ne_W0lf]//= Added a checkweight.//= 1.3 Updated two little errors. [Nezdeshniy]//= Corrected input for 100 items and add check for number in input label.//============================================================payon,173,238,5 script Jade#pay 754,{if (checkweight(1201,1) == 0) { mes "^3355FFWait a second! Right now, you're carrying too many items with you. Please come back after putting some of your things into Kafra Storage.^000000"; close;}mes "[Jade]";mes "Bring me two";mes "Gemstones of the";mes "same color, and I will";mes "change them to Gemstones";mes "of a different color.";next;switch(select("Blue Gemstones into Red ones!:Red Gemstones into Yellow ones!:Yellow Gemstones into Blue ones!")) {case 1: callsub S_TradeGems,717,716;case 2: callsub S_TradeGems,716,715;case 3: callsub S_TradeGems,715,717;}S_TradeGems:if (countitem(getarg(0)) < 2) { mes "[Jade]"; mes "Hah...!"; mes "You're kidding me, right?"; mes "I can't provide you with this"; mes "service if you don't"; mes "give me at least"; mes "2 "+getitemname(getarg(0))+"s!"; close;}else { set .@gems,countitem(getarg(0))/2; set .@gems_check,countitem(getarg(0)); mes "[Jade]"; mes "I believe I can create"; mes "a total of " + .@gems + " " + getitemname(getarg(1)) + "s"; mes "using the "+getitemname(getarg(0))+"s"; mes "that you currently have."; mes "What do you want to do?"; next; switch(select("Give me as many as you can.:I want to set the amount.:I quit.")) { case 1: delitem getarg(0),.@gems * 2; getitem getarg(1),.@gems; mes "[Jade]"; mes "There you go."; mes "Feel free to come"; mes "back any time."; mes "Hm, what's that look for?"; mes "Is there something on my face?"; close; case 2: mes "[Jade]"; mes "So how many"; mes "do you want?"; mes "The maximum number"; mes "that you can enter is 100."; next; while(1) { input .@input,0,101; if (.@input == 0) { mes "[Jade]"; mes "None at all?"; mes "I guess you"; mes "changed your mind..."; close; } else if (.@input > 100) { mes "[Jade]"; mes "Errm..."; mes "I asked you to enter"; mes "an amount no greater"; mes "than 100, remember...?"; next; } else if ((.@input * 2 ) > .@gems_check) { mes "[Jade]"; mes "Sorry, the amount of your Gemstones is less than needed..."; next; } else { break; } } if (.@gems >= .@input) { delitem getarg(0),.@input * 2; getitem getarg(1),.@input; mes "[Jade]"; mes "There you go."; mes "Feel free to come"; mes "back any time."; mes "Hm, what's that look for?"; mes "Is there something on my face?"; } close; case 3: mes "[Jade]"; mes "Sure, no problem."; mes "Come back any time."; close; }}} Изменено 29 июля, 2012 пользователем Nezdeshniy Ссылка на комментарий Поделиться на другие сайты Поделиться
nomn Опубликовано 30 июля, 2012 Жалоба Поделиться Опубликовано 30 июля, 2012 все правильно > 100 - не включая 100 >= 100 - включительно не люблю использовать >= всегда, когда есть возможность использую просто > или < например >=100 это то же самое, что > 99 Хотя возможно кому-то это не "наглядно" показывает что "числа от 100", но я привык... и экономлю 2 символа))) Ну чаще 1 Ссылка на комментарий Поделиться на другие сайты Поделиться
Рекомендуемые сообщения