Updated the server's PCRE components to 7.0

- dll, library, header
- cleaned the only existing example and moved it to /samples
- changed its interface a bit, now it uses $@ instead of $ to store the parsed result
- /!\ adjust your scripts if you are using npc regexp parsing /!\

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10170 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
ultramage 2007-04-06 22:15:19 +00:00
parent 7d46c4c259
commit a61e02cc29
9 changed files with 465 additions and 734 deletions

View File

@ -5,8 +5,13 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2007/04/07
Updated the server's PCRE components to 7.0
- dll, library, header
- cleaned the only existing example and moved it to /samples
- changed the interface, now $@ is used instead of $ to store the result
- /!\ adjust your scripts if you are using npc regexp parsing /!\
* Fixed the start_point setting smashing t3h stack in some situations
* Fixed some over/under-dimensioned arrays (the map length defines already reserve space for the string terminator)
* Fixed some over/under-dimensioned arrays (defines already cover the '\0')
* Fixed an unupdated define making Warp Portal fail with an error [ultramage]
* Final touches to the whole map crap [DracoRPG]
- changed MAP_NAME_LENGTH to 12, now there's MAP_NAME_LENGTH_EXT at 16 for

View File

@ -5794,7 +5794,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 'npc\custom\eliza.txt'.
For an example of this in use, see 'npc\sample\npc_pcre.txt'.
With this you could, for example, automagically punish players for asking for
zeny in public places, or alternatively, automagically give them zeny instead if

Binary file not shown.

View File

