From 804fbac07e5fdba9a7c49c3bc510f31acb4aa2f9 Mon Sep 17 00:00:00 2001 From: thatakkarin Date: Tue, 6 Nov 2012 20:04:12 +0000 Subject: * Partial Fix for bugreport:6800 - Point 3 (soundeffect) and point 4 (sprintf). * Renamed a few files in doc/sample/ for standardization. * Indent cleanup in script_commands.txt git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16864 54d463be-8e91-2dee-dedb-b68131a5f0ec --- doc/sample/npc_pcre.txt | 402 ----------------------------------------- doc/sample/npc_test_pcre.txt | 402 +++++++++++++++++++++++++++++++++++++++++ doc/sample/npc_test_time.txt | 25 +++ doc/sample/npc_time_sample.txt | 25 --- doc/script_commands.txt | 136 +++++++------- 5 files changed, 493 insertions(+), 497 deletions(-) delete mode 100644 doc/sample/npc_pcre.txt create mode 100644 doc/sample/npc_test_pcre.txt create mode 100644 doc/sample/npc_test_time.txt delete mode 100644 doc/sample/npc_time_sample.txt diff --git a/doc/sample/npc_pcre.txt b/doc/sample/npc_pcre.txt deleted file mode 100644 index adc96f585..000000000 --- a/doc/sample/npc_pcre.txt +++ /dev/null @@ -1,402 +0,0 @@ -//===== rAthena Script ======================================= -//= Sample: PCRE -//===== By: ================================================== -//= rAthena Dev Team -//===== Current Version: ===================================== -//= 20100108 -//===== Description: ========================================= -//= Demonstrates PCRE commands. -//============================================================ - -prontera,152,181,5 script MouseJstr 763,{ - -// hello -Lquote0: - npctalk "How do you do. Please state your problem."; - end; - -// computer -Lquote1: - switch(rand(4)) { - case 0: npctalk "Do computers worry you?"; break; - case 1: npctalk "What do you think about machines?"; break; - case 2: npctalk "Why do you mention computers?"; break; - case 3: npctalk "What do you think machines have to do with your problem?"; break; - } - end; - -// name -Lquote2: - npctalk "I am not interested in names"; - end; - -// sorry -Lquote3: - switch(rand(3)) { - case 0: npctalk "Please don't apologize"; break; - case 1: npctalk "Apologies are not necessary"; break; - case 2: npctalk "What feelings do you have when you apologize"; break; - } - end; - -// I remember $@p2$ -Lquote4: - switch(rand(6)) { - case 0: npctalk "Do you often think of "+$@p2$+"?"; break; - case 1: npctalk "Does thinking of "+$@p2$+" bring anything else to mind?"; break; - case 2: npctalk "What else do you remember?"; break; - case 3: npctalk "Why do you recall "+$@p2$+" right now?"; break; - case 4: npctalk "What in the present situation reminds you of "+$@p2$+"?"; break; - case 5: npctalk "What is the connection between me and "+$@p2$+"?"; break; - } - end; - -// do you remember -Lquote5: - switch (rand(4)) { - case 0: npctalk "Did you think I would forget "+$@p2$+" ?"; break; - case 1: npctalk "Why do you think I should recall "+$@p2$+" now"; break; - case 2: npctalk "What about "+$@p2$+""; break; - case 3: npctalk "You mentioned "+$@p2$+""; break; - } - end; - -// if -Lquote6: - switch(rand(4)) { - case 0: npctalk "Do you really think its likely that "+$@p2$+""; break; - case 1: npctalk "Do you wish that "+$@p2$+"?"; break; - case 2: npctalk "What do you think about "+$@p2$+"?"; break; - case 3: npctalk "Really-- if "+$@p2$+"?"; break; - } - end; - -// i dreamt -Lquote7: - switch(rand(3)) { - case 0: npctalk "Really-- "+$@p2$+""; break; - case 1: npctalk "Have you ever fantasized "+$@p2$+" while you were awake?"; break; - case 2: npctalk "Have you dreamt "+$@p2$+" before?"; break; - } - end; - -// dream about -Lquote8: - npctalk "How do you feel about "+$@p2$+" in reality?"; - end; - -// dream -Lquote9: - switch(rand(4)) { - case 0: npctalk "What does this dream suggest to you?"; break; - case 1: npctalk "Do you dream often?"; break; - case 2: npctalk "What persons appear in your dreams?"; break; - case 3: npctalk "Don't you believe that dream has to do with your problem?"; break; - } - end; - -// my mother -Lquote10: - switch(rand(2)) { - case 0: npctalk "Who else in your family "+$@p2$+""; break; - case 1: npctalk "Tell me more about your family"; break; - } - end; - -// my father -Lquote11: - switch(rand(3)) { - case 0: npctalk "Your father"; break; - case 1: npctalk "Does he influence you strongly?"; break; - case 2: npctalk "What else comes to mind when you think of your father?"; break; - } - end; - -// I want -Lquote12: - switch(rand(3)) { - case 0: npctalk "What would it mean if you got "+$@p2$+""; break; - case 1: npctalk "Why do you want "+$@p2$+""; break; - case 2: npctalk "Suppose you got "+$@p2$+" soon"; break; - } - end; - -// I am glad -Lquote13: - switch(rand(3)) { - case 0: npctalk "How have I helped you to be "+$@p2$+""; break; - case 1: npctalk "What makes you happy just now"; break; - case 2: npctalk "Can you explain why you are suddenly "+$@p2$+""; break; - } - end; - -// I am sad -Lquote14: - switch(rand(2)) { - case 0: npctalk "I am sorry to hear you are depressed"; break; - case 1: npctalk "I'm sure its not pleasant to be sad"; break; - } - end; - -// $@p2 are like "+$@p3$+" -Lquote15: - npctalk "What resemblance do you see between "+$@p2$+" and "+$@p3$+""; - end; - -// "+$@p2$+" is like "+$@p3$+" -Lquote16: - switch(rand(4)) { - case 0: npctalk "In what way is it that "+$@p2$+" is like "+$@p3$+""; break; - case 1: npctalk "What resemblance do you see?"; break; - case 2: npctalk "Could there really be some connection?"; break; - case 3: npctalk "How?"; break; - } - end; - -// alike -Lquote17: - switch(rand(2)) { - case 0: npctalk "In what way?"; break; - case 1: npctalk "What similarities are there?"; break; - } - end; - -// same -Lquote18: - npctalk "What other connections do you see?"; - end; - -// I was "+$@p2$+" -Lquote19: - switch(rand(3)) { - case 0: npctalk "Were you really?"; break; - case 1: npctalk "Perhaps I already knew you were "+$@p2$+""; break; - case 2: npctalk "Why do you tell me you were "+$@p2$+" now?"; break; - } - end; - -// was I -Lquote20: - switch(rand(3)) { - case 0: npctalk "What if you were "+$@p2$+" ?"; break; - case 1: npctalk "Do you thin you were "+$@p2$+""; break; - case 2: npctalk "What would it mean if you were "+$@p2$+""; break; - } - end; - -// I am -Lquote21: - switch(rand(2)) { - case 0: npctalk "In what way are you "+$@p2$+""; break; - case 1: npctalk "Do you want to be "+$@p2$+" ?"; break; - } - end; - -// am I -Lquote22: - switch(rand(4)) { - case 0: npctalk "Do you believe you are "+$@p2$+""; break; - case 1: npctalk "Would you want to be "+$@p2$+""; break; - case 2: npctalk "You wish I would tell you you are "+$@p2$+""; break; - case 3: npctalk "What would it mean if you were "+$@p2$+""; break; - } - end; - -// am -Lquote23: - switch(rand(2)) { - case 0: npctalk "Why do you say AM?"; break; - case 1: npctalk "I don't understand that"; break; - } - end; - -// are you -Lquote24: - switch(rand(3)) { - case 0: npctalk "Why are you interested in whether I am "+$@p2$+" or not?"; break; - case 1: npctalk "Would you prefer if I weren't "+$@p2$+""; break; - case 2: npctalk "Perhaps I am "+$@p2$+" in your fantasies"; break; - } - end; - -// you are -Lquote25: - npctalk "What makes you think I am "+$@p2$+" ?"; - end; - -// because -Lquote26: - switch(rand(3)) { - case 0: npctalk "Is that the real reason?"; break; - case 1: npctalk "What other reasons might there be?"; break; - case 2: npctalk "Does that reason seem to explain anything else?"; break; - } - end; - -// were you -Lquote27: - switch(rand(3)) { - case 0: npctalk "Perhaps I was "+$@p2$+""; break; - case 1: npctalk "What do you think?"; break; - case 2: npctalk "What if I had been "+$@p2$+""; break; - } - end; - -// I can't -Lquote28: - switch(rand(2)) { - case 0: npctalk "Maybe you could "+$@p3$+" now"; break; - case 1: npctalk "What if you could "+$@p3$+" ?"; break; - } - end; - -// I feel -Lquote29: - npctalk "Do you often feel "+$@p2$+" ?"; - end; - -// I felt -Lquote30: - npctalk "What other feelings do you have?"; - end; - -// $@p1$ I $@p2$ you $@p3$ -Lquote31: - npctalk "Perhaps in your fantasy we "+$@p3$+" each other?"; - end; - -// why don't you -Lquote32: - switch(rand(3)) { - case 0: npctalk "Should you "+$@p3$+" yourself?"; break; - case 1: npctalk "Do you believe I don't "+$@p3$+""; break; - case 2: npctalk "Perhaps I will "+$@p3$+" in good time"; break; - } - end; - -// yes -Lquote33: - switch(rand(3)) { - case 0: npctalk "You seem quite positive"; break; - case 1: npctalk "You are sure?"; break; - case 2: npctalk "I understand"; break; - } - end; - -// no -Lquote34: - switch(rand(3)) { - case 0: npctalk "Why not?"; break; - case 1: npctalk "You are being a bit negative"; break; - case 2: npctalk "Are you saying NO just to be negative?"; break; - } - end; - -// someone -Lquote35: - npctalk "Can you be more specific?"; - end; - -// everyone -Lquote36: - switch(rand(4)) { - case 0: npctalk "surely not everyone"; break; - case 1: npctalk "Can you think of anyone in particular?"; break; - case 2: npctalk "Who for example?"; break; - case 3: npctalk "You are thinking of a special person?"; break; - } - end; - -// always -Lquote37: - switch(rand(4)) { - case 0: npctalk "Can you think of a specific example?"; break; - case 1: npctalk "When?"; break; - case 2: npctalk "What incident are you thinking of?"; break; - case 3: npctalk "Really-- always?"; break; - } - end; - -// what -Lquote38: - switch(rand(5)) { - case 0: npctalk "Why do you ask?"; break; - case 1: npctalk "Does that question interest you?"; break; - case 2: npctalk "What is it you really want to know?"; break; - case 3: npctalk "What do you think?"; break; - case 4: npctalk "What comes to your mind when you ask that?"; break; - } - end; - -// perhaps -Lquote39: - npctalk "You do not seem quite certain"; - end; - -// are -Lquote40: - switch(rand(2)) { - case 0: npctalk "Did you think they might not be "+$@p2$+""; break; - case 1: npctalk "Possibly they are "+$@p2$; break; - } - end; - -// default -Lquote41: - switch(rand(6)) { - case 0: npctalk "Very interesting"; break; - case 1: npctalk "I am not sure I understand you fully"; break; - case 2: npctalk "What does that suggest to you?"; break; - case 3: npctalk "Please continue"; break; - case 4: npctalk "Go on"; break; - case 5: npctalk "Do you feel strongly about discussing such things?"; break; - } - end; - -OnInit: - defpattern 1, "([^:]+):.*\\shello.*", "Lquote0"; - defpattern 1, "([^:]+):.*\\scomputer.*", "Lquote1"; - defpattern 1, "([^:]+):.*\\sname.*", "Lquote2"; - defpattern 1, "([^:]+):.*\\ssorry.*", "Lquote3"; - defpattern 1, "([^:]+):.*\\si\\s+remember\\s+(.*)", "Lquote4"; - defpattern 1, "([^:]+):.*\\sdo\\s+you\\s+remember\\s+(.*)", "Lquote5"; - defpattern 1, "([^:]+):.*\\sif\\s+(.*)", "Lquote6"; - defpattern 1, "([^:]+):.*\\si\\s+dreamt\\s+(.*)", "Lquote7"; - defpattern 1, "([^:]+):.*\\sdream\\s+about\\s+(.*)", "Lquote8"; - defpattern 1, "([^:]+):.*\\sdream\\s+(.*)", "Lquote9"; - defpattern 1, "([^:]+):.*\\smy\\s+mother\\s+(.*)", "Lquote10"; - defpattern 1, "([^:]+):.*\\smy\\s+father\\s+(.*)", "Lquote11"; - defpattern 1, "([^:]+):.*\\si\\s+want\\s+(.*)", "Lquote12"; - defpattern 1, "([^:]+):.*\\si\\s+am\\s+glad\\s+(.*)", "Lquote13"; - defpattern 1, "([^:]+):\\s+(.*)\\s+i\\s+am\\s+sad\\s+(.*)", "Lquote14"; - defpattern 1, "([^:]+):\\s+(.*)\\s+are\\s+like\\s+(.*)", "Lquote15"; - defpattern 1, "([^:]+):\\s+(.*)\\s+is\\s+like\\s+(.*)", "Lquote16"; - defpattern 1, "([^:]+):.*\\salike\\s+(.*)", "Lquote17"; - defpattern 1, "([^:]+):.*\\ssame\\s+(.*)", "Lquote18"; - defpattern 1, "([^:]+):.*\\si\\s+was\\s+(.*)", "Lquote19"; - defpattern 1, "([^:]+):.*\\swas\\s+i\\s+(.*)", "Lquote20"; - defpattern 1, "([^:]+):.*\\si\\s+am\\s+(.*)", "Lquote21"; - defpattern 1, "([^:]+):.*\\sam\\s+i\\s+(.*)", "Lquote22"; - defpattern 1, "([^:]+):.*\\sam\\s+(.*)", "Lquote23"; - defpattern 1, "([^:]+):.*\\sare\\s+you\\s+(.*)", "Lquote24"; - defpattern 1, "([^:]+):.*\\syou\\s+are\\s+(.*)", "Lquote25"; - defpattern 1, "([^:]+):.*\\sbecause\\s+(.*)", "Lquote26"; - defpattern 1, "([^:]+):.*\\swere\\s+you\\s+(.*)", "Lquote27"; - defpattern 1, "([^:]+):.*\\si\\s+(cant|can't|cannot)\\s+(.*)", "Lquote28"; - defpattern 1, "([^:]+):.*\\si\\s+feel\\s+(.*)", "Lquote29"; - defpattern 1, "([^:]+):.*\\si\\s+felt\\s+(.*)", "Lquote30"; - defpattern 1, "([^:]+):.*\\si\\s+(.*)\\s+you\\s+(.*)", "Lquote31"; - defpattern 1, "([^:]+):.*\\swhy\\s+(don't|dont)\\s+you\\s+(.*)", "Lquote32"; - defpattern 1, "([^:]+):.*\\syes\\s+(.*)", "Lquote33"; - defpattern 1, "([^:]+):.*\\sno\\s+(.*)", "Lquote34"; - defpattern 1, "([^:]+):.*\\ssomeone\\s+(.*)", "Lquote35"; - defpattern 1, "([^:]+):.*\\severyone\\s+(.*)", "Lquote36"; - defpattern 1, "([^:]+):.*\\salways\\s+(.*)", "Lquote37"; - defpattern 1, "([^:]+):.*\\swhat\\s+(.*)", "Lquote38"; - defpattern 1, "([^:]+):.*\\sperhaps\\s+(.*)", "Lquote39"; - defpattern 1, "([^:]+):.*\\sare\\s+(.*)", "Lquote40"; - defpattern 1, "([^:]+):(.*)", "Lquote41"; - - activatepset 1; - end; -} diff --git a/doc/sample/npc_test_pcre.txt b/doc/sample/npc_test_pcre.txt new file mode 100644 index 000000000..adc96f585 --- /dev/null +++ b/doc/sample/npc_test_pcre.txt @@ -0,0 +1,402 @@ +//===== rAthena Script ======================================= +//= Sample: PCRE +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20100108 +//===== Description: ========================================= +//= Demonstrates PCRE commands. +//============================================================ + +prontera,152,181,5 script MouseJstr 763,{ + +// hello +Lquote0: + npctalk "How do you do. Please state your problem."; + end; + +// computer +Lquote1: + switch(rand(4)) { + case 0: npctalk "Do computers worry you?"; break; + case 1: npctalk "What do you think about machines?"; break; + case 2: npctalk "Why do you mention computers?"; break; + case 3: npctalk "What do you think machines have to do with your problem?"; break; + } + end; + +// name +Lquote2: + npctalk "I am not interested in names"; + end; + +// sorry +Lquote3: + switch(rand(3)) { + case 0: npctalk "Please don't apologize"; break; + case 1: npctalk "Apologies are not necessary"; break; + case 2: npctalk "What feelings do you have when you apologize"; break; + } + end; + +// I remember $@p2$ +Lquote4: + switch(rand(6)) { + case 0: npctalk "Do you often think of "+$@p2$+"?"; break; + case 1: npctalk "Does thinking of "+$@p2$+" bring anything else to mind?"; break; + case 2: npctalk "What else do you remember?"; break; + case 3: npctalk "Why do you recall "+$@p2$+" right now?"; break; + case 4: npctalk "What in the present situation reminds you of "+$@p2$+"?"; break; + case 5: npctalk "What is the connection between me and "+$@p2$+"?"; break; + } + end; + +// do you remember +Lquote5: + switch (rand(4)) { + case 0: npctalk "Did you think I would forget "+$@p2$+" ?"; break; + case 1: npctalk "Why do you think I should recall "+$@p2$+" now"; break; + case 2: npctalk "What about "+$@p2$+""; break; + case 3: npctalk "You mentioned "+$@p2$+""; break; + } + end; + +// if +Lquote6: + switch(rand(4)) { + case 0: npctalk "Do you really think its likely that "+$@p2$+""; break; + case 1: npctalk "Do you wish that "+$@p2$+"?"; break; + case 2: npctalk "What do you think about "+$@p2$+"?"; break; + case 3: npctalk "Really-- if "+$@p2$+"?"; break; + } + end; + +// i dreamt +Lquote7: + switch(rand(3)) { + case 0: npctalk "Really-- "+$@p2$+""; break; + case 1: npctalk "Have you ever fantasized "+$@p2$+" while you were awake?"; break; + case 2: npctalk "Have you dreamt "+$@p2$+" before?"; break; + } + end; + +// dream about +Lquote8: + npctalk "How do you feel about "+$@p2$+" in reality?"; + end; + +// dream +Lquote9: + switch(rand(4)) { + case 0: npctalk "What does this dream suggest to you?"; break; + case 1: npctalk "Do you dream often?"; break; + case 2: npctalk "What persons appear in your dreams?"; break; + case 3: npctalk "Don't you believe that dream has to do with your problem?"; break; + } + end; + +// my mother +Lquote10: + switch(rand(2)) { + case 0: npctalk "Who else in your family "+$@p2$+""; break; + case 1: npctalk "Tell me more about your family"; break; + } + end; + +// my father +Lquote11: + switch(rand(3)) { + case 0: npctalk "Your father"; break; + case 1: npctalk "Does he influence you strongly?"; break; + case 2: npctalk "What else comes to mind when you think of your father?"; break; + } + end; + +// I want +Lquote12: + switch(rand(3)) { + case 0: npctalk "What would it mean if you got "+$@p2$+""; break; + case 1: npctalk "Why do you want "+$@p2$+""; break; + case 2: npctalk "Suppose you got "+$@p2$+" soon"; break; + } + end; + +// I am glad +Lquote13: + switch(rand(3)) { + case 0: npctalk "How have I helped you to be "+$@p2$+""; break; + case 1: npctalk "What makes you happy just now"; break; + case 2: npctalk "Can you explain why you are suddenly "+$@p2$+""; break; + } + end; + +// I am sad +Lquote14: + switch(rand(2)) { + case 0: npctalk "I am sorry to hear you are depressed"; break; + case 1: npctalk "I'm sure its not pleasant to be sad"; break; + } + end; + +// $@p2 are like "+$@p3$+" +Lquote15: + npctalk "What resemblance do you see between "+$@p2$+" and "+$@p3$+""; + end; + +// "+$@p2$+" is like "+$@p3$+" +Lquote16: + switch(rand(4)) { + case 0: npctalk "In what way is it that "+$@p2$+" is like "+$@p3$+""; break; + case 1: npctalk "What resemblance do you see?"; break; + case 2: npctalk "Could there really be some connection?"; break; + case 3: npctalk "How?"; break; + } + end; + +// alike +Lquote17: + switch(rand(2)) { + case 0: npctalk "In what way?"; break; + case 1: npctalk "What similarities are there?"; break; + } + end; + +// same +Lquote18: + npctalk "What other connections do you see?"; + end; + +// I was "+$@p2$+" +Lquote19: + switch(rand(3)) { + case 0: npctalk "Were you really?"; break; + case 1: npctalk "Perhaps I already knew you were "+$@p2$+""; break; + case 2: npctalk "Why do you tell me you were "+$@p2$+" now?"; break; + } + end; + +// was I +Lquote20: + switch(rand(3)) { + case 0: npctalk "What if you were "+$@p2$+" ?"; break; + case 1: npctalk "Do you thin you were "+$@p2$+""; break; + case 2: npctalk "What would it mean if you were "+$@p2$+""; break; + } + end; + +// I am +Lquote21: + switch(rand(2)) { + case 0: npctalk "In what way are you "+$@p2$+""; break; + case 1: npctalk "Do you want to be "+$@p2$+" ?"; break; + } + end; + +// am I +Lquote22: + switch(rand(4)) { + case 0: npctalk "Do you believe you are "+$@p2$+""; break; + case 1: npctalk "Would you want to be "+$@p2$+""; break; + case 2: npctalk "You wish I would tell you you are "+$@p2$+""; break; + case 3: npctalk "What would it mean if you were "+$@p2$+""; break; + } + end; + +// am +Lquote23: + switch(rand(2)) { + case 0: npctalk "Why do you say AM?"; break; + case 1: npctalk "I don't understand that"; break; + } + end; + +// are you +Lquote24: + switch(rand(3)) { + case 0: npctalk "Why are you interested in whether I am "+$@p2$+" or not?"; break; + case 1: npctalk "Would you prefer if I weren't "+$@p2$+""; break; + case 2: npctalk "Perhaps I am "+$@p2$+" in your fantasies"; break; + } + end; + +// you are +Lquote25: + npctalk "What makes you think I am "+$@p2$+" ?"; + end; + +// because +Lquote26: + switch(rand(3)) { + case 0: npctalk "Is that the real reason?"; break; + case 1: npctalk "What other reasons might there be?"; break; + case 2: npctalk "Does that reason seem to explain anything else?"; break; + } + end; + +// were you +Lquote27: + switch(rand(3)) { + case 0: npctalk "Perhaps I was "+$@p2$+""; break; + case 1: npctalk "What do you think?"; break; + case 2: npctalk "What if I had been "+$@p2$+""; break; + } + end; + +// I can't +Lquote28: + switch(rand(2)) { + case 0: npctalk "Maybe you could "+$@p3$+" now"; break; + case 1: npctalk "What if you could "+$@p3$+" ?"; break; + } + end; + +// I feel +Lquote29: + npctalk "Do you often feel "+$@p2$+" ?"; + end; + +// I felt +Lquote30: + npctalk "What other feelings do you have?"; + end; + +// $@p1$ I $@p2$ you $@p3$ +Lquote31: + npctalk "Perhaps in your fantasy we "+$@p3$+" each other?"; + end; + +// why don't you +Lquote32: + switch(rand(3)) { + case 0: npctalk "Should you "+$@p3$+" yourself?"; break; + case 1: npctalk "Do you believe I don't "+$@p3$+""; break; + case 2: npctalk "Perhaps I will "+$@p3$+" in good time"; break; + } + end; + +// yes +Lquote33: + switch(rand(3)) { + case 0: npctalk "You seem quite positive"; break; + case 1: npctalk "You are sure?"; break; + case 2: npctalk "I understand"; break; + } + end; + +// no +Lquote34: + switch(rand(3)) { + case 0: npctalk "Why not?"; break; + case 1: npctalk "You are being a bit negative"; break; + case 2: npctalk "Are you saying NO just to be negative?"; break; + } + end; + +// someone +Lquote35: + npctalk "Can you be more specific?"; + end; + +// everyone +Lquote36: + switch(rand(4)) { + case 0: npctalk "surely not everyone"; break; + case 1: npctalk "Can you think of anyone in particular?"; break; + case 2: npctalk "Who for example?"; break; + case 3: npctalk "You are thinking of a special person?"; break; + } + end; + +// always +Lquote37: + switch(rand(4)) { + case 0: npctalk "Can you think of a specific example?"; break; + case 1: npctalk "When?"; break; + case 2: npctalk "What incident are you thinking of?"; break; + case 3: npctalk "Really-- always?"; break; + } + end; + +// what +Lquote38: + switch(rand(5)) { + case 0: npctalk "Why do you ask?"; break; + case 1: npctalk "Does that question interest you?"; break; + case 2: npctalk "What is it you really want to know?"; break; + case 3: npctalk "What do you think?"; break; + case 4: npctalk "What comes to your mind when you ask that?"; break; + } + end; + +// perhaps +Lquote39: + npctalk "You do not seem quite certain"; + end; + +// are +Lquote40: + switch(rand(2)) { + case 0: npctalk "Did you think they might not be "+$@p2$+""; break; + case 1: npctalk "Possibly they are "+$@p2$; break; + } + end; + +// default +Lquote41: + switch(rand(6)) { + case 0: npctalk "Very interesting"; break; + case 1: npctalk "I am not sure I understand you fully"; break; + case 2: npctalk "What does that suggest to you?"; break; + case 3: npctalk "Please continue"; break; + case 4: npctalk "Go on"; break; + case 5: npctalk "Do you feel strongly about discussing such things?"; break; + } + end; + +OnInit: + defpattern 1, "([^:]+):.*\\shello.*", "Lquote0"; + defpattern 1, "([^:]+):.*\\scomputer.*", "Lquote1"; + defpattern 1, "([^:]+):.*\\sname.*", "Lquote2"; + defpattern 1, "([^:]+):.*\\ssorry.*", "Lquote3"; + defpattern 1, "([^:]+):.*\\si\\s+remember\\s+(.*)", "Lquote4"; + defpattern 1, "([^:]+):.*\\sdo\\s+you\\s+remember\\s+(.*)", "Lquote5"; + defpattern 1, "([^:]+):.*\\sif\\s+(.*)", "Lquote6"; + defpattern 1, "([^:]+):.*\\si\\s+dreamt\\s+(.*)", "Lquote7"; + defpattern 1, "([^:]+):.*\\sdream\\s+about\\s+(.*)", "Lquote8"; + defpattern 1, "([^:]+):.*\\sdream\\s+(.*)", "Lquote9"; + defpattern 1, "([^:]+):.*\\smy\\s+mother\\s+(.*)", "Lquote10"; + defpattern 1, "([^:]+):.*\\smy\\s+father\\s+(.*)", "Lquote11"; + defpattern 1, "([^:]+):.*\\si\\s+want\\s+(.*)", "Lquote12"; + defpattern 1, "([^:]+):.*\\si\\s+am\\s+glad\\s+(.*)", "Lquote13"; + defpattern 1, "([^:]+):\\s+(.*)\\s+i\\s+am\\s+sad\\s+(.*)", "Lquote14"; + defpattern 1, "([^:]+):\\s+(.*)\\s+are\\s+like\\s+(.*)", "Lquote15"; + defpattern 1, "([^:]+):\\s+(.*)\\s+is\\s+like\\s+(.*)", "Lquote16"; + defpattern 1, "([^:]+):.*\\salike\\s+(.*)", "Lquote17"; + defpattern 1, "([^:]+):.*\\ssame\\s+(.*)", "Lquote18"; + defpattern 1, "([^:]+):.*\\si\\s+was\\s+(.*)", "Lquote19"; + defpattern 1, "([^:]+):.*\\swas\\s+i\\s+(.*)", "Lquote20"; + defpattern 1, "([^:]+):.*\\si\\s+am\\s+(.*)", "Lquote21"; + defpattern 1, "([^:]+):.*\\sam\\s+i\\s+(.*)", "Lquote22"; + defpattern 1, "([^:]+):.*\\sam\\s+(.*)", "Lquote23"; + defpattern 1, "([^:]+):.*\\sare\\s+you\\s+(.*)", "Lquote24"; + defpattern 1, "([^:]+):.*\\syou\\s+are\\s+(.*)", "Lquote25"; + defpattern 1, "([^:]+):.*\\sbecause\\s+(.*)", "Lquote26"; + defpattern 1, "([^:]+):.*\\swere\\s+you\\s+(.*)", "Lquote27"; + defpattern 1, "([^:]+):.*\\si\\s+(cant|can't|cannot)\\s+(.*)", "Lquote28"; + defpattern 1, "([^:]+):.*\\si\\s+feel\\s+(.*)", "Lquote29"; + defpattern 1, "([^:]+):.*\\si\\s+felt\\s+(.*)", "Lquote30"; + defpattern 1, "([^:]+):.*\\si\\s+(.*)\\s+you\\s+(.*)", "Lquote31"; + defpattern 1, "([^:]+):.*\\swhy\\s+(don't|dont)\\s+you\\s+(.*)", "Lquote32"; + defpattern 1, "([^:]+):.*\\syes\\s+(.*)", "Lquote33"; + defpattern 1, "([^:]+):.*\\sno\\s+(.*)", "Lquote34"; + defpattern 1, "([^:]+):.*\\ssomeone\\s+(.*)", "Lquote35"; + defpattern 1, "([^:]+):.*\\severyone\\s+(.*)", "Lquote36"; + defpattern 1, "([^:]+):.*\\salways\\s+(.*)", "Lquote37"; + defpattern 1, "([^:]+):.*\\swhat\\s+(.*)", "Lquote38"; + defpattern 1, "([^:]+):.*\\sperhaps\\s+(.*)", "Lquote39"; + defpattern 1, "([^:]+):.*\\sare\\s+(.*)", "Lquote40"; + defpattern 1, "([^:]+):(.*)", "Lquote41"; + + activatepset 1; + end; +} diff --git a/doc/sample/npc_test_time.txt b/doc/sample/npc_test_time.txt new file mode 100644 index 000000000..8c5cbdb3e --- /dev/null +++ b/doc/sample/npc_test_time.txt @@ -0,0 +1,25 @@ +//===== rAthena Script ======================================= +//= Sample: Time Test +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20070315 +//===== Description: ========================================= +//= Demonstrates time commands. +//============================================================ + +prontera,157,181,6 script Time Sample 105,{ + mes "[Time Sample]"; + mes "System Tick : " + gettimetick(0); + mes " Time Tick : " + gettimetick(1); + mes " GetTime(0) : " + gettime(0); + mes " GetTime(1) : " + gettime(1) + " (Sec)"; + mes " GetTime(2) : " + gettime(2) + " (Min)"; + mes " GetTime(3) : " + gettime(3) + " (Hour)"; + mes " GetTime(4) : " + gettime(4) + " (WeekDay)"; + mes " GetTime(5) : " + gettime(5) + " (MonthDay)"; + mes " GetTime(6) : " + gettime(6) + " (Month)"; + mes " GetTime(7) : " + gettime(7) + " (Year)"; + mes " GetTimeStr : " + gettimestr("%Y-%m/%d %H:%M:%S",19); + close; +} \ No newline at end of file diff --git a/doc/sample/npc_time_sample.txt b/doc/sample/npc_time_sample.txt deleted file mode 100644 index 8c5cbdb3e..000000000 --- a/doc/sample/npc_time_sample.txt +++ /dev/null @@ -1,25 +0,0 @@ -//===== rAthena Script ======================================= -//= Sample: Time Test -//===== By: ================================================== -//= rAthena Dev Team -//===== Current Version: ===================================== -//= 20070315 -//===== Description: ========================================= -//= Demonstrates time commands. -//============================================================ - -prontera,157,181,6 script Time Sample 105,{ - mes "[Time Sample]"; - mes "System Tick : " + gettimetick(0); - mes " Time Tick : " + gettimetick(1); - mes " GetTime(0) : " + gettime(0); - mes " GetTime(1) : " + gettime(1) + " (Sec)"; - mes " GetTime(2) : " + gettime(2) + " (Min)"; - mes " GetTime(3) : " + gettime(3) + " (Hour)"; - mes " GetTime(4) : " + gettime(4) + " (WeekDay)"; - mes " GetTime(5) : " + gettime(5) + " (MonthDay)"; - mes " GetTime(6) : " + gettime(6) + " (Month)"; - mes " GetTime(7) : " + gettime(7) + " (Year)"; - mes " GetTimeStr : " + gettimestr("%Y-%m/%d %H:%M:%S",19); - close; -} \ No newline at end of file diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 8a7767cf0..bcb632443 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -6511,6 +6511,12 @@ directly. It probably determines which directory to play the effect from. It's certain that giving 0 for the number will play sound files from '\data\wav\', but where the other numbers will read from is unclear. +The sound files themselves must be in the PCM format, and file names should also +have a maximum length of 23 characters including the .wav extension: + +soundeffect "1234567890123456789.wav", 0; // this will play the soundeffect +soundeffect "12345678901234567890.wav", 0; // throw gravity error + You can add your own effects this way, naturally. --------------------------------------- @@ -6694,7 +6700,7 @@ expression pattern is, see a few web pages: http://www.regular-expressions.info/ http://www.weitz.de/regex-coach/ -For an example of this in use, see doc/sample/npc_pcre.txt +For an example of this in use, see doc/sample/npc_test_pcre.txt With this you could, for example, automatically punish players for asking for Zeny in public places, or alternatively, automatically give them Zeny instead if @@ -6859,10 +6865,9 @@ The first letter is position 0. *charat(,) - Returns char at specified index. If index is out of range, - returns empty string. +Returns char at specified index. If index is out of range, returns empty string. - Example: +Example: charat("This is a string", 10); //returns "s" @@ -6870,12 +6875,11 @@ The first letter is position 0. *setchar(,,) - Returns the original string with the char at the specified - index set to the specified char. If index out of range, the - original string will be returned. - Only the 1st char in the parameter will be used. +Returns the original string with the char at the specified index set to the +specified char. If index out of range, the original string will be returned. +Only the 1st char in the parameter will be used. - Example: +Example: setchar("Cat", "B", 0); //returns "Bat" @@ -6883,12 +6887,11 @@ The first letter is position 0. *insertchar(,,) - Returns the original string with the specified char inserted - at the specified index. If index is out of range, the char - will be inserted on the end of the string that it is closest. - Only the 1st char in the parameter will be used. +Returns the original string with the specified char inserted at the specified +index. If index is out of range, the char will be inserted on the end of the +string that it is closest. Only the 1st char in the parameter will be used. - Example: +Example: insertchar("laughter", "s", 0); //returns "slaughter" @@ -6896,10 +6899,10 @@ The first letter is position 0. *delchar(,) - Returns the original string with the char at the specified index - removed. If index is out of range, original string will be returned. +Returns the original string with the char at the specified index removed. +If index is out of range, original string will be returned. - Example: +Example: delchar("Diet", 3); //returns "Die" @@ -6908,10 +6911,10 @@ The first letter is position 0. *strtoupper() *strtolower() - Returns the specified string in it's uppercase/lowercase form. - All non-alpha characters will be preserved +Returns the specified string in it's uppercase/lowercase form. +All non-alpha characters will be preserved. - Example: +Example: strtoupper("The duck is blue!!"); //returns "THE DUCK IS BLUE!!" @@ -6920,11 +6923,10 @@ The first letter is position 0. *charisupper(,) *charislower(,) - Returns 1 if character at specified index of specified string is - uppercase/lowercase. Otherwise, 0. Characters not of the alphabelt - will return 0. +Returns 1 if character at specified index of specified string is +uppercase/lowercase. Otherwise, 0. Characters not of the alphabelt will return 0. - Example: +Example: charisupper("rAthena", 1); //returns 1 @@ -6932,12 +6934,11 @@ The first letter is position 0. *substr(,,) - Returns the sub-string of the specified string inclusively between - the set indexes. - If indexes are out of range, or the start index is after the end - index, an empty string will be returned. +Returns the sub-string of the specified string inclusively between the set +indexes. If indexes are out of range, or the start index is after the end +index, an empty string will be returned. - Example: +Example: substr("foobar", 3, 5); //returns "bar" @@ -6945,13 +6946,12 @@ The first letter is position 0. *explode(,,) - Breaks a string up into substrings based on the specified delimiter. - Substrings will be stored within the specified string array. - Only the 1st char of the delimiter parameter will be used. - If an empty string is passed as a delimiter, the string will be placed - in the array in it's original form. - - Example: +Breaks a string up into substrings based on the specified delimiter. Substrings +will be stored within the specified string array. Only the 1st char of the +delimiter parameter will be used. If an empty string is passed as a delimiter, +the string will be placed in the array in it's original form. + +Example: explode(.@my_array$, "Explode:Test:1965:red:PIE", ":"); //.@my_array$ contents will be... @@ -6965,10 +6965,10 @@ The first letter is position 0. *implode({,}) - Combines all substrings within the specified string array into a single string. - If the glue parameter is specified, it will be inserted inbetween each substring. +Combines all substrings within the specified string array into a single string. +If the glue parameter is specified, it will be inserted inbetween each substring. - Example: +Example: setarray .@my_array$[0], "This", "is", "a", "test"; implode(.@my_array$, " "); //returns "This is a test" @@ -6976,13 +6976,11 @@ The first letter is position 0. *sprintf([,param[,param[,...]]]) [Mirei] - C style sprintf. The resulting string is returned same as in PHP. All C format - specifiers are supported except %n. More info: sprintf @ www.cplusplus.com. - The number of params is only limited by eA's script engine. - - See thread: http://www.eathena.ws/board/index.php?showtopic=190410 - - Example: +C style sprintf. The resulting string is returned same as in PHP. All C format +specifiers are supported except %n. More info: sprintf @ www.cplusplus.com. +The number of params is only limited by rA's script engine. + +Example: .@format$ = 'The %s contains %d monkeys'; dispbottom(sprintf(.@format$, "zoo", 5)); //prints "The zoo contains 5 monkeys" dispbottom(sprintf(.@format$, "barrel", 82)); //prints "The barrel contains 82 monkeys" @@ -6991,13 +6989,11 @@ The first letter is position 0. *sscanf(,[,param[,param[,...]]]) [Mirei] - C style sscanf. All C format specifiers are supported. - More info: sscanf @ www.cplusplus.com. The number of params is only limited - by eA's script engine. - - See thread: http://www.eathena.ws/board/index.php?showtopic=191157 - - Example: +C style sscanf. All C format specifiers are supported. +More info: sscanf @ www.cplusplus.com. The number of params is only limited +by rA's script engine. + +Example: sscanf("This is a test: 42 foobar", "This is a test: %d %s", .@num, .@str$); dispbottom(.@num + " " + .@str$); //prints "42 foobar" @@ -7005,12 +7001,12 @@ The first letter is position 0. *strpos(,{,}) - PHP style strpos. Finds a substring (needle) within a string (haystack). - The offset parameter indicates the index of the string to start searching. - Returns index of substring on successful search, else -1. - Comparison is case sensitive. - - Example: +PHP style strpos. Finds a substring (needle) within a string (haystack). +The offset parameter indicates the index of the string to start searching. +Returns index of substring on successful search, else -1. +Comparison is case sensitive. + +Example: strpos("foobar", "bar", 0); //returns 3 strpos("foobarfoo", "foo", 0); //returns 0 strpos("foobarfoo", "foo", 1); //returns 6 @@ -7019,12 +7015,12 @@ The first letter is position 0. *replacestr(, , {, {, }}) - Replaces all instances of a search string in the input with the specified - replacement string. By default is case sensitive unless is set - to 0. If specified it will only replace as many instances as specified - in the count parameter. - - Example: +Replaces all instances of a search string in the input with the specified +replacement string. By default is case sensitive unless is set +to 0. If specified it will only replace as many instances as specified +in the count parameter. + +Example: replacestr("testing tester", "test", "dash"); //returns "dashing dasher" replacestr("Donkey", "don", "mon", 0); //returns "monkey" replacestr("test test test test test", "yay", 0, 3); //returns "yay yay yay test test" @@ -7032,11 +7028,11 @@ The first letter is position 0. --------------------------------------- *countstr(, {, }) - - Counts all instances of a search string in the input. By default is case - sensitive unless is set to 0. - - Example: + +Counts all instances of a search string in the input. By default is case +sensitive unless is set to 0. + +Example: countstr("test test test Test", "test"); //returns 3 countstr("cake Cake", "Cake", 0); //returns 2 -- cgit v1.2.3-70-g09d2