Jump to content

Обнуление переменной


Recommended Posts


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  34
  • Reputation:   0
  • Joined:  05/19/12
  • Last Seen:  

Еще раз здравствуйте все.

Вы наверное уже от меня устали :D

В общем например такой скрипт:

location,100,100,1 script Example::ex 90,{
if(.speak == 1) goto sorry;
set .speak,1;
set .name$,strcharinfo(0);
mes "[Example]";
mes "Part of this NPC is free, you can talk to him.";
next;
mes "[Example]";
mes "The first player is in conversation with the NPC.";
next;
mes "[Example]";
mes "The first player finishes a conversation with the NPC.";
set .speak,0;
close;

sorry:
mes "";
mes "Sorry. Currently, "+.name$+" is talking to the NPC..";
close;
}

Вроде бы все работает.

Но.

Если добавить меню.

location,100,100,1 script Example::ex 90,{
if(.speak == 1) goto sorry;
set .speak,1;
set .name$,strcharinfo(0);
mes "[Example]";
mes "Part of this NPC is free, you can talk to him.";
next;
mes "[Example]";
mes "The first player was invited to the menu.";
next;
switch(select("The first menu item:The second menu item:The third menu item") {
case 1:
mes "[Example]";
mes "The first player selected first menu item.";
set .speak,0;
close;
case 2:
mes "[Example]";
mes "The first player selected the second menu item.";
set .speak,0;
close;
case 3:
mes "[Example]";
mes "The first player has chosen the third element of the menu.";
set .speak,0;
close;
sorry:
mes "";
mes "Sorry. Currently, "+.name$+" is talking to the NPC..";
close;
}

Сам по себе образуется баг - когда НПС выдает меню и если не выбирать какой то элемент меню, а выйти из диалога, то переменная .спек не обнулится и никто не сможет больше с этим НПС поговорить. Может кто нибудь сможет придумать как обойти эту проблему?

Заранее Спасибо.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  407
  • Reputation:   159
  • Joined:  11/18/11
  • Last Seen:  

location,100,100,1 script Example::ex 90,{
if(.speak == 1) goto sorry;
set .speak,1;
set .name$,strcharinfo(0);
mes "[Example]";
mes "Part of this NPC is free, you can talk to him.";
next;
mes "[Example]";
mes "The first player was invited to the menu.";
next;
switch(select("The first menu item:The second menu item:The third menu item") {
case 1:
mes "[Example]";
mes "The first player selected first menu item.";
set .speak,0;
break;
case 2:
mes "[Example]";
mes "The first player selected the second menu item.";
set .speak,0;
break;
case 3:
mes "[Example]";
mes "The first player has chosen the third element of the menu.";
set .speak,0;
break;
}
close;
sorry:
mes "";
mes "Sorry. Currently, "+.name$+" is talking to the NPC..";
break;
}

Edited by Lilith
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  34
  • Reputation:   0
  • Joined:  05/19/12
  • Last Seen:  

Спасибо, но не помогло(

d0b9edca79373c4d9c3ff059aa5790cc.jpg

Нажимаешь отмена, и все. Крындец =(

При нажатии Отмена же нельзя по идее действия выбрать и обнулить переменную при выходе через кнопку отмена(

Edited by Sparrow
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  407
  • Reputation:   159
  • Joined:  11/18/11
  • Last Seen:  

location,100,100,1 script Example::ex 90,{
if(.speak == 1) goto sorry;
set .speak,1;
set .name$,strcharinfo(0);
mes "[Example]";
mes "Part of this NPC is free, you can talk to him.";
next;
mes "[Example]";
mes "The first player was invited to the menu.";
next;
switch(prompt("The first menu item:The second menu item:The third menu item")) {
case 1:
mes "[Example]";
mes "The first player selected first menu item.";
set .speak,0;
break;
case 2:
mes "[Example]";
mes "The first player selected the second menu item.";
set .speak,0;
break;
case 3:
mes "[Example]";
mes "The first player has chosen the third element of the menu.";
set .speak,0;
break;
default:
set .speak,0;
break;
}
close;
sorry:
mes "";
mes "Sorry. Currently, "+.name$+" is talking to the NPC..";
break;
}

Edited by Lilith
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...