 |
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Mon Apr 16, 2007 6:33 pm
Need help |
I have a trigger that updates variables and executes certain actions based off of the prompt
The prompt is ^(\d+)h\, (\d+)m (.*)\-
The problem is it isn't updating until a system message comes through even if the value changes. For example, if my mana gets below a certain amount then I should drink mana. Lets say my max mana is 900 and anything below 700 should cause me to drink mana. Well it doesn't do that even when the prompt is showing 500 mana and the variable is showing 500 mana UNTIL it is updated by the game itself and not something I did. I don't understand it. Why is it doing this? If I go offline and then test it from the command line it works fine. It's just once I am online it acts like the prompt doesn't exist until a system message updates it. |
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Apr 16, 2007 9:26 pm |
What are the trigger options set to? If it's set to trigger on newline (which is the default), the trigger doesn't fire until a newline character either comes from the mud or is issued by the player (by sending a game command to the mud or executing a cmud command/alias from the command-line or via script.)
|
|
_________________ EDIT: I didn't like my old signature |
|
|
 |
Tech GURU

Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Mon Apr 16, 2007 9:31 pm |
In order to help you need to post your current trigger, both the pattern to match and the code that runs it.
|
|
_________________ Asati di tempari! |
|
|
 |
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Mon Apr 16, 2007 9:51 pm |
MattLofton wrote: |
What are the trigger options set to? If it's set to trigger on newline (which is the default), the trigger doesn't fire until a newline character either comes from the mud or is issued by the player (by sending a game command to the mud or executing a cmud command/alias from the command-line or via script.) |
That's not working either. It just works in a sporadic fashion.
The trigger updates my mana and health variables and if they are below a certain amount will sip health and mana.
The pattern is this: 920h, 920m efi -
Trigger: ^(\d+)h\, (\d+)m (.*)\-*
Value:
health=%1
mana=%2
#local $flags
$flags=%3
#if (%pos( e, $flags)) {Equilibrium=1} {Equilibrium=0}
#if (%pos( y, $flags)) {RightBal=0} {RightBal=1}
#if (%pos( z, $flags)) {LeftBal=0} {LeftBal=1}
#if (%pos( p, $flags)) {HMbal=0} {HMbal=1}
#if (%pos( i, $flags)) {immundef=1} {immundef=0}
#if (%pos( f, $flags)) {firedef=1} {firedef=0}
#if (%pos( c, $flags)) {cloak=1} {cloak=0}
#if (%pos( h, $flags)) {allhealing=1} {allhealing=0}
#if (%pos( a, $flags)) {alkar=1} {alkar=0}
#if (%pos( w, $flags)) {
webbed=1
bf
} {webbed=0}
healme
#alias healme
value:
#if (@AutoSip=1 and @HMbal=1 and @sleep=0 and @anorexia=0) {
#if (@health < @maxhealth-@healthsip) {dh}
#if (@mana < @maxmana-@manasip) {dm}
}
The trigger is set for trigger on newline and trigger on trigger. Should I change something to make it fire on every prompt? If it isn't firing on every prompt then it just lets my mana or health drop down to like 100 and still doesn't drink health or mana until I get a system message with a prompt and then it finally drinks. |
|
|
 |
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Mon Apr 16, 2007 9:55 pm |
That trigger pattern is rather bad for Avalon. Try using this one instead ^(%d)h, (%d)m (%x)
This is not a regex so uncheck that option... |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
 |
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Mon Apr 16, 2007 10:24 pm |
Arminas wrote: |
That trigger pattern is rather bad for Avalon. Try using this one instead ^(%d)h, (%d)m (%x)
This is not a regex so uncheck that option... |
Why is it bad? The trigger I have does the same exact thing. * would be better than x would it not? * match any number (even none) of characters or white space? The problem is not that it doesn't update. The problem is it won't update or trigger except when a game message comes across followed by a prompt. If I do something and a prompt follows, it doesn't do anything. Like if I "look" or something like that or check my status but if the day changes over or a message like that followed by the prompt it triggers it. This is where I am confused. |
|
|
 |
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Mon Apr 16, 2007 10:34 pm |
Okay I tried your version and it didn't work either.
You are able to see by the light of the bracelet. You notice a single exit, west (an open door).
870h, 470m e- look
My mana just went all the way down to 200 and still nothing happens. As you can see above I just entered "look" every second or so to update the prompt.
You cease your watch for nets and webs.
870h, 270m e-
Still nothing...checked my balance variables...yep they are all set but nothing is happening.
And here comes a game message and magically it works!!
The resounding clang of a bell rings in your ears.
870h, 270m e-
Your alkar of rebirth disperses.
You drink from a sparkling potion.
You pour the potion of mind control down your throat.
870h, 770m ep-
???????????????? Whats up with that?
Trying again...
You are able to see by the light of the bracelet. You notice a single exit, west (an open door).
870h, 330m e- look
nothing happening...
You are able to see by the light of the bracelet. You notice a single exit, west (an open door).
870h, 0m e- |
|
|
 |
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Mon Apr 16, 2007 11:25 pm |
Hmm, try checking use ga/eor for prompt in the emulation menu in preferences...
|
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
 |
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Mon Apr 16, 2007 11:38 pm |
Comparing the two trigger patterns.
^(\d+)h\, (\d+)m (.*)\-
Yours matches
What you want...
123h, 123hm ezyfiwaAdlx{[(-
but it also matches
123h, 123m ezyfiwaAdlx{[(-)]} asdf asdl f aksd fasdf kajkadasf sadfgk jkl;'dfs ;sfjk aq;a;fj asdfasdfas asdf asd fas fadf asdf dasf assdfasdfadsfsdaf-
Mine
^(%d)h, (%d)m (%x)
matches
123h, 123hm ezyfiwaAdlx{[(-)]}
and it also matches
123h, 123hm -
And that is the difference.
Mine matches up to the last bit of the prompt. Yours goes to the end of the line if there is a second - anywhere within it.
Addmitedly you are not likely to type anything with a - in it for a command but sometimes the prompt gets stacked with output from a fight. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
 |
nexela Wizard

Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Tue Apr 17, 2007 2:37 am |
You need to uncheck newline, and check prompt. Trigger on trigger is fine checked
|
|
|
 |
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Tue Apr 17, 2007 2:40 am |
Use GA/EOR for prompt is checked.
By the way, you are right. I didn't think about that. Good idea to do it the other way so it doesn't pick up random letters.
It still won't work and is driving me nuts. I do the same thing on Achaea and it works great. |
|
|
 |
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Tue Apr 17, 2007 2:56 am |
nexela wrote: |
You need to uncheck newline, and check prompt. Trigger on trigger is fine checked |
Hehe yep that works finally.  |
|
|
 |
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Tue Apr 17, 2007 4:37 am |
BTW This would be a more reasonable structure for your alias pattern. The other way if both were low you would waste a mana sip the other way.
#if (@AutoSip=1 and @HMbal=1 and @sleep=0 and @anorexia=0) {
#if (@health < @maxhealth-@healthsip) {dh} {
#if (@mana < @maxmana-@manasip) {dm}
}
}
Another note. The balance setting in Avalon is not well synced with the prompt. So I hope you are not triggering actions based on prompt for balance. There are patterns for that that work MUCH better. The only time I have noticed not getting the balance lines are from within a Power ritual.
#if (%pos( y, $flags)) {RightBal=0}
#if (%pos( z, $flags)) {LeftBal=0}
Works because if the prompt shows that you do NOT have balance then you can bet that you do not. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
 |
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Tue Apr 17, 2007 5:50 am |
Arminas wrote: |
BTW This would be a more reasonable structure for your alias pattern. The other way if both were low you would waste a mana sip the other way.
#if (@AutoSip=1 and @HMbal=1 and @sleep=0 and @anorexia=0) {
#if (@health < @maxhealth-@healthsip) {dh} {
#if (@mana < @maxmana-@manasip) {dm}
}
}
Another note. The balance setting in Avalon is not well synced with the prompt. So I hope you are not triggering actions based on prompt for balance. There are patterns for that that work MUCH better. The only time I have noticed not getting the balance lines are from within a Power ritual.
#if (%pos( y, $flags)) {RightBal=0}
#if (%pos( z, $flags)) {LeftBal=0}
Works because if the prompt shows that you do NOT have balance then you can bet that you do not. |
Yeah I noticed about the health and mana after I posted that earlier. I changed it already.
Not sure what you mean about the balance. I have that already in the script? Did I do it wrong? |
|
|
 |
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Tue Apr 17, 2007 6:05 am |
You are setting the balance to 1 in the scripts as well. That is not safe as Avalon is not quite right on the timing for telling you when you have balance back. Or for when you are losing it for that matter. BUT if the prompt tells you that you do not have balance. Then you can be sure that you do not have it.
Avalon also has a legs balance like, but unlike Achaea. It just does not tell you that. Getting balance with your weapon hand, except in the case of knights, them having the ability to wield in each hand, is kinda like getting back all limbs in Achaea. This is part of the reason why you cannot trust the prompt.
An example of this is flying to just below the clouds. If you use power there you get back LEG balance much faster. And can then act faster as well. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
 |