@ -1,702 +0,0 @@
prontera,152,181,5 script MouseJstr 763,{
// hello
Lquote0:
npctalk "How do you do. Please state your problem.";
end;
// computer
Lquote1:
set $foo,rand(4);
if($foo == 0) goto Lquote1a;
if($foo == 1) goto Lquote1b;
if($foo == 2) goto Lquote1c;
if($foo == 3) goto Lquote1d;
Lquote1a:
npctalk "Do computers worry you?";
end;
Lquote1b:
npctalk "What do you think about machines?";
end;
Lquote1c:
npctalk "Why do you mention computers?";
end;
Lquote1d:
npctalk "What do you think machines have to do with your problem?";
end;
// name
Lquote2:
npctalk "I am not interested in names";
end;
// sorry
Lquote3:
set $foo,rand(3);
if($foo == 0) goto Lquote3a;
if($foo == 1) goto Lquote3b;
if($foo == 2) goto Lquote3c;
Lquote3a:
npctalk "Please don't apologize";
end;
Lquote3b:
npctalk "Apologies are not necessary";
end;
Lquote3c:
npctalk "What feelings do you have when you apologize";
end;
// I remember $p2$
Lquote4:
set $foo,rand(6);
if($foo == 0) goto Lquote4a;
if($foo == 1) goto Lquote4b;
if($foo == 2) goto Lquote4c;
if($foo == 3) goto Lquote4d;
if($foo == 4) goto Lquote4e;
if($foo == 5) goto Lquote4f;
Lquote4a:
npctalk "Do you often think of "+$p2$+"?";
end;
Lquote4b:
npctalk "Does thinking of "+$p2$+" bring anything else to mind?";
end;
Lquote4c:
npctalk "What else do you remember?";
end;
Lquote4d:
npctalk "Why do you recall "+$p2$+" right now?";
end;
Lquote4e:
npctalk "What in the present situation reminds you of "+$p2$+"?";
end;
Lquote4f:
npctalk "What is the connection between me and "+$p2$+"?";
end;
// do you remember
Lquote5:
set $foo,rand(4);
if($foo == 0) goto Lquote5a;
if($foo == 1) goto Lquote5b;
if($foo == 2) goto Lquote5c;
if($foo == 3) goto Lquote5d;
Lquote5a:
npctalk "Did you think I would forget "+$p2$+" ?";
end;
Lquote5b:
npctalk "Why do you think I should recall "+$p2$+" now";
end;
Lquote5c:
npctalk "What about "+$p2$+"";
end;
Lquote5d:
npctalk "You mentioned "+$p2$+"";
end;
// if
Lquote6:
set $foo,rand(4);
if($foo == 0) goto Lquote6a;
if($foo == 1) goto Lquote6b;
if($foo == 2) goto Lquote6c;
if($foo == 3) goto Lquote6d;
Lquote6a:
npctalk "Do you really think its likely that "+$p2$+"";
end;
Lquote6b:
npctalk "Do you wish that "+$p2$+"?";
end;
Lquote6c:
npctalk "What do you think about "+$p2$+"?";
end;
Lquote6d:
npctalk "Really-- if "+$p2$+"?";
end;
// i dreamt
Lquote7:
set $foo,rand(3);
if($foo == 0) goto Lquote7a;
if($foo == 1) goto Lquote7b;
if($foo == 2) goto Lquote7c;
Lquote7a:
npctalk "Really-- "+$p2$+"";
end;
Lquote7b:
npctalk "Have you ever fantasized "+$p2$+" while you were awake?";
end;
Lquote7c:
npctalk "Have you dreamt "+$p2$+" before?";
end;
// dream about
Lquote8:
npctalk "How do you feel about "+$p2$+" in reality?";
end;
// dream
Lquote9:
set $foo,rand(4);
if($foo == 0) goto Lquote9a;
if($foo == 1) goto Lquote9b;
if($foo == 2) goto Lquote9c;
if($foo == 3) goto Lquote9d;
Lquote9a:
npctalk "What does this dream suggest to you?";
end;
Lquote9b:
npctalk "Do you dream often?";
end;
Lquote9c:
npctalk "What persons appear in your dreams?";
end;
Lquote9d:
npctalk "Don't you believe that dream has to do with your problem?";
end;
// my mother
Lquote10:
set $foo,rand(2);
if($foo == 0) goto Lquote10a;
if($foo == 1) goto Lquote10b;
Lquote10a:
npctalk "Who else in your family "+$p2$+"";
end;
Lquote10b:
npctalk "Tell me more about your family";
end;
// my father
Lquote11:
set $foo,rand(3);
if($foo == 0) goto Lquote11a;
if($foo == 1) goto Lquote11b;
if($foo == 2) goto Lquote11c;
Lquote11a:
npctalk "Your father";
end;
Lquote11b:
npctalk "Does he influence you strongly?";
end;
Lquote11c:
npctalk "What else comes to mind when you think of your father?";
end;
// I want
Lquote12:
set $foo,rand(3);
if($foo == 0) goto Lquote12a;
if($foo == 1) goto Lquote12b;
if($foo == 2) goto Lquote12c;
Lquote12a:
npctalk "What would it mean if you got "+$p2$+"";
end;
Lquote12b:
npctalk "Why do you want "+$p2$+"";
end;
Lquote12c:
npctalk "Suppose you got "+$p2$+" soon";
end;
// I am glad
Lquote13:
set $foo,rand(3);
if($foo == 0) goto Lquote13a;
if($foo == 1) goto Lquote13b;
if($foo == 2) goto Lquote13c;
Lquote13a:
npctalk "How have I helped you to be "+$p2$+"";
end;
Lquote13b:
npctalk "What makes you happy just now";
end;
Lquote13c:
npctalk "Can you explain why you are suddenly "+$p2$+"";
end;
// I am sad
Lquote14:
set $foo,rand(2);
if($foo == 0) goto Lquote14a;
if($foo == 1) goto Lquote14b;
Lquote14a:
npctalk "I am sorry to hear you are depressed";
end;
Lquote14b:
npctalk "I'm sure its not pleasant to be sad";
end;
// $p2 are like "+$p3$+"
Lquote15:
npctalk "What resemblance do you see between "+$p2$+" and "+$p3$+"";
end;
// "+$p2$+" is like "+$p3$+"
Lquote16:
set $foo,rand(4);
if($foo == 0) goto Lquote16a;
if($foo == 1) goto Lquote16b;
if($foo == 2) goto Lquote16c;
if($foo == 3) goto Lquote16d;
Lquote16a:
npctalk "In what way is it that "+$p2$+" is like "+$p3$+"";
end;
Lquote16b:
npctalk "What resemblance do you see?";
end;
Lquote16c:
npctalk "Could there really be some connection?";
end;
Lquote16d:
npctalk "How?";
end;
// alike
Lquote17:
set $foo,rand(2);
if($foo == 0) goto Lquote17a;
if($foo == 1) goto Lquote17b;
Lquote17a:
npctalk "In what way?";
end;
Lquote17b:
npctalk "What similarities are there?";
end;
// same
Lquote18:
npctalk "What other connections do you see?";
end;
// I was "+$p2$+"
Lquote19:
set $foo,rand(3);
if($foo == 0) goto Lquote19a;
if($foo == 1) goto Lquote19b;
if($foo == 2) goto Lquote19c;
Lquote19a:
npctalk "Were you really?";
end;
Lquote19b:
npctalk "Perhaps I already knew you were "+$p2$+"";
end;
Lquote19c:
npctalk "Why do you tell me you were "+$p2$+" now?";
end;
// was I
Lquote20:
set $foo,rand(3);
if($foo == 0) goto Lquote20a;
if($foo == 1) goto Lquote20b;
if($foo == 2) goto Lquote20c;
Lquote20a:
npctalk "What if you were "+$p2$+" ?";
end;
Lquote20b:
npctalk "Do you thin you were "+$p2$+"";
end;
Lquote20c:
npctalk "What would it mean if you were "+$p2$+"";
end;
// I am
Lquote21:
set $foo,rand(2);
if($foo == 0) goto Lquote21a;
if($foo == 1) goto Lquote21b;
Lquote21a:
npctalk "In what way are you "+$p2$+"";
end;
Lquote21b:
npctalk "Do you want to be "+$p2$+" ?";
end;
// am I
Lquote22:
set $foo,rand(4);
if($foo == 0) goto Lquote22a;
if($foo == 1) goto Lquote22b;
if($foo == 2) goto Lquote22c;
if($foo == 3) goto Lquote22d;
Lquote22a:
npctalk "Do you believe you are "+$p2$+"";
end;
Lquote22b:
npctalk "Would you want to be "+$p2$+"";
end;
Lquote22c:
npctalk "You wish I would tell you you are "+$p2$+"";
end;
Lquote22d:
npctalk "What would it mean if you were "+$p2$+"";
end;
// am
Lquote23:
set $foo,rand(2);
if($foo == 0) goto Lquote23a;
if($foo == 1) goto Lquote23b;
Lquote23a:
npctalk "Why do you say AM?";
end;
Lquote23b:
npctalk "I don't understand that";
end;
// are you
Lquote24:
set $foo,rand(3);
if($foo == 0) goto Lquote24a;
if($foo == 1) goto Lquote24b;
if($foo == 2) goto Lquote24c;
Lquote24a:
npctalk "Why are you interested in whether I am "+$p2$+" or not?";
end;
Lquote24b:
npctalk "Would you prefer if I weren't "+$p2$+"";
end;
Lquote24c:
npctalk "Perhaps I am "+$p2$+" in your fantasies";
end;
// you are
Lquote25:
npctalk "What makes you think I am "+$p2$+" ?";
end;
// because
Lquote26:
set $foo,rand(3);
if($foo == 0) goto Lquote26a;
if($foo == 1) goto Lquote26b;
if($foo == 2) goto Lquote26c;
Lquote26a:
npctalk "Is that the real reason?";
end;
Lquote26b:
npctalk "What other reasons might there be?";
end;
Lquote26c:
npctalk "Does that reason seem to explain anything else?";
end;
// were you
Lquote27:
set $foo,rand(3);
if($foo == 0) goto Lquote27a;
if($foo == 1) goto Lquote27b;
if($foo == 2) goto Lquote27c;
Lquote27a:
npctalk "Perhaps I was "+$p2$+"";
end;
Lquote27b:
npctalk "What do you think?";
end;
Lquote27c:
npctalk "What if I had been "+$p2$+"";
end;
// I can't
Lquote28:
set $foo,rand(2);
if($foo == 0) goto Lquote28a;
if($foo == 1) goto Lquote28b;
Lquote28a:
npctalk "Maybe you could "+$p2$+" now";
end;
Lquote28b:
npctalk "What if you could "+$p2$+" ?";
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:
set $foo,rand(3);
if($foo == 0) goto Lquote32a;
if($foo == 1) goto Lquote32b;
if($foo == 2) goto Lquote32c;
Lquote32a:
npctalk "Should you "+$p2$+" yourself?";
end;
Lquote32b:
npctalk "Do you believe I don't "+$p2$+"";
end;
Lquote32c:
npctalk "Perhaps I will "+$p2$+" in good time";
end;
// yes
Lquote33:
set $foo,rand(3);
if($foo == 0) goto Lquote33a;
if($foo == 1) goto Lquote33b;
if($foo == 2) goto Lquote33c;
Lquote33a:
npctalk "You seem quite positive";
end;
Lquote33b:
npctalk "You are sure?";
end;
Lquote33c:
npctalk "I understand";
end;
// no
Lquote34:
set $foo,rand(3);
if($foo == 0) goto Lquote34a;
if($foo == 1) goto Lquote34b;
if($foo == 2) goto Lquote34c;
Lquote34a:
npctalk "Why not?";
end;
Lquote34b:
npctalk "You are being a bit negative";
end;
Lquote34c:
npctalk "Are you saying NO just to be negative?";
end;
// someone
Lquote35:
npctalk "Can you be more specific?";
end;
// everyone
Lquote36:
set $foo,rand(4);
if($foo == 0) goto Lquote36a;
if($foo == 1) goto Lquote36b;
if($foo == 2) goto Lquote36c;
if($foo == 3) goto Lquote36d;
Lquote36a:
npctalk "surely not everyone";
end;
Lquote36b:
npctalk "Can you think of anyone in particular?";
end;
Lquote36c:
npctalk "Who for example?";
end;
Lquote36d:
npctalk "You are thinking of a special person?";
end;
// always
Lquote37:
set $foo,rand(4);
if($foo == 0) goto Lquote37a;
if($foo == 1) goto Lquote37b;
if($foo == 2) goto Lquote37c;
if($foo == 3) goto Lquote37d;
Lquote37a:
npctalk "Can you think of a specific example?";
end;
Lquote37b:
npctalk "When?";
end;
Lquote37c:
npctalk "What incident are you thinking of?";
end;
Lquote37d:
npctalk "Really-- always?";
end;
// what
Lquote38:
set $foo,rand(5);
if($foo == 0) goto Lquote38a;
if($foo == 1) goto Lquote38b;
if($foo == 2) goto Lquote38c;
if($foo == 3) goto Lquote38d;
if($foo == 4) goto Lquote38e;
Lquote38a:
npctalk "Why do you ask?";
end;
Lquote38b:
npctalk "Does that question interest you?";
end;
Lquote38c:
npctalk "What is it you really want to know?";
end;
Lquote38d:
npctalk "What do you think?";
end;
Lquote38e:
npctalk "What comes to your mind when you ask that?";
end;
// perhaps
Lquote39:
npctalk "You do not seem quite certain";
end;
// are
Lquote40:
set $foo,rand(2);
if($foo == 0) goto Lquote40a;
if($foo == 1) goto Lquote40b;
Lquote40a:
npctalk "Did you think they might not be "+$p2$+"";
end;
Lquote40b:
npctalk "Possibly they are "+$p2$;
end;
// default
Lquote41:
set $foo,rand(6);
if($foo == 0) goto Lquote41a;
if($foo == 1) goto Lquote41b;
if($foo == 2) goto Lquote41c;
if($foo == 3) goto Lquote41d;
if($foo == 4) goto Lquote41e;
if($foo == 5) goto Lquote41f;
Lquote41a:
npctalk "Very interesting";
end;
Lquote41b:
npctalk "I am not sure I understand you fully";
end;
Lquote41c:
npctalk "What does that suggest to you?";
end;
Lquote41d:
npctalk "Please continue";
end;
Lquote41e:
npctalk "Go on";
end;
Lquote41f:
npctalk "Do you feel strongly about discussing such things?";
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;
}

