|
David256 Beginner
Joined: 07 Nov 2006 Posts: 22
|
Posted: Tue Nov 07, 2006 11:52 am
Mutually exclusive alias calls |
I have a long script that runs on every command, and it gets mucked up if its run twice at once. I'd like to prevent any other alias from starting while the first is going. I've tested #PRIORITY, but it only works on triggers.
I might be able to make a spinlock type mutex manually but that's hard and bleh... so does anyone have a better idea?
Edit: I tried #PRIORITY with command triggers, but that doesn't work either.
Edit 2: Got something working by converting aliases into normal triggers
Code: |
#ALIAS priority {#show asdf %1}
#REGEX {^asdf (.*)$} {#gag;#priority {#execute %1}} |
Then I can run "priority [anything]" and "anything" gets #priority{} around it.
A small problem is anyone that sends you the right string can make you do anything, but as long as "asdf" is something a lot more random it should be safe enough.
It also does funny things with my colours for some reason... but it's not too major.
Heh I pretty much answered my own question, but I'll leave it in case other people have the same problem. |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Tue Nov 07, 2006 6:08 pm |
In CMUD aliases and triggers all have a priority value. So if you set that alias to have the highest priority, then it will execute before any of the others.
To see the priority, go to the advance editor screen (the little up arrow at the bottom of the screen in package editor) for that alias. Alternatively you can choose View -> Sort By Priority to the see the priority value for all aliases, triggers et al. |
|
_________________ Asati di tempari! |
|
|
|
David256 Beginner
Joined: 07 Nov 2006 Posts: 22
|
Posted: Wed Nov 08, 2006 2:47 am |
Ah yup, I tried it in CMUD and everything works nicely. But for now the above works ok for me.
|
|
|
|
|
|