Larkin Wizard

Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Tue Apr 17, 2007 12:35 pm |
I wouldn't use either pattern, personally. Both could potentially match things you didn't want. I would use regex and match only the flags that are possible with something like: ([eyzpifchaw]*)\-
|
|
|
 |
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Thu Apr 19, 2007 2:32 pm |
Larkin wrote: |
I wouldn't use either pattern, personally. Both could potentially match things you didn't want. I would use regex and match only the flags that are possible with something like: ([eyzpifchaw]*)\- |
Well I was going to but I can't get that to work at all. Does it work for you? I can't get CMUD to do anything with using the [ ] in a trigger.
I tested all three versions from the command line using #showp and only his and the one I had before will work. |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Apr 19, 2007 3:33 pm |
What do you mean by "doesn't work"? I create a test trigger with the regex "Regex test: [a-zA-Z]+" that just echoed something and it worked fine.
|
|
|
 |
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Thu Apr 19, 2007 3:44 pm |
Fang Xianfu wrote: |
What do you mean by "doesn't work"? I create a test trigger with the regex "Regex test: [a-zA-Z]+" that just echoed something and it worked fine. |
No offense but everything seems to always work for you.
Did you test the same exact trigger using exactly what Larkin posted and the same script that I had? |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Apr 19, 2007 5:15 pm |
That's why I asked what you meant by doesn't work - that the trigger never even fired, or that you couldn't get the script to work? The trigger you gave, with Larkin's correction (though you don't actually need to escape the hyphen) fires fine. I tested just now since you mentioned it, and the kind of %pos processing you were doing on $flags also works. I tried it three times, once with %3 in the %pos itself, once with %3 assigned to $flags, and once with $flags defined directly from the pattern and all three worked. Perhaps I'm just lucky :(
|
|
|
 |
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Thu Apr 19, 2007 5:41 pm |
Fang Xianfu wrote: |
That's why I asked what you meant by doesn't work - that the trigger never even fired, or that you couldn't get the script to work? The trigger you gave, with Larkin's correction (though you don't actually need to escape the hyphen) fires fine. I tested just now since you mentioned it, and the kind of %pos processing you were doing on $flags also works. I tried it three times, once with %3 in the %pos itself, once with %3 assigned to $flags, and once with $flags defined directly from the pattern and all three worked. Perhaps I'm just lucky :( |
What's the trigger pattern you used? I can't get it to work.
For example in the flags processing I put #if (%pos(e,$flags)) {#Say test}
Nothing happens. |
|
|
 |
Tech GURU

Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Thu Apr 19, 2007 6:13 pm |
I was able to match your prompt with this regex pattern, basically a combination of what everyone else suggested.
Code: |
^(\d+)h, (\d+)m ([eyzpifchaw ]*)\- |
I added a space because I noticed one your prompts (in your first post) had a space. I hope that helps. |
|
_________________ Asati di tempari! |
|
|
 |
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Thu Apr 19, 2007 6:19 pm |
Tech wrote: |
I was able to match your prompt with this regex pattern, basically a combination of what everyone else suggested.
Code: |
^(\d+)h, (\d+)m ([eyzpifchaw ]*)\- |
I added a space because I noticed one your prompts (in your first post) had a space. I hope that helps. |
Thanks. That works too! Odd that all it took was adding a space. |
|
|
 |
|
|