Page 1 of 1

Multi Line Triggers

Posted: Thu Apr 25, 2013 5:29 pm
by Jor'Mox
Is there any way to programatically set a trigger to be a multi line trigger? Or is that something that has to be done manually?

Specifically, I'm trying to make a function that reads in the prompt format and generates a trigger to capture the information from that prompt. Many of the people using my scripts have widely varying prompts, and a good number of them have prompts that are several lines long. So far, I have just created custom triggers for each person, but it would be nice to be able to just make the trigger and have it work right away, instead of requiring the person to go in and check the box and set the correct number of lines once the trigger is made.

Thanks.

Re: Multi Line Triggers

Posted: Thu Apr 25, 2013 8:55 pm
by Jor'Mox
Also, while I have had success with using the "permAlias" function, I have been unable to make "permRegexTrigger" and "permSubstringTrigger" create triggers with the names that I give them. They both create a trigger that is given a number for a name, I assume the number is how many triggers I had plus one.

Is there a way to get around this problem currently? And is this a known issue that is being resolved?

Thanks again.

Re: Multi Line Triggers

Posted: Thu Apr 25, 2013 9:27 pm
by Vadi
There is tempComplexRegexTrigger() - described in http://forums.mudlet.org/viewtopic.php? ... 388#p10604. It takes in only one pattern though afaik.

This hasn't come up as a problem in my own scripting and I haven't heard anyone else raise this. You can do your data capture in Lua - if you're playing a GA-enabled MUD, prompt matching isn't an issue with the "return isPrompt()" lua function type.

Re: Multi Line Triggers

Posted: Thu Apr 25, 2013 9:48 pm
by Jor'Mox
This mud is not GA-enabled, so prompts have to be detected manually. Also, as prompt formats don't change frequently, forcing people to recreate their prompt trigger every session, as would be needed with a temp trigger seems excessive.

Also, much of my code seems to be used piecemeal, instead of all together, so I have a place where I post the code itself and instructions for installation. Being able to create in code all the triggers and aliases I need for a given script would significantly reduce installation complexity and resulting errors.

If the function calls themselves need to be fixed (as opposed to me doing something wrong) is there a way to change the name of a function after it is created (other than manually, obviously)?

The function call itself seems pretty straight forward, all I have is this:
Code: [show] | [select all] lua
permRegexTrigger("PromptTrigger", "", pattern, code)
Pattern and code are being set elsewhere, and are being added correctly. But instead of "PromptTrigger" being created, I got "37".

Re: Multi Line Triggers

Posted: Thu Apr 25, 2013 10:18 pm
by Vadi
The naming bug with permRegexTrigger is known, that's not intended. You could use a tempRegexTrigger however with a similar effect, just have the code recreate them at start. Creating thousands of triggers is something my system does at start and it's not an issue.

Re: Multi Line Triggers

Posted: Tue Apr 30, 2013 7:11 am
by Vadi
Oh, having actually read tempComplexRegexTrigger()s description, it can make multiple-pattern triggers for you.