|
Yamabushi Apprentice
Joined: 29 Jul 2003 Posts: 101 Location: USA
|
Posted: Sat Nov 11, 2006 8:55 pm
Trigger Problem on 1.15 |
I have been working on a trigger to capture my user name.
The mud uses:
Your name?
And when I input a command it shows:
Your name? Yamabushi
In zmud, a trigger would collect this information using
#TR {^Your name.? (\a+)} {#VAR uname %1}
However, this syntax doesn't seem to work yet in cmud, is there any substitute trigger that will work? |
|
_________________ Yama |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Sat Nov 11, 2006 9:26 pm |
The syntax you showed is the Regular Expression syntax, so open the Advanced options for the trigger and make sure the Regular Expression option is checked.
The normal (non reg ex) syntax would be:
#TR {^Your name? (%w)} {#VAR uname %1} |
|
|
|
Yamabushi Apprentice
Joined: 29 Jul 2003 Posts: 101 Location: USA
|
Posted: Sat Nov 11, 2006 9:35 pm |
Ok,
But my name 'yamabushi' is what I type in. So how to do I have the trigger fire, and capture what word I type in? |
|
_________________ Yama |
|
|
|
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Sat Nov 11, 2006 9:40 pm |
Yamabushi wrote: |
Ok,
But my name 'yamabushi' is what I type in. So how to do I have the trigger fire, and capture what word I type in? |
I'm not sure why you need this trigger? Why not just make the value of uname = Yamabushi? Unless you change names alot it would be easier wouldn't it? |
|
|
|
Yamabushi Apprentice
Joined: 29 Jul 2003 Posts: 101 Location: USA
|
Posted: Sat Nov 11, 2006 9:44 pm |
The reason I use the trigger is alot of aliases I use make uses ofa %proper(@uname) so I never have to worry about completely changing settings files for different characters.
The Your name? is just the log in line, and I really need to capture what I type. |
|
_________________ Yama |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Sat Nov 11, 2006 10:00 pm |
Zugg's example should work just fine. It is equivilant to the one you said you were using in zmud
Have you tried it yet? |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
Yamabushi Apprentice
Joined: 29 Jul 2003 Posts: 101 Location: USA
|
Posted: Sat Nov 11, 2006 10:22 pm |
Yes I tried it, and it doesn't work.
For whatever reason, it won't capture what I type at the login.
Here's what happens:
Mud outputs:
Your name?
I type:
yamabushi
and I'm wanting it to set uname to yamabushi. |
|
_________________ Yama |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Sat Nov 11, 2006 10:38 pm |
Right, sounds like the #oninput problem I was having before. I'll look more into it and let you know.
|
|
_________________ 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: Sat Nov 11, 2006 10:50 pm |
Ok, here is what you need. sorry I'm not going to try and decifer what you would type in the command prompt. This is the gui way of doing it.
First you need a pattern trigger that matches
^Your name?
It should have nothing in the value.
It should ONLY have Trigger on Prompt checked in the trigger options.
Next you need a new trigger state that matches.
(%w)
It should be a command Input type trigger and should ONLY have trigger on Newline checked in the trigger options.
It should have
#VAR uname %1
In the value. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
Yamabushi Apprentice
Joined: 29 Jul 2003 Posts: 101 Location: USA
|
Posted: Sun Nov 12, 2006 5:03 am |
I'm afraid that isn't the answer Arminas....
That changes the uname variable constantly, and doesn't even capture my user name. |
|
_________________ Yama |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Sun Nov 12, 2006 5:22 am |
Not a new trigger, a new SUB trigger. It will only fire once.
Edit: I mean trigger state here. Not a substitute.
A sub trigger is a trigger that you make from INSIDE another trigger. In the gui.
I've tested it.
Edit: Offline.
Edit: Perhaps you would tell us what mud you are using this for?
Perhaps someone who knows the syntax will post my answer in a Yamabushi can just paste it into the command line? |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Nov 12, 2006 5:58 am |
I can't test if it works without connecting to the mud in question, but in theory the trigger you want is this:
#trig {^Your name?} {}
#cond {(%w)} {#var uname %1} input
The #cond command creates a second sub-trigger, as Arminas put it (it's properly called a trigger state), that will only fire after the first. States only fire in order - in this one, they'll only go in 1-2-1-2 order, which hopefully stops that problem you had with @uname constantly getting changed. The input option at the end of #cond is used so that it fires on your command input.
EDIT: This might still not work depending on the MUD, because it's still set to trigger on a newline. If it's not working, make sure you delete the old state or the whole trigger first, then try:
#trig {^Your name?} {}
#cond {(%w)} {#var uname %1} {input|nocr}
instead. This triggers on input without receiving a new line first.
PS. This was the first time I used multistate triggers in CMUD and wow, is the new UI for them easier to use than than the old one. Thanks, Zugg! :D |
|
|
|
Yamabushi Apprentice
Joined: 29 Jul 2003 Posts: 101 Location: USA
|
Posted: Sun Nov 12, 2006 2:53 pm |
The mud in question's address is towers.angband.com port 9999 if you want
to give it a shot.
I was playing with the previously stated trigger combination by Fang, the only tweak it needed to work was to check the trigger on prompt line.
Thanks for the help |
|
_________________ Yama |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Mon Nov 13, 2006 8:57 am |
Another (and in my view, simpler) alternative is to make use of the #CH. Of course you would have to set it in the session properties and if you needed multiple characters you can either edit it (there's a dropdown list) everytime you play or make multiple copies of the same session for each character.
At any rate, if you do that, the command #VAR uname %exec("#CH") should work. |
|
_________________ Asati di tempari! |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Nov 13, 2006 8:30 pm |
Actually, the %char variable will also return the character name. So instead of using the %exec("#CH") wierdness, you can just do:
#VAR uname %char |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
|
_________________ Asati di tempari! |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Nov 13, 2006 11:26 pm |
Yep, just one of the many areas of the help file that need work. I haven't even written the special variables page for CMUD yet.
|
|
|
|
|
|