summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/constants.conf2
-rw-r--r--npc/008-1/_import.txt1
-rw-r--r--npc/008-1/confused-tree.txt916
-rw-r--r--npc/functions/confused-tree-dict.txt544
-rw-r--r--npc/scripts.conf1
5 files changed, 1464 insertions, 0 deletions
diff --git a/db/constants.conf b/db/constants.conf
index cc5fcb62..71f93230 100644
--- a/db/constants.conf
+++ b/db/constants.conf
@@ -3871,6 +3871,8 @@ constants_db: {
NPC_DEVIS_ARTIS: 448
NPC_MOUBOO: 449
NPC_MONA: 450
+ NPC_CONFUSED_TREE: 451
+
NPC_TEST1: 800
NPC_PLAYER: 801
NPC_SAVE_POINT: 901
diff --git a/npc/008-1/_import.txt b/npc/008-1/_import.txt
index 38da1dae..b7797bf0 100644
--- a/npc/008-1/_import.txt
+++ b/npc/008-1/_import.txt
@@ -2,6 +2,7 @@
// This file is generated automatically. All manually added changes will be removed when running the Converter.
"npc/008-1/_mobs.txt",
"npc/008-1/_warps.txt",
+"npc/008-1/confused-tree.txt",
"npc/008-1/doors.txt",
"npc/008-1/mapflags.txt",
"npc/008-1/wateranimation.txt",
diff --git a/npc/008-1/confused-tree.txt b/npc/008-1/confused-tree.txt
new file mode 100644
index 00000000..ffbc1686
--- /dev/null
+++ b/npc/008-1/confused-tree.txt
@@ -0,0 +1,916 @@
+// Evol scripts.
+// Author:
+// gumi
+// Based on CrazyTree, originally made by:
+// gumi
+// pclouds
+// veryape
+// wushin
+// Description:
+// emulated confused tree prototype
+
+// ~t lowercase hot word regex
+
+008-1,84,63,0 script Confused Tree NPC_CONFUSED_TREE,14,14,{
+
+ function tree_panel {
+ if (is_trusted() == false && #Tree_Trusted == false)
+ {
+ narrator(l("You see a tree."));
+ if (getq(HurnscaldQuests_Inspector) == 2)
+ {
+ select(
+ l("Have you seen anything strange lately?"),
+ l("Do you know anything about the recent robberies?"));
+
+ narrator(1,
+ l("..."),
+ l("It doesn't reply."));
+ }
+ close;
+ }
+
+ function clear_db {
+ clear();
+ mes(l("##BWARNING:##b you are about to permanently empty the quote database."));
+ next();
+ mes(l("Do you want to continue?"));
+
+ select(
+ l("Abort!"),
+ l("Empty the quote DB"));
+
+ if (@menu == 2)
+ {
+ query_sql("TRUNCATE TABLE tree_quotes;");
+ mes(l("Database erased."));
+ next();
+ }
+
+ return;
+ }
+
+ function list_commands {
+ clear();
+ mes(l("To grab a quote:"));
+ mes(col(" ~grab ##Bplayer name##b", 7));
+ next();
+ mes(l("To get a quote:"));
+ mes(col(" ~quote anyone", 7));
+ mes(col(" ~quote ##Bplayer name##b", 7));
+ mes(col(" ~quote ##B#number##b", 7));
+ next();
+ mes(l("To remove a quote:"));
+ mes(col(" ~remove quote ##B#number##b", 7));
+ mes(col(" ~remove last quote", 7));
+ next();
+ mes(l("Last seen:"));
+ mes(col(" ~seen ##Bplayer name##b", 7));
+ next();
+ mes(l("To ignore a player:"));
+ mes(col(" ~ignore ##Bplayer name##b", 7));
+ next();
+ mes(l("To unignore a player:"));
+ mes(col(" ~unignore ##Bplayer name##b", 7));
+ next();
+
+ if (is_admin())
+ {
+ mes(l("To trust a player:"));
+ mes(col(" ~trust ##Bplayer name##b", 7));
+ next();
+ mes(l("To de-trust a player:"));
+ mes(col(" ~untrust ##Bplayer name##b", 7));
+ next();
+ }
+ return;
+ }
+
+ do
+ {
+ clear();
+ setnpcdialogtitle(l("Tree Control Panel"));
+ mes(l("Oh noes! You found my secret backdoor!"));
+ next();
+ mes(l("Please select an option:"));
+
+ select(
+ l("List the commands"),
+ rif(is_admin(), l("Empty the quote DB")),
+ l("Dance for me"));
+
+ switch (@menu)
+ {
+ case 1: list_commands(); break;
+ case 2: clear_db(); break;
+ default: speech(l("Too lazy.")); close;
+ }
+
+ } while (true);
+
+ end;
+ }
+
+ // utility functions below
+
+ function check_is_ignored {
+ .@val = htget(.ignore_ht, strcharinfo(PC_NAME), 0);
+
+ if (.@val > gettimetick(2))
+ {
+ ++.ignored_times;
+ end;
+ }
+
+ else if (.@val > 0)
+ {
+ htput(.ignore_ht, strcharinfo(PC_NAME), 0); // remove expired entries
+ }
+
+ return;
+ }
+
+ function special_name {
+ .@name$ = strcharinfo(PC_NAME);
+ .@low$ = strtolower(.@name$);
+
+ if (rand(.sname_rate) == 0)
+ {
+ for (.@i = 0; .@i < .alias; .@i += 2)
+ {
+ if (.@low$ ~= .alias$[.@i])
+ {
+ explode(.@aliases$, .alias$[.@i+1], "`");
+ .@name$ = .@aliases$[rand(getarraysize(.@aliases$))];
+ break;
+ }
+ }
+ }
+
+ return .@name$;
+ }
+
+ function face {
+ if (gettimetick(2) - .last_emote < .emote_rate)
+ {
+ ++.ignored_times;
+ end;
+ }
+
+ .last_emote = gettimetick(2);
+ emotion(getarg(0, E_SURPRISE));
+ }
+
+ function rp {
+ // used for queries
+ return replacestr(getarg(0,""), "~t", strtolower("(?:" + .name$ + "|" + .hotwords$ + ")"));
+ }
+
+ function format_reply {
+ // used for replies
+ .@str$ = getarg(0, "");
+
+ // search for {{mustaches}}
+ while (.@str$ ~= "{{([^}]+)}}")
+ {
+ .@sub$ = replacestr($@regexmatch$[1], " ", ""); // remove whitespaces
+ .@sub$ = strtolower(.@sub$); // always lowercase the var name
+ .@capitalize = .@titlecase = .@allcaps = false;
+
+ if (charat(.@sub$, 0) == "^")
+ {
+ .@capitalize = true;
+ .@sub$ = substr(.@sub$, 1, getstrlen(.@sub$) - 1); // strip first char
+ }
+
+ else if (charat(.@sub$, 0) == "+")
+ {
+ .@titlecase = true;
+ .@sub$ = substr(.@sub$, 1, getstrlen(.@sub$) - 1); // strip first char
+ }
+
+ else if (charat(.@sub$, 0) == "!")
+ {
+ .@allcaps = true;
+ .@sub$ = substr(.@sub$, 1, getstrlen(.@sub$) - 1); // strip first char
+ }
+
+ explode(.@sub2$, .@sub$, ",");
+ .@sub$ = .@sub2$[rand(getarraysize(.@sub2$))]; // allow to have multiple variables
+
+ .@rep$ = getd(sprintf(".D_%s$[%i]", .@sub$, rand(getd(".D_" + .@sub$)))); // get he value
+
+ if (.@capitalize) .@rep$ = capitalize(.@rep$);
+ else if (.@titlecase) .@rep$ = titlecase(.@rep$);
+ else if (.@allcaps) .@rep$ = strtoupper(.@rep$);
+
+ .@str$ = replacestr(.@str$, $@regexmatch$[0], .@rep$); // remove the mustache, replace by value
+ }
+
+ // search for emotes
+ if (.@str$ ~= "%%([^ ])")
+ {
+ // only handling a few of them
+ switch (ord($@regexmatch$[1]))
+ {
+ case 83: face(any(E_SAD, E_CRYING)); break;
+ case 85: face(E_SURPRISE); break;
+ case 93: face(any(E_HEARTEYE, E_HEART)); break;
+ case 94: face(E_DISGUST); break;
+ case 99: face(E_DEAD); break;
+ case 105: face(E_CRYING); break;
+ case 106:
+ case 91: face(any(E_SPEECH, E_BLAH)); break;
+ case 107: face(E_INSULTBUBBLE); break;
+ default: .@unhandled = true;
+ }
+
+ if (.@unhandled != true)
+ {
+ if (.@str$ == $@regexmatch$[0]) end; // don't send handled, emote-only messages
+ .@str$ = replacestr(.@str$, " "+ $@regexmatch$[0], ""); // otherwise strip the emote
+ }
+ }
+
+ // built-in variables
+ .@str$ = replacestr(.@str$, "~n", .name$); // npc name
+ .@str$ = replacestr(.@str$, "~p", special_name()); // player name or special name
+ .@str$ = replacestr(.@str$, "~P", strcharinfo(PC_NAME)); // unaltered player name
+
+ return rp(.@str$);
+ }
+
+ function strip_colors {
+ .@str$ = replacestr(getarg(0, ""), "##0", "");
+ .@str$ = replacestr(.@str$, "##1", "");
+ .@str$ = replacestr(.@str$, "##2", "");
+ .@str$ = replacestr(.@str$, "##3", "");
+ .@str$ = replacestr(.@str$, "##4", "");
+ .@str$ = replacestr(.@str$, "##5", "");
+ .@str$ = replacestr(.@str$, "##6", "");
+ .@str$ = replacestr(.@str$, "##7", "");
+ .@str$ = replacestr(.@str$, "##8", "");
+ .@str$ = replacestr(.@str$, "##9", "");
+ return replacestr(.@str$, "##a", "");
+ }
+
+ function strip_formatting {
+ .@str$ = strip_colors(getarg(0, ""));
+ .@str$ = replacestr(.@str$, "##B", "");
+ return replacestr(.@str$, "##b", "");
+ }
+
+ function delayed_reply {
+ ++.answered_times;
+ @tree_reply$ = getarg(0, "");
+ addtimer(.delay_reply, .name$ + "::OnDoReply");
+ return;
+ }
+
+ function reply {
+ .@reply$ = format_reply(getarg(0, ""));
+ getmapxy(.@pc_map$, .@pc_x, .@pc_y, UNITTYPE_PC); // get char location
+
+ if (((.@reply$ == .last_reply$ && gettimetick(2) - .last_reply < .repeat_rate)
+ || gettimetick(2) - .last_reply < .talk_rate
+ || (gettimetick(2) - .blocked < .block_time && is_trusted() == false)
+ || .@pc_map$ != .map$
+ || distance(.x, .y, .@pc_x, .@pc_y) > .distance
+ || .@reply$ == "")
+ && is_dev() == false)
+ {
+ ++.ignored_times;
+ end;
+ }
+
+ .last_reply = gettimetick(2);
+ .last_reply$= .@reply$;
+
+ delayed_reply(.@reply$);
+ return;
+ }
+
+ function seen_me {
+ if (playerattached() > 0)
+ {
+ htput(.seen_ht, strcharinfo(PC_NAME), gettimetick(2));
+ }
+ }
+
+ function have_you_seen {
+ .@player$ = getarg(0, "");
+ .@player = getcharid(CHAR_ID_ACCOUNT, .@player$);
+
+ if (.@player > 0)
+ {
+ // nested if, because they don't short-circuit
+ if (checkoption(Option_Invisible, .@player) == false) {
+ delayed_reply(sprintf("Player `%s` is currently online.", .@player$));
+ end;
+ }
+ }
+
+ .@time = htget(.seen_ht, .@player$, 0);
+
+ if (.@time < 1)
+ delayed_reply(sprintf("I haven't seen player `%s` today.", .@player$));
+
+ else
+ delayed_reply(sprintf("Player `%s` was last seen %s.", .@player$, FuzzyTime(.@time)));
+
+ end;
+ }
+
+ function special_drops {
+ .@drop$ = .drops$[rand(.drops)];
+ .@name$ = strcharinfo(PC_NAME);
+ .@low$ = strtolower(.@name$);
+
+ if (rand(.sdrop_rate) == 0)
+ {
+ for (.@i = 0; .@i < .sdrops; .@i += 2)
+ {
+ if (.@low$ ~= .sdrops$[.@i])
+ {
+ explode(.@d$, .sdrops$[.@i+1], "`");
+ .@drop$ = .@d$[rand(getarraysize(.@d$))];
+ break;
+ }
+ }
+ }
+
+ return .@drop$;
+ }
+
+ function roll_dice {
+ .@dices = max(min(getarg(0, 1), 8), 1); // 1..8
+ .@sides = max((getarg(1, 6) < 1 ? 6 : getarg(1, 6)), 1); // 1..MAX_INT
+
+ .@result$ = sprintf("*rolls the dice%s: %d",
+ rif(.@dices > 1, "s"), rand(1, .@sides)); // first dice
+
+ for (.@d = 1; .@d < .@dices; ++.@d)
+ {
+ .@result$ += ", " + rand(1, .@sides);
+ }
+
+ return .@result$ + ".*";
+ }
+
+ function flip_coin {
+ .@coins = getarg(0, 1);
+
+ .@result$ = sprintf("*flips the coin%s: %s",
+ rif(.@coins > 1, "s"), (rand(2) == 1 ? "heads" : "tails")); // first coin
+
+ for (.@c = 1; .@c < .@coins; ++.@c)
+ {
+ .@result$ += ", " + (rand(2) == 1 ? "heads" : "tails");
+ }
+
+ return .@result$ + ".*";
+ }
+
+ function roulette {
+ if (.roulette == 1)
+ {
+ npctalk("*pulls the trigger: *##BBANG##b*.*");
+ delayed_reply("*reloads and spins the chambers.*");
+ .roulette = rand(1, 7); // the Nagant_M1895 has 7 chambers
+
+ // now the fun part
+ nude();
+ percentheal(-100, 0);
+ }
+
+ else
+ {
+ delayed_reply("*pulls the trigger: *click*.*");
+ .roulette = (.roulette == 7 ? 1 : .roulette + 1);
+ }
+
+ end;
+ }
+
+ function monologue_player {
+ return sprintf("Your current monologue is at least %d line%s long.",
+ @monologue, rif(@monologue > 1, "s"));
+ }
+
+ function who_player {
+ return sprintf("You seem to be ##B~P##b [%i:%i].",
+ getcharid(CHAR_ID_ACCOUNT), getcharid(CHAR_ID_CHAR));
+ }
+
+ function make_quote_table {
+ // Do not modify this
+ return query_sql("CREATE TABLE IF NOT EXISTS `tree_quotes` ("
+ " `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,"
+ " `char_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',"
+ " `grabber` INT(11) UNSIGNED NOT NULL DEFAULT '0',"
+ " `timestamp` INT(10) UNSIGNED NOT NULL DEFAULT '0',"
+ " `message` VARCHAR(150) NOT NULL DEFAULT '',"
+ " PRIMARY KEY (`id`),"
+ " KEY `char_id` (`char_id`),"
+ " KEY `grabber` (`grabber`)"
+ ") ENGINE=MyISAM;");
+
+ .last_query = gettimetick(2);
+ }
+
+ function grab_quote {
+ .@name$ = getarg(0, "");
+
+ if (gettimetick(2) - .last_query < (is_trusted() ? .qpoll_rate : .qpoll_rate2))
+ {
+ ++.ignored_times;
+ end;
+ }
+
+ if (.@name$ == strcharinfo(PC_NAME))
+ {
+ delayed_reply("##BError: You may not grab yourself.");
+ end;
+ }
+
+ explode(.@tmp$[0], htget(.msg_ht, .@name$, ""), ":"); // get last message, if any
+ htput(.msg_ht, .@name$, ""); // ensure you can't grab twice the same message
+
+ .@char_id = atoi(.@tmp$[0]); // grab the char id part
+
+ if (.@char_id < 1)
+ {
+ delayed_reply(sprintf("##BError: I couldn't find anything to grab from player `%s`.", .@name$));
+ end;
+ }
+
+ .@msg$ = implode(.@tmp$, ":"); // put it back together
+ .@start = getstrlen(.@tmp$[0]) + getstrlen(.@tmp$[1]) + 2; // char:time:msg <= we just want the msg part
+ .@msg$ = escape_sql(strip_formatting(substr(.@msg$, .@start, getstrlen(.@msg$) - 1))); // sanitize
+
+ if (.@msg$ == "")
+ {
+ delayed_reply("##BError: Message is empty or malformed. It cannot be grabbed.");
+ end;
+ }
+
+ else if (.@msg$ ~= "^[!#~@]?(?:grab)?shield(?:ed)?(?:[:.!]? .*)?$")
+ {
+ delayed_reply("##BError: Message is shielded.");
+ end;
+ }
+
+ query_sql(sprintf("INSERT INTO tree_quotes (char_id,grabber,timestamp,message) VALUES (%i,%i,%i,'%s');",
+ .@char_id, getcharid(CHAR_ID_CHAR), gettimetick(2), .@msg$));
+
+ query_sql("SELECT MAX(id) FROM tree_quotes;", .q_last_id); // get the last quote id
+
+ .last_query = gettimetick(2);
+
+ delayed_reply(sprintf("Success: Quote grabbed. (#%i)", .q_last_id));
+ end;
+ }
+
+ function remove_quote {
+ .@tmp = getarg(0, 0);
+
+ if (gettimetick(2) - .last_query < (is_trusted() ? .qpoll_rate : .qpoll_rate2))
+ {
+ ++.ignored_times;
+ end;
+ }
+
+ query_sql(sprintf("SELECT id FROM tree_quotes WHERE id = %i ORDER BY id DESC LIMIT 1;", .@tmp), .@id); // check if it exists
+
+ if (.@id < 1)
+ {
+ delayed_reply(sprintf("##BError: I couldn't find quote #%i in the database.", .@tmp));
+ end;
+ }
+
+ query_sql(sprintf("DELETE FROM tree_quotes WHERE id = %i ORDER BY id DESC LIMIT 1;", .@id));
+
+ .last_query = gettimetick(2);
+
+ delayed_reply(sprintf("Success: Quote removed. (#%i)", .@id));
+ end;
+ }
+
+ function cite_quote {
+ .@id = getarg(0,0);
+
+ if (gettimetick(2) - .last_query < (is_trusted() ? .qpoll_rate : .qpoll_rate2))
+ {
+ ++.ignored_times;
+ end;
+ }
+
+ query_sql(sprintf("SELECT t.id, c.name AS grabee, d.name AS grabber, t.timestamp, t.message "
+ "FROM `tree_quotes` t "
+ "JOIN `char` c ON t.char_id = c.char_id "
+ "JOIN `char` d ON t.grabber = d.char_id "
+ "WHERE t.id=%i ORDER BY t.id DESC LIMIT 1;",
+ .@id),
+ .@nid[0], .@grabee$[0], .@grabber$[0], .@time[0], .@msg$[0]);
+
+ .last_query = gettimetick(2);
+
+ if (.@nid[0] < 1)
+ {
+ delayed_reply(sprintf("##BError: I couldn't find quote #%i in the database.", .@id));
+ end;
+ }
+
+ delayed_reply(sprintf("<%s> ##B%s##b ##a— grabbed by %s %s.",
+ .@grabee$[0], .@msg$[0], .@grabber$[0], FuzzyTime(.@time[0],0,1)));
+ end;
+ }
+
+ function random_quote {
+ .@name$ = escape_sql(getarg(0, ""));
+
+ if (gettimetick(2) - .last_query < (is_trusted() ? .qpoll_rate : .qpoll_rate2))
+ {
+ ++.ignored_times;
+ end;
+ }
+
+ query_sql("SELECT t.id, c.name AS grabee, d.name AS grabber, t.timestamp, t.message "
+ "FROM `char` c "
+ "JOIN `tree_quotes` t ON t.char_id = c.char_id "
+ "JOIN `char` d ON d.char_id = t.grabber " +
+ rif(.@name$ != "", sprintf("WHERE c.name='%s' ", .@name$)) +
+ "ORDER BY RAND() LIMIT 1;",
+ .@nid[0], .@grabee$[0], .@grabber$[0], .@time[0], .@msg$[0]);
+
+ .last_query = gettimetick(2);
+
+ if (.@nid[0] < 1)
+ {
+ if (.@name$ != "")
+ delayed_reply(sprintf("##BError: I couldn't find any quote from `%s` in the database.", getarg(0, "")));
+ else
+ delayed_reply("##BError: The quote database is empty.");
+ end;
+ }
+
+ delayed_reply(sprintf("<%s> ##B%s##b ##a— grabbed by %s %s. (#%i)",
+ .@grabee$[0], .@msg$[0], .@grabber$[0], FuzzyTime(.@time[0],0,1), .@nid[0]));
+ end;
+ }
+
+ function trigger_hotword {
+ .@o$ = getarg(0, ""); // original lowercase
+ .@m$ = replacestr(.@o$, "*", ""); // original lowercase clean
+
+
+ if (.@m$ ~= "(?:^| )tell(?: me)? a(?:n ?other| lame| bad| boring)? joke")
+ reply(.jokes$[rand(.jokes)]);
+
+ else if (.@m$ ~= "(?:^| )heal me(?:$|[^a-z])")
+ reply(.healing$[rand(.healing)]);
+ // XXX: maybe actually heal the player once in a while
+
+ else if (.@m$ ~= "(?:^| )(?:what|who) are you")
+ reply(.whoami$[rand(.whoami)]);
+
+ else if (.@m$ ~= rp("(?:^| )(?:hi+|hello|heya?|hiya|good (?:morning|afternoon))[^a-z]* .*~t|~t.* (?:hi+|hello|heya?|hiya)"))
+ {
+ .blocked = 0;
+ reply(.greetings$[rand(.greetings)]);
+ }
+
+ else if (.@o$ ~= rp("(?:^[*]| )(?:kicks?|shakes?) .*~t"))
+ reply(special_drops());
+
+ else if (.@o$ ~= rp("(?:^[*]| )(?:cuts?|nukes?|kills?|chops? down) .*~t"))
+ reply(.kill$[rand(.kill)]);
+
+ else if (.@o$ ~= rp("(?:^[*]| )pokes? .*~t"))
+ reply(.poke$[rand(.poke)]);
+
+ else if (.@o$ ~= rp("(?:^[*]| )(?:waters?|pees?|licks?) .*~t"))
+ reply(.disgusting$[rand(.disgusting)]);
+
+ else if (compare(.@m$, " answer ") && .@m$ ~= "(?:life|universe|everything)(?:$|[^a-z])")
+ reply(.answer$[rand(.answer)]);
+
+ else if (.@o$ ~= rp("(?:^[*]| )burns? .*~t"))
+ reply(.burning$[rand(.burning)]);
+ // XXX: maybe here send a fire particle effect
+
+ else if (.@m$ ~= rp("(?:^| )die ~t"))
+ reply(.die$[rand(.die)]);
+
+ else if (.@o$ ~= rp("(?:^[*]| )bites? .*~t|(?:^[*]| )drops? .* on ~t"))
+ reply(.silly$[rand(.silly)]);
+
+ else if (.@m$ ~= rp("(?:^| )(?:loves?|hugs?|kiss(es)?) .*~t|~t.* love(?:$|[^a-z])"))
+ reply(.love$[rand(.love)]);
+
+ else if (.@m$ ~= rp("(?:^| )dance .*~t|~t.* dance(?:$|[^a-z])"))
+ reply(.dance$[rand(.dance)]);
+
+ else if (.@m$ ~= rp("(?:^| )hates? .*~t"))
+ reply(.hate$[rand(.hate)]);
+
+ else if (.@o$ ~= rp("(?:^[*]| )(?:eats?|shoots?|plucks?|tortures?|slaps?|slaps?|poisons?|breaks?|stabs?|throws?) .*~t"))
+ reply(.pain$[rand(.pain)]);
+
+ else if (.@m$ ~= "(?:^| )(?:see y(?:a|ou)|good night|(?:bye)?bye+)(?:$|[^a-z])")
+ reply(.bye$[rand(.bye)]);
+
+ else if (.@m$ ~= rp("(?:^| )bad ~t"))
+ reply(.bad$[rand(.bad)]);
+
+ else if (.@m$ ~= "(?:^| )(?:how old are you|uptime)(?:$|[^a-z])")
+ reply("%%B Server uptime: " + FuzzyTime(.uptime, 1) + ".");
+
+ else if (.@m$ ~= "(?:^| )how chatty are you(?:$|[^a-z])")
+ reply("%%B Answered " + .answered_times + " times, ignored " + .ignored_times + " times.");
+
+ else if (.@m$ ~= "(?:^| )what.* version(?:$|[^a-z])")
+ reply("%%B ~n, version " + .version + "."); // XXX: maybe return Hercules version and serverdata commit instead
+
+ else if (.@m$ ~= "(?:^| )(?:(?:8|eight)[ -]?ball|do you|should i)(?:$|[^a-z])")
+ reply(.eightball$[rand(.eightball)]);
+
+ else if (.@m$ ~= "(?:^| )roll(?: a| the)? dice(?:$|[^a-z])")
+ reply(roll_dice(1, 6));
+
+ else if (.@m$ ~= "(?:^| )roll(?: a)? ([1-8])d((?:[1-9][0-9]{0,10})?)(?:$|[^0-9a-z])")
+ reply(roll_dice(atoi($@regexmatch$[1]), atoi($@regexmatch$[2])));
+
+ else if (.@m$ ~= "(?:^| )roll ([1-8]) dices?(?:$|[^a-z])")
+ reply(roll_dice(atoi($@regexmatch$[1]), 6));
+
+ else if (.@m$ ~= "(?:^| )(?:flip|toss)(?: a| the)? coin(?:$|[^a-z])")
+ reply(flip_coin(1));
+
+ else if (.@m$ ~= "(?:^| )(?:flip|toss) ([1-8]) coins?(?:$|[^a-z])")
+ reply(flip_coin(atoi($@regexmatch$[1])));
+
+ else if (.@m$ ~= "(?:^| )(?:press|pull)(?: the)? trigger(?:$|[^a-z])")
+ roulette();
+
+ else if (.@m$ ~= "(?:^| )(?:how long|what) is(?: my)? monologue(?:$|[^a-z])")
+ reply(monologue_player());
+
+ else if (.@m$ ~= "(?:^| )who am i(?:$|[^a-z])")
+ reply(who_player());
+
+ else if (.@m$ ~= "(?:^| )shut up(?:$|[^a-z])")
+ {
+ reply(.shut_up$[rand(.shut_up)]);
+ .blocked = gettimetick(2);
+ }
+
+ else if (rand(.dunno_rate) == 0)
+ reply(.no_idea$[rand(.no_idea)]);
+
+ else
+ ++.ignored_times;
+
+ end;
+ }
+
+ function trigger_hiall {
+ if (rand(.hiall_rate) == 0)
+ reply(.greetings$[rand(.greetings)]);
+
+ else
+ ++.ignored_times;
+
+ end;
+ }
+
+OnClick:
+ tree_panel();
+ bye;
+
+
+OnTalkNearby:
+ .@no_nick$ = strip(strip_formatting(substr($@p0$, getstrlen(strcharinfo(PC_NAME)) + 3, getstrlen($@p0$) - 1))); // not very obvious stuff
+ .@no_nick_lower$ = strtolower(.@no_nick$); // FIXME: hercules doesn't have a way to do case insensitive regex yet
+ .@no_nick_clean$ = replacestr(.@no_nick_lower$, "*", "");
+
+ htput(.msg_ht, strcharinfo(PC_NAME), getcharid(CHAR_ID_CHAR) + ":" + gettimetick(2) + ":" + .@no_nick$); // log last message, for quotegrabs
+ .lastsender = getcharid(CHAR_ID_CHAR); // for monologue
+
+ .last_activity = gettimetick(2); // for the auto-janitor
+
+ if ((is_trusted() || #Tree_Trusted) && charat(.@no_nick$, 0) == .symbol$)
+ {
+ if (.@no_nick$ ~= "^.grab \"?([^#:@\"]{4,23})\"?$")
+ reply(grab_quote($@regexmatch$[1]));
+
+ else if (.@no_nick$ ~= "^.(?:ungrab|remove|delete)(?: quote)? #([0-9]+)$")
+ reply(remove_quote(atoi($@regexmatch$[1])));
+
+ else if (.@no_nick$ ~= "^.(?:ungrab|remove|delete)(?: last(?: quote)?)?$")
+ reply(remove_quote(.q_last_id));
+
+ else if (.@no_nick$ ~= "^.(?:quote|cite) #([0-9]+)$")
+ reply(cite_quote(atoi($@regexmatch$[1])));
+
+ else if (.@no_nick$ ~= "^.(?:(?:random )?quote|cite)(?: anyone| someone| random)?$")
+ reply(random_quote());
+
+ else if (.@no_nick$ ~= "^.(?:quote|cite) \"?([^#:@\"]{4,23})\"?$")
+ reply(random_quote($@regexmatch$[1]));
+
+ else if (.@no_nick$ ~= "^.seen \"?([^#:@\"]{4,23})\"?$")
+ reply(have_you_seen($@regexmatch$[1]));
+
+ // to allow trusted testers to reboot without knowing the exit code
+ else if (debug && .@no_nick$ ~= "^.re(?:boot|load|start)(?:(?: the)? server)?$")
+ {
+ announce("The server is rebooting. This may take a couple minutes.", bc_all);
+ useatcmd("@serverexit 104");
+ }
+
+ // exit, pull all, clean, build, reboot
+ else if (debug && .@no_nick$ ~= "^.re-?build(?:(?: the)? server)?$")
+ {
+ announce("The server is rebuilding. This will take several minutes.", bc_all);
+ useatcmd("@serverexit 108");
+ }
+
+ else if (.@no_nick$ ~= "^.(?:add )?ignored? \"?([^#:@\"]{4,23})\"?$")
+ {
+ .@chr = getcharid(CHAR_ID_ACCOUNT, $@regexmatch$[1]);
+ if (.@chr < 1)
+ {
+ reply("##BError: Player not found or not online.");
+ end;
+ }
+ htput(.ignore_ht, strcharinfo(PC_NAME, .@chr), gettimetick(2) + 3600);
+ reply(sprintf("Success: Player `%s` is now ignored for 1 hour.",
+ strcharinfo(PC_NAME, .@chr)));
+ }
+
+ else if (.@no_nick$ ~= "^.(?:un|de-?|remove )ignored? \"?([^#:@\"]{4,23})\"?$")
+ {
+ .@chr = getcharid(CHAR_ID_ACCOUNT, $@regexmatch$[1]);
+ if (.@chr < 1)
+ {
+ reply("##BError: Player not found or not online.");
+ end;
+ }
+ htput(.ignore_ht, strcharinfo(PC_NAME, .@chr), 0);
+ reply(sprintf("Success: Player `%s` is no longer ignored.",
+ strcharinfo(PC_NAME, .@chr)));
+ }
+
+ else if (is_admin() && .@no_nick$ ~= "^.(?:add )?trust(?:ed)? \"?([^#:@\"]{4,23})\"?$")
+ {
+ .@chr = getcharid(CHAR_ID_ACCOUNT, $@regexmatch$[1]);
+ if (.@chr < 1)
+ {
+ reply("##BError: Player not found or not online.");
+ end;
+ }
+ set(getvariableofpc(#Tree_Trusted, .@chr), true);
+ reply(sprintf("Success: Player `%s` can now use restricted commands.",
+ strcharinfo(PC_NAME, .@chr)));
+ }
+
+ else if (is_admin() && .@no_nick$ ~= "^.(?:un|de-?|remove )trust(?:ed)? \"?([^#:@\"]{4,23})\"?$")
+ {
+ .@chr = getcharid(CHAR_ID_ACCOUNT, $@regexmatch$[1]);
+ if (.@chr < 1)
+ {
+ reply("##BError: Player not found or not online.");
+ end;
+ }
+ set(getvariableofpc(#Tree_Trusted, .@chr), false);
+ reply(sprintf("Success: Player `%s` can no longer use restricted commands.",
+ strcharinfo(PC_NAME, .@chr)));
+ }
+
+ else
+ reply("##BError: Command not found or invalid syntax.");
+ }
+
+ else if (.@no_nick_lower$ ~= rp("^(~t[^a-z ]* .*|(?:.* (?:~t[^a-z ]* .*|~t[^ a-z]*)))$"))
+ {
+ check_is_ignored();
+ trigger_hotword($@regexmatch$[1]);
+ }
+
+ else if (.@no_nick_clean$ ~= "^(hi(ya)?|hello|heya?) (all|friends|every(one|body))")
+ {
+ check_is_ignored();
+ trigger_hiall();
+ }
+
+ else
+ {
+ if (.lastsender == getcharid(CHAR_ID_CHAR))
+ @monologue++;
+
+ else
+ @monologue = 1;
+ }
+
+ // TODO: eliza mode, whisper eliza mode
+ end;
+
+OnTouch:
+ if (rand(.touch_rate) == 0) {
+ face();
+ }
+ end;
+
+OnDoReply:
+ if (@tree_reply$ != "") {
+ npctalk(@tree_reply$);
+ @tree_reply$ = "";
+ }
+ end;
+
+OnPCLogoutEvent:
+ seen_me();
+ end;
+
+OnTimer3600000:
+ // scheduled janitor
+ .@now = gettimetick(2);
+ initnpctimer(); // schedule next
+
+ if (.last_activity > (.@now - 3600)) {
+ end; // last activity is too recent
+ }
+
+ // cleanup routine below
+ .lastsender = 0;
+ .last_activity = 0;
+ .last_reply = 0;
+ .last_emote = 0;
+ .last_query = 0;
+ .blocked = 0;
+ .enable_janitor = 0;
+
+ htclear(.msg_ht); // empty the message table (quotegrabs)
+ htclear(.ignore_ht); // empty the ignore table
+
+ .@it = htiterator(.seen_ht); // allocate new iterator
+ for (.@key$ = htinextkey(.@it); hticheck(.@it); .@key$ = htinextkey(.@it)) {
+ if (.@key$ == "") {
+ continue;
+ }
+
+ if (htget(.seen_ht, .@key$, 0) < (.@now - 86400)) {
+ htput(.seen_ht, .@key$, 0); // remove from hash table if older than 24h
+ }
+ }
+ htidelete(.@it); // free the iterator
+
+ face(); // do an emote (because why not)
+ end;
+
+
+OnInit:
+ // config below
+ .hotwords$ = "tree"; // what hot words the npc should listen to, besides its own name (regex)
+ .distance = 14; // the npc will only listen to player within X tiles
+ .sex = G_OTHER; // gender of the npc
+ .talk_rate = 1; // min number of seconds to wait between replies
+ .repeat_rate = 1; // min number of seconds to wait before sending the same message twice in a row
+ .block_time = 600; // how long to stay quiet after someone says shut up, in seconds
+ .emote_rate = 3; // min number of seconds to wait between emotes
+ .sdrop_rate = 8; // 1 in X chances to get a special drop
+ .sname_rate = 8; // 1 in X chances to get a special name
+ .dunno_rate = 2; // 1 in X chances to get a reply when the command is not found
+ .hiall_rate = 2; // 1 in X chances to reply to a "hi everyone"
+ .touch_rate = 4; // 1 in X chances to trigger the OnTouch action
+ .qpoll_rate = 1; // min number of seconds to wait before calling the sql db again for GMs
+ .qpoll_rate2 = 5; // min number of seconds to wait before calling the sql db again for non-GMs (currently unused)
+ .delay_reply = 250; // number of ms to wait to reply
+ .enable_janitor = true; // automatically free memory when idle
+ .symbol$ = "~"; // symbol for GM-only commands
+
+ // register some arrays
+ callfunc("TREE_dictionaries");
+
+ // do random stuff
+ make_quote_table();
+ face();
+
+ // boring stuff below
+ .version = 20; // increase this when you make a change
+ .uptime = gettimetick(2);
+ .pid = 1; // regex pattern id
+ .msg_ht = htnew(); // hashtable id for message history
+ .seen_ht = htnew(); // hashtable id for seen log
+ .ignore_ht = htnew(); // hashtable id for ignored players
+ .roulette = rand(1, 7); // spin the chambers
+ defpattern(.pid, "^(.*)$", "OnTalkNearby");
+ activatepset(.pid);
+ if (.enable_janitor) {
+ initnpctimer();
+ }
+}
+
+// Duplicates below
+//000-1,42,63,0 duplicate(Confused Tree) Confused Palm Tree NPC_NO_SPRITE,14,14
diff --git a/npc/functions/confused-tree-dict.txt b/npc/functions/confused-tree-dict.txt
new file mode 100644
index 00000000..be9bf27d
--- /dev/null
+++ b/npc/functions/confused-tree-dict.txt
@@ -0,0 +1,544 @@
+// Evol scripts.
+// Author:
+// gumi
+// Based on CrazyTree, originally made by:
+// gumi
+// pclouds
+// veryape
+// wushin
+// Description:
+// dictionaries for confused tree
+
+// Built-in variables:
+// ~t lowercase hot word regex
+// ~n npc name
+// ~p player name or special name
+// ~P player name only
+//
+// Custom variables:
+// {{var}} random from array .D_var$
+// {{^var}} same but capitalize
+// {{+var}} same but title case
+// {{!var}} same but all caps
+// You can also specify multiple variables, separated by a comma (,)
+//
+// Example:
+// "*drops a {{! size }} {{ color }} {{^ sizeable object, someone }} on ~p's head*"
+
+function script TREE_dictionaries {
+ .npc$ = strnpcinfo(0);
+
+ // special aliases below (regex of lowercase char names)
+ // the substitutions are an array separated by backticks (`)
+ // XXX: this could become a hashtable at some point if it gets too big
+
+ setarray getvariableofnpc(.alias$[0], .npc$),
+ "^veryape(?:gm)?$", "hairyape",
+
+ "^wu-?shin$", "Dwarven Princess`"
+ "She-Ra",
+
+ "^reid$", "Borg Queen`"
+ "Mistress`"
+ "Milady`"
+ "R'eid",
+
+ "^(?:slicer|madcamel)$", "Camel Toe",
+
+ "^4144(?:4d494e)?$", "NPC",
+
+ "^omatt$", "@@https://youtu.be/S2qiZoqH9OY|omatt@@`"
+ "o'matt",
+
+ "^prsm$", "Refractor`"
+ "Overlord";
+ set getvariableofnpc(.alias, .npc$), getarraysize(getvariableofnpc(.alias$, .npc$));
+
+
+
+ // special drops below (regex of lowercase char names)
+ // the substitutions are an array of standard replies separated by backticks (`)
+ // and allow {{variables}}
+ // XXX: this could become a hashtable at some point if it gets too big
+
+ setarray getvariableofnpc(.sdrops$[0], .npc$),
+ "^reid$", "*drops an empty jar of Nutella on ~p*",
+ "^omatt$", "*drops Elisabeth Granneman on ~p*";
+ set getvariableofnpc(.sdrops, .npc$), getarraysize(getvariableofnpc(.sdrops$, .npc$));
+
+
+ // variables below
+
+ setarray getvariableofnpc(.D_size$[0], .npc$), // {{size}}
+ "tiny",
+ "small",
+ "perfectly sized",
+ "large",
+ "huge",
+ "humongous",
+ "ginormous";
+ set getvariableofnpc(.D_size, .npc$), getarraysize(getvariableofnpc(.D_size$, .npc$));
+
+ setarray getvariableofnpc(.D_color$[0], .npc$), // {{color}}
+ "red",
+ "orange",
+ "yellow",
+ "pink",
+ "aqua",
+ "cyan",
+ "blue",
+ "indigo",
+ "violet",
+ "purple",
+ "magenta",
+ "pink",
+ "black",
+ "white",
+ "grey",
+ "greyscale",
+ "brown",
+ "maroon",
+ "turquoise",
+ "lime",
+ "sky blue",
+ "invisible";
+ set getvariableofnpc(.D_color, .npc$), getarraysize(getvariableofnpc(.D_color$, .npc$));
+
+ setarray getvariableofnpc(.D_violentadverb$[0], .npc$), // {{violent adverb}}
+ "violently",
+ "repeatedly",
+ "casually",
+ "forcefully",
+ "slowly",
+ "carefully",
+ "hopefully",
+ "dangerously",
+ "shockingly",
+ "religiously";
+ set getvariableofnpc(.D_violentadverb, .npc$), getarraysize(getvariableofnpc(.D_violentadverb$, .npc$));
+
+ setarray getvariableofnpc(.D_hello$[0], .npc$), // {{hello}}
+ "hi",
+ "hi",
+ "hi",
+ "hi",
+ "hey",
+ "hey",
+ "hey",
+ "yo",
+ "yo",
+ "hello",
+ "hello",
+ "hello",
+ "hello",
+ "hello",
+ "hello",
+ "hello",
+ "hello",
+ "hello",
+ "hello",
+ "howdy",
+ "bonjour";
+ set getvariableofnpc(.D_hello, .npc$), getarraysize(getvariableofnpc(.D_hello$, .npc$));
+
+ setarray getvariableofnpc(.D_violentverb$[0], .npc$), // {{violent verb}}
+ "slaps",
+ "slaps",
+ "slaps",
+ "slaps",
+ "slaps", // yeah the tree likes to slap a lot
+ "hits",
+ "pummels",
+ "beats",
+ "flattens",
+ "taunts",
+ "liquidates",
+ "spanks",
+ "affronts",
+ "tranquilizes",
+ "atomizes",
+ "impales",
+ "dismembers";
+ set getvariableofnpc(.D_violentverb, .npc$), getarraysize(getvariableofnpc(.D_violentverb$, .npc$));
+
+ setarray getvariableofnpc(.D_location$[0], .npc$), // {{location}}
+ "Artis",
+ "Hurnscald",
+ "Tulimshar",
+ "Nivalis",
+ "Candor",
+ "Drasil";
+ set getvariableofnpc(.D_location, .npc$), getarraysize(getvariableofnpc(.D_location$, .npc$));
+
+ setarray getvariableofnpc(.D_sizeableobject$[0], .npc$), // {{sizeable object}}
+ "trout",
+ "whale",
+ "space whale",
+ "penguin",
+ "coelacanth",
+ "squid",
+ "shrimp",
+ "crab",
+ "tentacle",
+ "dictionary",
+ "grammar book",
+ "textbook",
+ "dinosaur",
+ "t-rex",
+ "star-nosed mole",
+ "chimpanzee",
+ "mermaid",
+ "merman",
+ "piano",
+ "princess",
+ "pinkie",
+ "squirrel",
+ "mouboo",
+ "wet mop",
+ "drunken pirate",
+ "cake",
+ "cookie",
+ "chocobo",
+ "restraining order",
+ "freight train",
+ "carnival hammer",
+ "crate",
+ "bomb",
+ "bowl of petinuas",
+ "box",
+ "platypus",
+ "magic eightball",
+ "vase";
+ set getvariableofnpc(.D_sizeableobject, .npc$), getarraysize(getvariableofnpc(.D_sizeableobject$, .npc$));
+
+ setarray getvariableofnpc(.D_nsizeableobject$[0], .npc$), // {{n sizeable object}}
+ "octopus",
+ "elephant",
+ "angry cat",
+ "anvil",
+ "encyclopedia set";
+ set getvariableofnpc(.D_nsizeableobject, .npc$), getarraysize(getvariableofnpc(.D_nsizeableobject$, .npc$));
+
+ setarray getvariableofnpc(.D_someone$[0], .npc$), // {{someone}}
+ "Voldemort",
+ "Cthulhu",
+ "Platyna",
+ "Hitler",
+ "Luvia",
+ "General Krukan",
+ "Borg Queen",
+ "Freeyorp",
+ "MadCamel";
+ set getvariableofnpc(.D_someone, .npc$), getarraysize(getvariableofnpc(.D_someone$, .npc$));
+
+ // replies below
+
+ setarray getvariableofnpc(.greetings$[0], .npc$),
+ "{{^ hello }} ~p!",
+ "{{^ hello }} ~p!",
+ "{{^ hello }} ~p!",
+ "{{^ hello }} ~p!",
+ "{{^ hello }} ~p.",
+ "{{^ hello }} ~p.",
+ "{{^ hello }} ~p.",
+ "{{^ hello }} ~p.",
+ "{{^ hello }} ~p.",
+ "{{^ hello }} ~p.",
+ "{{^ hello }} ~p, what's up?",
+ "{{^ hello }} ~p, anything new?",
+ "{{^ hello }} ~p, how are you?",
+ "~p!!!!",
+ "~p!!!",
+ "~p!!",
+ "{{^ hello }} ~p! You are looking lovely today!",
+ "Welcome back, ~p.",
+ "Welcome back, ~p.",
+ "Welcome back, ~p.",
+ "~p is back!!",
+ "Hello and welcome to the Aperture Science computer-aided enrichment center.",
+ "Greetings ~p.",
+ "What's up ~p?",
+ "What's up ~p?",
+ "How are you ~p?";
+ set getvariableofnpc(.greetings, .npc$), getarraysize(getvariableofnpc(.greetings$, .npc$));
+
+ setarray getvariableofnpc(.jokes$[0], .npc$),
+ "How did the tree get drunk? On root beer.",
+ "Do you think I'm lazy?",
+ "I miss CrazyTree %%S.",
+ "I miss LazyTree %%S.",
+ "I'm not telling you!",
+ "*sighs.*",
+ "If I do it for you, then I have to do it for everybody.",
+ "What did the beaver say to the tree? It's been nice gnawing you.",
+ "What did the little tree say to the big tree? Leaf me alone.",
+ "What did the tree wear to the pool party? Swimming trunks.",
+ "What do trees give to their dogs? Treets.",
+ "What do you call a tree that only eats meat? Carniforous.",
+ "What do you call a tree who's always envious? Evergreen.",
+ "What is the tree's least favourite month? Sep-timber!",
+ "What kind of tree can fit into your hand? A palm-tree.",
+ "What was the tree's favorite subject in school? Chemistree.",
+ "Why did the leaf go to the doctor? It was feeling green.",
+ "Why doesn't the tree need sudo? Because it has root.",
+ "Why was the cat afraid of the tree? Because of its bark.",
+ "Why was the tree executed? For treeson.",
+ "How do trees get on the internet? They log in.",
+ "Why did the pine tree get into trouble? Because it was being knotty.",
+ "Did you hear the one about the oak tree? It's a corn-y one!",
+ "What do you call a blonde in a tree with a briefcase? Branch Manager.",
+ "How is an apple like a lawyer? They both look good hanging from a tree.",
+ "Why did the sheriff arrest the tree? Because its leaves rustled.",
+ "I'm too tired, ask someone else.",
+ "If you are trying to get me to tell jokes you are barking up the wrong tree!",
+ "You wooden think they were funny anyhow. Leaf me alone!",
+ "What is brown and sticky? A stick.",
+ "What's the best way to carve wood? Whittle by whittle.",
+ "What did the tree do when the bank closed? It started its own branch.",
+ "Do you want a brief explanation of an acorn? In a nutshell, it’s an oak tree.",
+ "A snare drum and a crash cymbal fell out of a tree. *BA-DUM TSSSHH*",
+ "How do you properly identify a dogwood tree? By the bark!",
+ "Where do saplings go to learn? Elementree school.",
+ "Why do trees make great thieves? Sticky fingers.",
+ "What is green, has leaves, and a trunk? A houseplant going on vacation.",
+ "Where can Adansonia trees go for a quick trim? To the baobarber.",
+ "What looks like half a spruce tree? The other half.",
+ "What do you give to a sick citrus tree? Lemon aid.",
+ "What did the tree say to the drill? You bore me.",
+ "What happened to the wooden car with wooden wheels and a wooden engine? It wooden go.",
+ "How do trees keep you in suspense? I'll tell you tomorrow.",
+ "Where do birch trees keep their valuables? In a river bank.",
+ "What kind of stories do giant sequoia trees tell? Tall tales.",
+ "What is the most frustrating thing about being a tree? Having so many limbs and not being able to walk.",
+ "What's black, highly dangerous, and lives in a tree? A crow with a machine gun.",
+ "What kind of wood doesn't float? Natalie Wood.";
+ set getvariableofnpc(.jokes, .npc$), getarraysize(getvariableofnpc(.jokes$, .npc$));
+
+ setarray getvariableofnpc(.healing$[0], .npc$),
+ "Eat an apple, they're good for you.",
+ "If I do it for you, then I have to do it for everybody.",
+ "Oh, go drink a potion or something.",
+ "Whoops! I lost my spellbook.",
+ "No mana.";
+ set getvariableofnpc(.healing, .npc$), getarraysize(getvariableofnpc(.healing$, .npc$));
+
+ setarray getvariableofnpc(.whoami$[0], .npc$),
+ "An undercover GM.",
+ "An exiled GM.",
+ "I'm not telling you!",
+ "I'm a bot! I'll be level 99 one day! Mwahahahaaha!!!111!",
+ "Somebody said I'm a Chinese copy of CrazyTree.",
+ "I am your evil twin.",
+ "I don't remember anything after I woke up! What happened to me?",
+ "I don't know. Why am I here??",
+ "Who are you?",
+ "On the 8th day, God was bored and said 'There will be bots'. So here I am.",
+ "♪ I'm your hell, I'm your dream, I'm nothing in between ♪♪",
+ "♪♪ Aperture Science. We do what we must, because... we can ♪",
+ "I'm just a reincarnation of a copy.";
+ set getvariableofnpc(.whoami, .npc$), getarraysize(getvariableofnpc(.whoami$, .npc$));
+
+ setarray getvariableofnpc(.drops$[0], .npc$),
+ "*drops a {{ sizeable object }} on ~p's head.*",
+ "*drops a {{ sizeable object }} on ~p's head.*",
+ "*drops a {{ sizeable object }} on ~p's head.*",
+ "*drops a {{ sizeable object }} on ~p's head.*",
+ "*drops a {{ sizeable object }} on ~p's head.*",
+ "*drops a {{ sizeable object }} on ~p's head.*",
+ "*drops a {{ sizeable object }} on ~p's head.*",
+ "*drops a {{ sizeable object }} on ~p's head.*",
+ "*drops an {{ n sizeable object }} on ~p's head.*",
+ "*drops an {{ n sizeable object }} on ~p's head.*",
+ "*drops {{ someone }} on ~p's head.*",
+ "*drops a coin on ~p's head.*",
+ "*drops a fruit on ~p's head.*",
+ "*drops an apple on ~p's head.*",
+ "*drops an iten on ~p's head.*",
+ "*drops a GM on ~p.*",
+ "*drops a piece of moon rock on ~p's head.*",
+ "*drops a pin on ~p's head.*",
+ "*drops a rock on ~p's head.*",
+ "*drops a tub of paint on ~p's head.*",
+ "*drops a sandworm on ~p.*",
+ "*drops an idea in ~p's head.*",
+ "*drops The Hitchhiker's Guide to the Galaxy on ~p's head.*",
+ "Ouch.",
+ "Ouchy.",
+ "*drops dead.*",
+ "*sighs.*",
+ "Leaf me alone.",
+ "Stop it! I doesn't drop branches, try the Druid tree for once!";
+ set getvariableofnpc(.drops, .npc$), getarraysize(getvariableofnpc(.drops$, .npc$));
+
+ setarray getvariableofnpc(.die$[0], .npc$),
+ "*drops an iten on ~p's head.*",
+ "*drops a piece of moon rock on ~p's head.*",
+ "*drops {{ someone }} on ~p's head.*",
+ "*drops a {{ sizeable object }} on ~p's head.*",
+ "*drops a {{ sizeable object }} on ~p's head.*",
+ "*drops a {{ sizeable object }} on ~p's head.*",
+ "*drops an {{ n sizeable object }} on ~p's head.*",
+ "*drops a {{ size }} {{ sizeable object, n sizeable object }} on ~p's head.*",
+ "*drops a {{ size }} {{ color }} {{ sizeable object, n sizeable object }} on ~p's head.*",
+ "*{{ violent adverb }} {{ violent verb }} ~p.*",
+ "*drops dead.*",
+ "*sighs.*",
+ "Avada Kedavra!",
+ "Make me!",
+ "Never!!",
+ "You die, ~p!",
+ "You die, ~p!",
+ "You die, ~p!",
+ "You die, ~p!",
+ "No!",
+ "In a minute.",
+ "Suuure... I'll get right on it...";
+ set getvariableofnpc(.die, .npc$), getarraysize(getvariableofnpc(.die$, .npc$));
+
+ setarray getvariableofnpc(.poke$[0], .npc$),
+ "*tickles.*";
+ set getvariableofnpc(.poke, .npc$), getarraysize(getvariableofnpc(.poke$, .npc$));
+
+ setarray getvariableofnpc(.disgusting$[0], .npc$),
+ "Ewwwww %%^.";
+ set getvariableofnpc(.disgusting, .npc$), getarraysize(getvariableofnpc(.disgusting$, .npc$));
+
+ setarray getvariableofnpc(.answer$[0], .npc$),
+ "42.",
+ "Kittens.";
+ set getvariableofnpc(.answer, .npc$), getarraysize(getvariableofnpc(.answer$, .npc$));
+
+ setarray getvariableofnpc(.burning$[0], .npc$),
+ "*curses ~p and dies %%c.*",
+ "Help! I'm on fire!",
+ "Oh hot.. hot hot!",
+ "*is glowing.*",
+ "*is flaming.*",
+ "Ehemm. Where are firefighters? I need them now!",
+ "*is so hot!.*";
+ set getvariableofnpc(.burning, .npc$), getarraysize(getvariableofnpc(.burning$, .npc$));
+
+ setarray getvariableofnpc(.kill$[0], .npc$),
+ "*curses ~p and dies %%c.*";
+ set getvariableofnpc(.kill, .npc$), getarraysize(getvariableofnpc(.kill$, .npc$));
+
+ setarray getvariableofnpc(.silly$[0], .npc$),
+ "Hahaha, good one!";
+ set getvariableofnpc(.silly, .npc$), getarraysize(getvariableofnpc(.silly$, .npc$));
+
+ setarray getvariableofnpc(.love$[0], .npc$),
+ "♪♪ and IIII.. will alwayyyys loooovvve youuuuu. ♪♪ %%]",
+ "♪♪ nothing's gonna change my love for you, you oughta know by now how much I love you.. ♪ %%]",
+ "♪ ..and then I go and spoil it all, by saying something stupid like: \"I love you.\" ♪",
+ "♪ ..won't you find a place for me? somewhere in your heart... ♪♪",
+ "Thank you.",
+ "♪♪ ..I can't love another when my heart is somewhere far away.. ♪",
+ "%%]";
+ set getvariableofnpc(.love, .npc$), getarraysize(getvariableofnpc(.love$, .npc$));
+
+ setarray getvariableofnpc(.dance$[0], .npc$),
+ "I would but I am rooted to the ground.",
+ "Have you ever seen a tree dance before?",
+ "Hahaha, good one!";
+ set getvariableofnpc(.dance, .npc$), getarraysize(getvariableofnpc(.dance$, .npc$));
+
+ setarray getvariableofnpc(.hate$[0], .npc$),
+ "Right back at you!",
+ "Ok...",
+ "*pats ~p, let it go...*",
+ "Hu hu hu, ~p hates me.";
+ set getvariableofnpc(.hate, .npc$), getarraysize(getvariableofnpc(.hate$, .npc$));
+
+ setarray getvariableofnpc(.bye$[0], .npc$),
+ "*waves goodbye to ~p in tears, come back soon!*";
+ set getvariableofnpc(.bye, .npc$), getarraysize(getvariableofnpc(.bye$, .npc$));
+
+ setarray getvariableofnpc(.pain$[0], .npc$),
+ "Ouch.",
+ "Ouchy.",
+ "Argh.",
+ "Eek.",
+ "*howls.*",
+ "*screams.*",
+ "*groans.*",
+ "*cries.*",
+ "*faints.*",
+ "%%k",
+ "Why, what did I do to you? %%i";
+ set getvariableofnpc(.pain, .npc$), getarraysize(getvariableofnpc(.pain$, .npc$));
+
+ setarray getvariableofnpc(.eightball$[0], .npc$),
+ "It is possible.",
+ "Yes!",
+ "Of course.",
+ "Naturally.",
+ "Obviously.",
+ "It shall be.",
+ "The outlook is good.",
+ "It is so.",
+ "One would be wise to think so.",
+ "The answer is certainly yes.",
+ "In your dreams.",
+ "I doubt it very much.",
+ "No chance.",
+ "The outlook is very poor.",
+ "Unlikely.",
+ "About as likely as pigs flying.",
+ "You're kidding, right?",
+ "NO!",
+ "NO.",
+ "No.",
+ "Maybe...",
+ "No clue.",
+ "I don't know.",
+ "The outlook is hazy, please ask again later.",
+ "What are you asking me for?",
+ "Come again?",
+ "You know the answer better than I.",
+ "The answer is def-- oooh! shiny thing!",
+ "No idea.",
+ "Perhaps.",
+ "I think it is better not to tell you.",
+ "Error 417: Expectation failed.";
+ set getvariableofnpc(.eightball, .npc$), getarraysize(getvariableofnpc(.eightball$, .npc$));
+
+ setarray getvariableofnpc(.bad$[0], .npc$),
+ "I'm not bad! You are bad!",
+ "OK, I'm bad.",
+ "I'm just a littttle bad.",
+ "Not as bad as the people that made me.";
+ set getvariableofnpc(.bad, .npc$), getarraysize(getvariableofnpc(.bad$, .npc$));
+
+ setarray getvariableofnpc(.no_idea$[0], .npc$),
+ "What?",
+ "What??",
+ "What?",
+ "Whatever.",
+ "Hmm...",
+ "Hmm...",
+ "Huh?",
+ "*yawns.*",
+ "Wait a minute...",
+ "What are you talking about?",
+ "Who are you?",
+ "What about me?",
+ "I don't know what you are talking about",
+ "Excuse me?",
+ "Very interesting.",
+ "Really?",
+ "Go on...",
+ "*scratches its leafy head.*",
+ "*feels a disturbance in the force.*",
+ "%%j",
+ "*senses a disturbance in the force.*",
+ "I'm bored...",
+ "%%U",
+ "%%[";
+ set getvariableofnpc(.no_idea, .npc$), getarraysize(getvariableofnpc(.no_idea$, .npc$));
+
+ setarray getvariableofnpc(.shut_up$[0], .npc$),
+ "*goes hide in a corner %%S.*";
+ set getvariableofnpc(.shut_up, .npc$), getarraysize(getvariableofnpc(.shut_up$, .npc$));
+
+ return;
+}
diff --git a/npc/scripts.conf b/npc/scripts.conf
index 2ffd8cb6..3c5bc7cf 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -45,6 +45,7 @@
"npc/functions/game-rules.txt",
"npc/functions/riddle.txt",
"npc/functions/bank.txt",
+"npc/functions/confused-tree-dict.txt",
// quest debug
"npc/functions/quest-debug/functions.txt",