From 753f7b7d30d356eccfcb999c76a28f7ee0692055 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sun, 27 Jun 2021 14:35:56 -0300 Subject: Rewrite catalazuli scripts, drop the formely mandatory preceding hashtag. Using the hash will cause catalazuli to NOT WORK. --- npc/052-1/channelling.txt | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/npc/052-1/channelling.txt b/npc/052-1/channelling.txt index e3c6097d..143a1225 100644 --- a/npc/052-1/channelling.txt +++ b/npc/052-1/channelling.txt @@ -62,7 +62,7 @@ OnCommandDestroy: next; mes "Below this strange writing, you notice a word still deeply engraved in the stone:"; next; - mes "\"#catalazuli\""; + mesq b("catalazuli"); next; mes "... that looks like an incantation or something."; if ($@illia_level_4_progress == 0) @@ -76,11 +76,10 @@ L_SuggestChannelling: mes "Let's see how I can activate it..."; mes "But I should probably get inside it, first."; close; - } function script StartChannelling { - if (isat("052-1",53,38) == 0) + if (isat("052-1", 53, 38) == 0) goto L_Return; if ($@illia_level_4_progress > 0) goto L_Return; @@ -126,10 +125,6 @@ L_Return: goto L_Hint; end; -OnCast: - callfunc "StartChannelling"; - end; - OnCommandSt: initnpctimer; end; @@ -319,6 +314,26 @@ L_ShouldNotBeHere: end; OnInit: - registercmd "#catalazuli", strnpcinfo(0)+"::OnCast"; + // In theory, pattern ID must be between 1~9 + // To set $@p1$~$@p9$ with the PERL expression + // But as we're only using $@p0$ (full string) + // the value itself is meaningless + .pid=getnpcid(); + debugmes "Catalazuli: Pattern %d", .pid; + //I'm not going to learn PERL just for that + defpattern(.pid, "^(.*)$", "OnTalkNearby"); + activatepset(.pid); + end; + +OnTalkNearby: + // not very obvious stuff by gumi, $@p0$ contains the whole string + // so we must cut it. Could use $@p1$ if perl was proper but... meh. + .@no_nick$ = strip(substr($@p0$, getstrlen(strcharinfo(PC_NAME)) + 3, getstrlen($@p0$) - 1)); + .@message$ = strtoupper(.@no_nick$); + + // Only react if the message is what we want to hear + if (.@message$ == "CATALAZULI") { + StartChannelling(); + } end; } -- cgit v1.2.3-60-g2f50