Question about triggers/variables

Posted by Penguin on Tue 17 Jun 2003 11:03 AM — 6 posts, 22,910 views.

#0
Hi,

I wish to set up a trigger to set a variable as something. On the mud it looks something like this:

Someone invited you to join his(or her) party.

So I set a trigger like
^(.*?) invited you to join (his|her) party\.?

And a script with

world.setvariable "partyinviter", arrwildcards (1)

Seems simple enough? Unfortunately life's a bitch. And I have prompts which show my HP/EP which appear sometimes.
Ex.

HP:230 EP:230 Someone invited you to joins his party.

How then would I be able to set my partyinviter variable as "Someone" instead of "230"?
USA #1
Common issue. I was able to fix it by adding a newline to the end of all prompts. I later had to find out from a admin that there was also a hidden command to remove the extra space it insisted on adding to the end of the prompt, even when it finished on a new line, but.... lol

However, assuming you can't do that then I would suggest this:

^(\S*\s\S*\s)?(.+?) invited you to join (his|her) party\.?

and

world.setvariable "partyinviter", arrwildcards(2)

Using \S means it will match no matter the character used, unless it is a space. \s is the opposite.
USA #2
Shadowfyr, (this is a bit offtopic for the thread, but anyway) what command removes the extra space? Ive found it easier to just add the newline too, and I just gagged lines that were JUST a space (the extra prompt line) but then had to add a optional space at the beginning of all/most of my triggers, which is rather annoying. So, whats the command? Maybe itll work on my mud too.
USA #3
Depends on you mud. For mine it was '$_' or '_$', I think... It has been some time since I changed my prompt to use it. Some muds may not have any way to do it. This is with MUDOS and the TMI-2 library, so it is a guess as to if any others use the same syntax.
USA #4
You can also set it up as a regular expression. that ignores the prompt completely.
Greece #5
That already IS a regular expression. The simplest thing you could do is remove the ^ from the beginnging. That way it'll match anything before it.