How do I use the prompt as a trigger?

Skriptz
Posts: 45
Joined: Sun Dec 27, 2009 10:48 pm

How do I use the prompt as a trigger?

Post by Skriptz »

Okay I have read a bit on using the prompt as a trigger for balances. My question is how do I do it for Aetolia? I seen it with Lusternia and I tried to do the same but there are differences.

Okay my prompt looks like this
H:2255 M:2923 E:90% W:100% XP:81% [sdb@ eb]
My code for the trigger I'm trying to use is this under the perl regex option
Code: [show] | [select all] lua
^H:(\d+) M:(\d+) E:\d+% W:\d+% XP:\d+% ([cspdba@]*) ([eb-]+)
What am I doing wrong? Everything works if I cut out the balances
Code: [show] | [select all] lua
^H:(\d+) M:(\d+) E:\d+% W:\d+% XP:\d+%
so something must be wrong with the last section.

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: How do I use the prompt as a trigger?

Post by tsuujin »

Code: [show] | [select all] lua
H:(\d+) M:(\d+) E:(\d+)% W:(\d+)% XP:(\d+)% \[.+\]

Skriptz
Posts: 45
Joined: Sun Dec 27, 2009 10:48 pm

Re: How do I use the prompt as a trigger?

Post by Skriptz »

tsuujin wrote:
Code: [show] | [select all] lua
H:(\d+) M:(\d+) E:(\d+)% W:(\d+)% XP:(\d+)% \[.+\]
Your last section "[.+\]" will mean I can't use it to trigger balance right?

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: How do I use the prompt as a trigger?

Post by tsuujin »

just enclose it in parenthesis

Skriptz
Posts: 45
Joined: Sun Dec 27, 2009 10:48 pm

Re: How do I use the prompt as a trigger?

Post by Skriptz »

Okay your example works but it's just the same as just removing it. I tried putting the balances in but it still doesn't work. What was the period for in your example?

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: How do I use the prompt as a trigger?

Post by Vadi »

if your mud supports GA (ie, the N: bottom-right is a number), then a lua function pattern type of return isPrompt() works as well.

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: How do I use the prompt as a trigger?

Post by tsuujin »

Code: [show] | [select all] lua
H:(\d+) M:(\d+) E:(\d+)% W:(\d+)% XP:(\d+)% \[(.*) (.*)\]
I don't know if it'll work or not, because I don't know what the prompt looks like in all states, but it should put the balances in matches[8]

Skriptz
Posts: 45
Joined: Sun Dec 27, 2009 10:48 pm

Re: How do I use the prompt as a trigger?

Post by Skriptz »

Vadi wrote:if your mud supports GA (ie, the N: bottom-right is a number), then a lua function pattern type of return isPrompt() works as well.
Okay cool. How would I use the isPrompt function to trigger my balances? Is it even possible?

I'm trying to do your example which can be found Imperian Forums

But I'm trying to get the last bit to work with all the vital balances and conditions such as prone, blind, deaf etc. I think the extra [ ] is screwing it up.

Knute
Posts: 87
Joined: Fri Mar 05, 2010 12:08 am

Re: How do I use the prompt as a trigger?

Post by Knute »

I would try something like:
Code: [show] | [select all] lua
^H:(\d+) M:(\d+) E:(\d+)% W:(\d+)% XP:(\d+)% \[(.*)\]
Then you would set up your functions to parse matches[7] for your balances and afflictions and such. Since the . represents all characters, it will take into account the space, so it's not an issue, and avoids some weirdness when you have two (.*) patterns in a trigger.

HTH

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: How do I use the prompt as a trigger?

Post by tsuujin »

Knute wrote:I would try something like:
Code: [show] | [select all] lua
^H:(\d+) M:(\d+) E:(\d+)% W:(\d+)% XP:(\d+)% \[(.*)\]
Then you would set up your functions to parse matches[7] for your balances and afflictions and such. Since the . represents all characters, it will take into account the space, so it's not an issue, and avoids some weirdness when you have two (.*) patterns in a trigger.

HTH
yeah, but he didn't seem to like that, so I separated it.

Post Reply