Jump to content
  • 0

Resetting the variable


Sparrow

Question


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

Once again, good morning all.

You probably already tired of me: D

In general, for example, the following script:

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;
}

It seems to be working.

But.

If you add a menu.

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;
}

By itself, formed a bug - when the NES menu displays, and if you do not select any menu item, and exit the dialog, then the variable. Spectrum is not zero and no longer be able to talk with the NPC. Maybe someone can come up with a workaround?

Thanks in advance.

Link to comment
Share on other sites

7 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  137
  • Reputation:   23
  • Joined:  06/08/12
  • Last Seen:  

Just a Tip:

Add a npctimer that automatically resets the variable after an set amount of time, for example 120 seconds just in case someone talks to the npc and disconnects before he end the conversation. Otherwise, if someone does this the npc will be unuseable till next maintenance!

Edith says:

That awkward moment when you realize that your Tip is the Solution xD

Edited by GM Zimtkeks
  • Upvote 1
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:  

Thank you) will be very brazen, if I ask you to jot down an idea with a timer?) I do not know how to work with timers = (

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

well you can try do it in a way like this

http://upaste.me/bbf5496ff8bc726

use prompt...and close2 ( my prefer way )

prompt() able to detect if the users click on "Cancel" button.

close2 still able to run a script even though message of npc is closed.

i use .Variable$ to store users name

i use OnPCLogoutEvent to remove the Variable if the variable saved is user's name

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  137
  • Reputation:   23
  • Joined:  06/08/12
  • Last Seen:  

Thank you) will be very brazen, if I ask you to jot down an idea with a timer?) I do not know how to work with timers = (

Im a super Noob @ scripting.

But if I would look for something like that, I would check the Seal 3 Quest cause I know a similar system you are looking for is used there.

  • Upvote 1
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:  

Emisty, If I show you a script that you want to integrate your system, you will be able to do this? I can not, I still can not figure out what to enter.

I have been there in the first place anywhere "menu", and secondly, I get confused with these numerous curly braces = (

The script in which you want to integrate your system: http://upaste.me/5e9f497536695e6

If you can help, I'll be very grateful. If not - anyway, you already helped me)

Edited by Sparrow
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

explain how your script work and what it does...

i cant understand what your script doing without a translated version ..

but i prefer you tell me what it does..xD

  • Upvote 1
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:  

In general, this is the last part of the quest chain, which I did. But my quest is not quite normal. For example: Should icy mage. Need to do something to unfreeze it. You do something for the quest and it defrosts. For some time, let's say. And if at least two people at the same time the quest will pass, there will be bugs. Therefore it is necessary to block access to the NPC until the first player talking to NPCs.

Now I'll translate the script that you have understood him. Be warned - Google Translate :D

http://upaste.me/3eaa499b973a91d

Will you help me?

Topic can be closed. I learned all of this function. Emisty, thanks for the stuff =)

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
Answer this question...

×   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...