![](templates/Classic/images/spacer.gif) |
Larkin Wizard
![](images/avatars/169979204542c57c7448618.gif)
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Sat Mar 29, 2008 4:40 pm
[2.21] Difference between #ONINPUT and #ALIAS |
I started with this, but it didn't fire the event in other packages. (It may or may not be related to the event scoping issues.)
Code: |
#ONINPUT {^\s*def(?:ences)?\s*$} {
#RAISE OnDefenseCheck
} "" {regex} |
I tried an alias instead, and the event fired the way I wanted.
Code: |
#ALIAS def {
#RAISE OnDefenseCheck
} |
Anyone else had a similar experience? This one is fairly specific, so I don't expect much in the way of comments. ![Smile](images/smiles/icon_smile.gif) |
|
|
![](templates/Classic/images/spacer.gif) |
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Sat Mar 29, 2008 11:15 pm |
I ran into one situation where my code was executing a command and I couldn't get that command given by the code to trigger the #oninput trigger. I eventually just ended up having to use an alias. I couldn't isolate what it was with my code that was causing it to not to fire the #oninput. I created test code where I was doing practically the same thing and it fired 100% every time.
|
|
|
![](templates/Classic/images/spacer.gif) |
Zugg MASTER
![](images/avatars/164475849040f41c23b22fe.gif)
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Apr 23, 2008 8:59 pm |
Larkin: Is this still happening in v2.22? I couldn't reproduce it. Here are the steps I used:
1) Run CMUD, Close Sessions, Open Settings Editor
2) File/New Package. Enter Test for name
3) Within the Test package, I created a new Event called MyEvent. The code was just "#SHOW fired"
4) back in the main window, I tested:
#RAISE MyEvent
and it worked
5) Created alias:
#ALIAS def {#RAISE MyEvent}
and then typed "def" on the command line...it worked.
6) Created OnInput trigger:
#ONINPUT {^\s*def(?:ences)?\s*$} {#RAISE MyEvent} "" {regex}
and then typed "defences" and it also worked.
So obviously I'm not creating something in the correct package or something. So could you clarify your situation so that I can reproduce the problem? Thanks. |
|
|
![](templates/Classic/images/spacer.gif) |
Zugg MASTER
![](images/avatars/164475849040f41c23b22fe.gif)
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Apr 29, 2008 7:49 pm |
Bumping this for Larkin...only a few days to answer this for it to get addressed in the 2.23 public version.
|
|
|
![](templates/Classic/images/spacer.gif) |
Larkin Wizard
![](images/avatars/169979204542c57c7448618.gif)
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Tue Apr 29, 2008 8:13 pm |
Your spam filter must've kicked my message out then because I sent you the file I use to create this situation. I'd post it here, but it's a semi-proprietary script of mine... I'll try again and just paste the entire thing into the body of the e-mail. Hopefully, it doesn't mis-label the message as spam again.
|
|
|
![](templates/Classic/images/spacer.gif) |
Zugg MASTER
![](images/avatars/164475849040f41c23b22fe.gif)
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Apr 29, 2008 9:26 pm |
I recently added you to my Barracuda white-list, so maybe the email came in before I did that. I look for the new message and let you know what I find.
Edited: Got your message with the script. Reproduced the problem. |
|
|
![](templates/Classic/images/spacer.gif) |
Zugg MASTER
![](images/avatars/164475849040f41c23b22fe.gif)
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Apr 29, 2008 10:27 pm |
OK, I think I have this fixed now.
Btw, keep in mind that in your "def" alias, you are raising the event, and then also sending "~def" which will fire your Oninput trigger and cause the event to be raised a second time. So in v2.23, your alias raises the event twice, and the oninput trigger raises it once.
The bug was that the context for oninput triggers was not being set correctly. |
|
|
![](templates/Classic/images/spacer.gif) |
Larkin Wizard
![](images/avatars/169979204542c57c7448618.gif)
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Tue Apr 29, 2008 11:07 pm |
Awesome. Glad it helped!
I was using either the alias or the trigger, not both, so it's all good. :) |
|
|
![](templates/Classic/images/spacer.gif) |
|
|