• 0
Sign in to follow this  
domez86

Incorrect use of "close" command

Question

hello, could you help me solve this problem?

[Warning]: Incorrect use of 'close' command!
[Debug]: Source (NPC): Charleston#charleston2 at verus04 (75,114)

thank you, I attach npc.

CharlestonCrisis.txt

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

In the some cases, the hercules uses close how end.

Paste a print of the error in the map-server to i see the line of the problem.

Share this post


Link to post
Share on other sites
  • 0

try close2;   🙂
and analyze if the close is being used when closing an expression

and more ..

you should not close a case, just close .. use the end; right after the close.

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, dev LOOLP said:

and more ..

you should not close a case, just close .. use the end; right after the close.

could you explain it better?

Share this post


Link to post
Share on other sites
  • 0

example :

switch(select("Option 1:Opotion 2")){
case 1:
mes "Your choice = Option 1, Pior Bio";
close2;
end;

case 2:
mes "Your choice = Option 2, Rafael";
close2;
end;
}

Just look at your code above and analyze what the close and end would look like;

Share this post


Link to post
Share on other sites
  • 0
On 8/14/2019 at 2:15 PM, dev LOOLP said:

example :

switch(select("Option 1:Opotion 2")){
case 1:
mes "Your choice = Option 1, Pior Bio";
close2;
end;

case 2:
mes "Your choice = Option 2, Rafael";
close2;
end;
}

Just look at your code above and analyze what the close and end would look like;

how can I understand which "close" should be replaced with "close2"? .....how can I understand which "close" should be replaced with "close2"? ..... the script is full of "close" .... and also "close2" ...

CharlestonCrisis.txt

Share this post


Link to post
Share on other sites
  • 0

This command will create a 'close' button in the message window for the invoking
character. If no window is currently on screen, it will be created. See 'close'.
There is one important difference, though - even though the message box will
have closed, the script execution will not stop, and commands after 'close2'
will still run, meaning an 'end' has to be used to stop the script, unless you
make it stop in some other manner.

 

Share this post


Link to post
Share on other sites
  • 0

Just as explanation...

When running a script that have text with mes command, as soon as you use "close;" the script not only send the close button to the screen, it will also stop the script from executing.

The error in first post I think it happens when you use "close" to end a script that haves no message box poped up in game.

 

I didn´t read all the script (is too long) but I detected a case at the first lines where this can happen so let me explain:

switch(select("There is hope, I'll take the challenge","No thanks"))
        {
            case 1:
                //RATHENA
                if ((checkquest(13184) == 0) || (checkquest(13184) == 1) || (checkquest(13184) == 2)) {
                //HERCULES
                //if ((questprogress(13184) == 1) || (questprogress(13184) == 2)) {
                    mes "[Charleston]";
                    mes "I will do my best to finish, even if the possibility is a million to one, it is unlikely, even without him.";
                    cutin "", 255;
                } else {
                    mes "[Charleston]";
                    mes "Hi ... human robot. I do not care that you are rational and efficient, but today is a certain day.";
                    next;
                    mes "[Charleston]";
                    mes "Ironically, I never expected anyone 'rational' to come to challenge this being, your efforts will be necessary to see a real change on the planet.";
                    next;
                    mes "[Charleston]";
                    mes "I would love to help you, even without any responsibility. However, I will place my trust in you, even if the possibility is minimal.";
                    next;
                    mes "[Charleston]";
                    mes "Even when my heart stops, I know that my trust is deposited with you.";
                    setquest 13184;
                    cutin "", 255;
                }
                close;
            case 2:
                //RATHENA
                if ((checkquest(13184) == 1) || (checkquest(13184) == 0) || (checkquest(13184) == 2)) {
                //HERCULES
                //if ((questprogress(13184) == 1) || (questprogress(13184) == 2)) {
                    close2;
                    erasequest 13184;
                }
                cutin "", 255;
                close;
        }

 

So what happens if you select "No thanks" and you come inside the if:

if ((checkquest(13184) == 1) || (checkquest(13184) == 0) || (checkquest(13184) == 2)) {

It will use a "close2" to close the window but keep executing further commands. Then erase a quest, ok it´s fine, and THEN!! it will remove a cutin and "CLOSE" again the window that doesn´t exist anymore.

And there you will have the error.

 

If there is no text box use end; instead of close; but in my opinion, you can get rid of that close2; as the close will do the job later. Maybe later in the script there are more situations as this one, but is too long to read!

Share this post


Link to post
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.

Loading...
Sign in to follow this