Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Yamabushi
Apprentice


Joined: 29 Jul 2003
Posts: 101
Location: USA

PostPosted: 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
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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}
Reply with quote
Yamabushi
Apprentice


Joined: 29 Jul 2003
Posts: 101
Location: USA

PostPosted: 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
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: 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?
Reply with quote
Yamabushi
Apprentice


Joined: 29 Jul 2003
Posts: 101
Location: USA

PostPosted: 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
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: 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
Reply with quote
Yamabushi
Apprentice


Joined: 29 Jul 2003
Posts: 101
Location: USA

PostPosted: 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
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: 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
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: 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
Reply with quote
Yamabushi
Apprentice


Joined: 29 Jul 2003
Posts: 101
Location: USA

PostPosted: 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
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: 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
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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
Reply with quote
Yamabushi
Apprentice


Joined: 29 Jul 2003
Posts: 101
Location: USA

PostPosted: 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
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: 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!
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Mon Nov 13, 2006 9:31 pm   
 
Actually Zugg I thought about %char, but when I looked up the documentation I saw this for %char and since I wasn't running CMUD to verify, I didn't bother.

You may want to add some notes about this or link to the special variable here. http://forums.zuggsoft.com/modules/mx_kb/kb.php?mode=doc&index=zmud_Predef&page=3&refpage=3
_________________
Asati di tempari!
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net