From d380148ed88d54bd1a5351b150cfc5fd1e8b8b2f Mon Sep 17 00:00:00 2001 From: TurmoilToad Date: Tue, 16 Jan 2018 23:40:06 -0500 Subject: [PATCH] Updated Perl EVENT_SAY (markdown) --- Perl-EVENT_SAY.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Perl-EVENT_SAY.md b/Perl-EVENT_SAY.md index 5577bdd..acc7769 100755 --- a/Perl-EVENT_SAY.md +++ b/Perl-EVENT_SAY.md @@ -14,4 +14,37 @@ sub EVENT_SAY { } ``` +### Triggered + +* When a PC targets and speaks to an NPC. + +### Examples + +* This example is a response to a "hail" + +```perl +sub EVENT_SAY { + #::: Checks if the text is like "Hail", the "i" is for case-insensitive. + if ($text=~/Hail/i) { + quest::say("Hello, $name!"); + } +} +``` + +* This example additionally checks the language of the "hail", and will only respond to text in that language. + +```perl +sub EVENT_SAY { + #::: Checks to see if the language is Thieves Cant (language ID 10) + if ($langid == 10) { + #::: Checks if the text is like "Hail", the "i" is for case-insensitive. + if ($text=~/Hail/i) { + # Respond, using the same language + quest::say("Hello, $name!",10); + } + } +} +``` + + Generated On 2018-01-15T22:07:30-08:00 \ No newline at end of file