392
npc/sample/npc_pcre.txt Normal file
View File

@ -0,0 +1,392 @@
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 "+$@p2$+" now"; break;
case 1: npctalk "What if you could "+$@p2$+" ?"; 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 "+$@p2$+" yourself?"; break;
case 1: npctalk "Do you believe I don't "+$@p2$+""; break;
case 2: npctalk "Perhaps I will "+$@p2$+" 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;
}

BIN
pcre3.dll

Binary file not shown.

View File

@ -49,7 +49,7 @@
* is matched.
*
* each of the matched Groups will result in a variable being
* set ($p1$ through $p9$ with $p0$ being the entire string)
* set ($@p1$ through $@p9$ with $@p0$ being the entire string)
* before the script gets executed.
*
* activatepset 1;
@ -402,43 +402,43 @@ int npc_chat_sub(struct block_list *bl, va_list ap)
case 10:
memcpy(buf, &msg[offsets[18]], offsets[19]);
buf[offsets[19]] = '\0';
set_var(sd, "$p9$", buf);
set_var(sd, "$@p9$", buf);
case 9:
memcpy(buf, &msg[offsets[16]], offsets[17]);
buf[offsets[17]] = '\0';
set_var(sd, "$p8$", buf);
set_var(sd, "$@p8$", buf);
case 8:
memcpy(buf, &msg[offsets[14]], offsets[15]);
buf[offsets[15]] = '\0';
set_var(sd, "$p7$", buf);
set_var(sd, "$@p7$", buf);
case 7:
memcpy(buf, &msg[offsets[12]], offsets[13]);
buf[offsets[13]] = '\0';
set_var(sd, "$p6$", buf);
set_var(sd, "$@p6$", buf);
case 6:
memcpy(buf, &msg[offsets[10]], offsets[11]);
buf[offsets[11]] = '\0';
set_var(sd, "$p5$", buf);
set_var(sd, "$@p5$", buf);
case 5:
memcpy(buf, &msg[offsets[8]], offsets[9]);
buf[offsets[9]] = '\0';
set_var(sd, "$p4$", buf);
set_var(sd, "$@p4$", buf);
case 4:
memcpy(buf, &msg[offsets[6]], offsets[7]);
buf[offsets[7]] = '\0';
set_var(sd, "$p3$", buf);
set_var(sd, "$@p3$", buf);
case 3:
memcpy(buf, &msg[offsets[4]], offsets[5]);
buf[offsets[5]] = '\0';
set_var(sd, "$p2$", buf);
set_var(sd, "$@p2$", buf);
case 2:
memcpy(buf, &msg[offsets[2]], offsets[3]);
buf[offsets[3]] = '\0';
set_var(sd, "$p1$", buf);
set_var(sd, "$@p1$", buf);
case 1:
memcpy(buf, &msg[offsets[0]], offsets[1]);
buf[offsets[1]] = '\0';
set_var(sd, "$p0$", buf);
set_var(sd, "$@p0$", buf);
}
// find the target label.. this sucks..

