I'm using an up-to-date rAthena version and I encountered an odd bug from the prompt script command. When a player clicks on "Cancel", it closes the window and ends the script immediatly.
So, it does effectively return the value "255" with this script (and set the @menu variable to 255 too) but it ends the script after doing that : (st->state = END;).
Here is my test script used if you'd like to try to reproduce this problem:
sec_in02,141,176,5 script TestPrompt#sec_in02 56,{
mes "[TestPrompt]";
mes "@menu = " + @menu;
mes "Hey.";
@result = prompt("#1", "#2", "#3");
mes "[TestPrompt]";
mes "Result : " + @result;
close;
}
sec_in02,143,176,5 script TestPrompt2#sec_in02 56,{
mes "[TestPrompt]";
mes "Hey.";
switch(prompt("#1", "#2", "#3")) {
case 1:
mes "#1";
break;
case 2:
mes "#2";
break;
case 3:
mes "#3";
break;
case 255:
mes "SELECT CATCHED";
break;
}
close;
}
So I changed the last line, from st->state = END; to st->state = RUN;
And it works quite fine. I then encountered another bug ; if you add a next to the first NPC after the line "@result = prompt [...]", it will throw a blank window with a next and, if you click on the next button, you'll just get a blank window that will stuck your character (ALT+F4 needed).
I would like to know whether my "fix" is fine or if I'm totally wrong. And in this case, it'll be great to tell me what to do in order to get a functionnal prompt command.
Thanks in advance!
Edit :
Okay, I used grep to check where prompt was used within the npc folder. Result ; nowhere, excepted custom scripts.
Anyway, I think my fix is kinda good, what do you think about it?
Question
Myskelz
Hello,
I'm using an up-to-date rAthena version and I encountered an odd bug from the prompt script command. When a player clicks on "Cancel", it closes the window and ends the script immediatly.
Here is my source code for prompt command:
/src/map/script.c (begin from line 4856)
So, it does effectively return the value "255" with this script (and set the @menu variable to 255 too) but it ends the script after doing that : (st->state = END;).
Here is my test script used if you'd like to try to reproduce this problem:
So I changed the last line, from st->state = END; to st->state = RUN;
src/map/script.c (begin from line 4856)
And it works quite fine. I then encountered another bug ; if you add a next to the first NPC after the line "@result = prompt [...]", it will throw a blank window with a next and, if you click on the next button, you'll just get a blank window that will stuck your character (ALT+F4 needed).
I would like to know whether my "fix" is fine or if I'm totally wrong. And in this case, it'll be great to tell me what to do in order to get a functionnal prompt command.
Thanks in advance!
Edit :
Link to comment
Share on other sites
6 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.