Updated Perl EVENT_SAY (markdown)

TurmoilToad
2018-01-16 23:40:06 -05:00
parent a15622ccb9
commit d380148ed8
+33
@@ -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