View File

@ -2,10 +2,10 @@
* Perl-Compatible Regular Expressions *
*************************************************/
/* In its original form, this is the .in file that is transformed by
"configure" into pcre.h.
/* This is the public header file for the PCRE library, to be #included by
applications that call the PCRE functions.
Copyright (c) 1997-2005 University of Cambridge
Copyright (c) 1997-2006 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@ -39,14 +39,26 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef _PCRE_H
#define _PCRE_H
/* The file pcre.h is build by "configure". Do not edit it; instead
make changes to pcre.in. */
/* The current PCRE version information. */
#define PCRE_MAJOR 6
#define PCRE_MINOR 3
#define PCRE_DATE 15-Aug-2005
/* NOTES FOR FUTURE MAINTAINERS: Do not use numbers with leading zeros, because
they may be treated as octal constants. The PCRE_PRERELEASE feature is for
identifying release candidates. It might be defined as -RC2, for example. In
real releases, it should be defined empty. Do not change the alignment of these
statments. The code in ./configure greps out the version numbers by using "cut"
to get values from column 29 onwards. These are substituted into pcre-config
and libpcre.pc. The values are not put into configure.ac and substituted here
(which would simplify this issue) because that makes life harder for those who
cannot run ./configure. As it now stands, this file need not be edited in that
circumstance. */
/* Win32 uses DLL by default; it needs special stuff for exported functions. */
#define PCRE_MAJOR 7
#define PCRE_MINOR 0
#define PCRE_PRERELEASE
#define PCRE_DATE 18-Dec-2006
/* Win32 uses DLL by default; it needs special stuff for exported functions
when building PCRE. */
#ifdef _WIN32
# ifdef PCRE_DEFINITION
@ -60,7 +72,7 @@ make changes to pcre.in. */
# endif
#endif
/* For other operating systems, we use the standard "extern". */
/* Otherwise, we use the standard "extern". */
#ifndef PCRE_DATA_SCOPE
# ifdef __cplusplus
@ -102,6 +114,11 @@ extern "C" {
#define PCRE_DFA_SHORTEST 0x00010000
#define PCRE_DFA_RESTART 0x00020000
#define PCRE_FIRSTLINE 0x00040000
#define PCRE_DUPNAMES 0x00080000
#define PCRE_NEWLINE_CR 0x00100000
#define PCRE_NEWLINE_LF 0x00200000
#define PCRE_NEWLINE_CRLF 0x00300000
#define PCRE_NEWLINE_ANY 0x00400000
/* Exec-time and get/set-time error codes */
@ -109,7 +126,8 @@ extern "C" {
#define PCRE_ERROR_NULL (-2)
#define PCRE_ERROR_BADOPTION (-3)
#define PCRE_ERROR_BADMAGIC (-4)
#define PCRE_ERROR_UNKNOWN_NODE (-5)
#define PCRE_ERROR_UNKNOWN_OPCODE (-5)
#define PCRE_ERROR_UNKNOWN_NODE (-5) /* For backward compatibility */
#define PCRE_ERROR_NOMEMORY (-6)
#define PCRE_ERROR_NOSUBSTRING (-7)
#define PCRE_ERROR_MATCHLIMIT (-8)
@ -125,6 +143,9 @@ extern "C" {
#define PCRE_ERROR_DFA_UMLIMIT (-18)
#define PCRE_ERROR_DFA_WSSIZE (-19)
#define PCRE_ERROR_DFA_RECURSE (-20)
#define PCRE_ERROR_RECURSIONLIMIT (-21)
#define PCRE_ERROR_NULLWSLIMIT (-22)
#define PCRE_ERROR_BADNEWLINE (-23)
/* Request types for pcre_fullinfo() */
@ -142,7 +163,8 @@ extern "C" {
#define PCRE_INFO_STUDYSIZE 10
#define PCRE_INFO_DEFAULT_TABLES 11
/* Request types for pcre_config() */
/* Request types for pcre_config(). Do not re-arrange, in order to remain
compatible. */
#define PCRE_CONFIG_UTF8 0
#define PCRE_CONFIG_NEWLINE 1
@ -151,19 +173,30 @@ extern "C" {
#define PCRE_CONFIG_MATCH_LIMIT 4
#define PCRE_CONFIG_STACKRECURSE 5
#define PCRE_CONFIG_UNICODE_PROPERTIES 6
#define PCRE_CONFIG_MATCH_LIMIT_RECURSION 7
/* Bit flags for the pcre_extra structure */
/* Bit flags for the pcre_extra structure. Do not re-arrange or redefine
these bits, just add new ones on the end, in order to remain compatible. */
#define PCRE_EXTRA_STUDY_DATA 0x0001
#define PCRE_EXTRA_MATCH_LIMIT 0x0002
#define PCRE_EXTRA_CALLOUT_DATA 0x0004
#define PCRE_EXTRA_TABLES 0x0008
#define PCRE_EXTRA_STUDY_DATA 0x0001
#define PCRE_EXTRA_MATCH_LIMIT 0x0002
#define PCRE_EXTRA_CALLOUT_DATA 0x0004
#define PCRE_EXTRA_TABLES 0x0008
#define PCRE_EXTRA_MATCH_LIMIT_RECURSION 0x0010
/* Types */
struct real_pcre; /* declaration; the definition is private */
typedef struct real_pcre pcre;
/* When PCRE is compiled as a C++ library, the subject pointer type can be
replaced with a custom type. For conventional use, the public interface is a
const char *. */
#ifndef PCRE_SPTR
#define PCRE_SPTR const char *
#endif
/* The structure for passing additional data to pcre_exec(). This is defined in
such as way as to be extensible. Always add new fields at the end, in order to
remain compatible. */
@ -174,6 +207,7 @@ typedef struct pcre_extra {
unsigned long int match_limit; /* Maximum number of calls to match() */
void *callout_data; /* Data passed back in callouts */
const unsigned char *tables; /* Pointer to character tables */
unsigned long int match_limit_recursion; /* Max recursive calls to match() */
} pcre_extra;
/* The structure for passing out data via the pcre_callout_function. We use a
@ -186,7 +220,7 @@ typedef struct pcre_callout_block {
/* ------------------------ Version 0 ------------------------------- */
int callout_number; /* Number compiled into pattern */
int *offset_vector; /* The offset vector */
const char *subject; /* The subject being matched */
PCRE_SPTR subject; /* The subject being matched */
int subject_length; /* The length of the subject */
int start_match; /* Offset to start of this match attempt */
int current_position; /* Where we currently are in the subject */
@ -232,7 +266,7 @@ PCRE_DATA_SCOPE int pcre_copy_substring(const char *, int *, int, int, char *,
int);
PCRE_DATA_SCOPE int pcre_dfa_exec(const pcre *, const pcre_extra *,
const char *, int, int, int, int *, int , int *, int);
PCRE_DATA_SCOPE int pcre_exec(const pcre *, const pcre_extra *, const char *,
PCRE_DATA_SCOPE int pcre_exec(const pcre *, const pcre_extra *, PCRE_SPTR,
int, int, int, int *, int);
PCRE_DATA_SCOPE void pcre_free_substring(const char *);
PCRE_DATA_SCOPE void pcre_free_substring_list(const char **);
@ -241,6 +275,8 @@ PCRE_DATA_SCOPE int pcre_fullinfo(const pcre *, const pcre_extra *, int,
PCRE_DATA_SCOPE int pcre_get_named_substring(const pcre *, const char *,
int *, int, const char *, const char **);
PCRE_DATA_SCOPE int pcre_get_stringnumber(const pcre *, const char *);
PCRE_DATA_SCOPE int pcre_get_stringtable_entries(const pcre *, const char *,
char **, char **);
PCRE_DATA_SCOPE int pcre_get_substring(const char *, int *, int, int,
const char **);
PCRE_DATA_SCOPE int pcre_get_substring_list(const char *, int *, int,