|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Sat Dec 15, 2007 5:52 pm
[2.18 Pro] Window disabled for no apparent reason |
I'm editing and testing my new combat system. It's obviously very complex and that makes it difficult to track down the source of some of the stranger things I'm seeing when working with CMUD. My latest conundrum involves my one and only window (containing just a single #GAG trigger) being disabled when a certain trigger fires in a certain way.
The trigger giving me the troubles (or so it seems, since I can't pin this down yet) is this:
Code: |
<trigger priority="14580" case="true" regex="true" id="1458">
<pattern>^([A-Z][a-z]+) slings an? (\w+) rune and an? (\w+) rune at you\, hitting you in the chest\.$</pattern>
<value>#IF (!%ismember(%1, @antirunes)) {
#ADDITEM antirunes %1
#ALARM "anti_"%1 +1 {
#DELITEM antirunes %%1
}
i_runes %2 %3
}</value>
</trigger>
|
The only time it causes problems is when one of the two runes randomly tosses me into an adjacent room. The trigger doesn't track the other rune's affliction, like it should, and the alarm that's created never fires, causing big problems in tracking any subsequent runes thrown by this same individual.
I finally figured out that the alarm hadn't fired when I noticed my #GAG trigger wasn't working any more and checked the settings, finding the Lusternia window to be disabled. Even looking at all the spam in the debugger window didn't yield any useful information. I'm seeing one or two other oddities with settings not behaving as expected, so I'm going to rebuild my settings through XML and see if things improve then.
As a side note: the alarm being created in this trigger should go into the same class as the trigger, shouldn't it? I don't want it in my window, especially if it's going to disable itself. |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Sun Dec 16, 2007 12:41 am |
Is it possible that you have a room trigger that's preventing the other rune trigger from firing?
Also, you may have simplified it but I"m not sure what your inner ALARM is supposed to accomplish. |
|
_________________ Asati di tempari! |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Dec 16, 2007 11:10 am |
Could be an anti-illusion countermeasure, I guess, because runes have a recovery time. Someone's name will only be in the variable for 1s after they've cast a rune, and perhaps the i_runes alias checks that.
Anyhow. While they're almost certainly irrelevant to the problem, there are two pretty naff syntaxes in there - the first is %%1, which is invalid, and "anti_"%1 to create the alarm's ID should probably be explicitly concated. Is this trigger actually compiling with the invalid syntax in there?
What does the i_runes alias do? Does this problem still occur with that alias disabled? |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Sun Dec 16, 2007 12:58 pm |
I would try the named parameter approach, except then I'd have to make a special alias just to create the alarm, wouldn't I? I suppose all the logic could just be moved into the i_runes alias (which right now just looks up the names of the two rooms in a data record of afflictions by rune name) and the caster's name would then be a parameter, but the %%1 and "anti_"%1 are actually making the alarm correctly, believe it or not. There may be some unwanted side effect in memory that's causing the window to be disabled, though, so I'll play with it again based on these suggestions.
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Dec 16, 2007 2:49 pm |
Larkin wrote: |
I'd have to make a special alias just to create the alarm, wouldn't I? |
It's weird, actually, because as I understand it the intention of the %%1 syntax is to delay expansion - that is, in this case, it would've created an alarm where the command was literally "#delitem antirunes %1", which doesn't make sense in the context of an alarm. Regardless, you don't need to do that when you can just use the ($localvar:wildcard) syntax in the pattern - you can then use that local variable in the alarm too. |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Sun Dec 16, 2007 4:27 pm |
Yeah, but I wrote these scripts back when the ($localvar:wildcard) stuff was broken.
I tried the $var syntax, though, and it didn't make any difference. I also tried creating a brand new package and loading my settings from XML, with the assumption that the database somehow got corrupted in my testing or loading of command-line scripts and the XML format is cleaner, but that didn't change this behavior. I still see nothing in the script debugger window that points to any sort of problem. I have no triggers that execute a generic #T- Lusternia, of course, so I'm at a loss.
My workaround for this is simply to hardcode the class folders for my dynamically created settings and to just keep things out of the window class scope. Disabling the active session window seems to have no other adverse side effects, such as the window disappearing... |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Sun Dec 16, 2007 4:31 pm |
I thought some of the reason for local variables was to avoid/remove the need for %% delayed expansion. I guess the code still exists to deal with %% but I would agree with Fang here the correct method now is to use local variables.
|
|
_________________ Taz :) |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Sun Dec 16, 2007 8:15 pm |
I only used the %%1 because I was making an alarm and not an alias. The example given for not using %%1 shows how to make an alias within an alias. Alarms don't accept parameters that same way, so I stuck with the %%1. At any rate, it's not what's causing my troubles with the disabling window because it still happens even now that the %%1 is gone.
|
|
|
|
|
|