|
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
Posted: Fri Sep 21, 2007 11:53 am
[2.03] Duplicated variables |
I have a simple trigger on mud prompt like this:
Code: |
^<(%d)hp (%d)ma (%d)mv>
#TAG prompt;
PrevHP = @CurrHP;
CurrHP = %1;
DiffHP = @CurrHP - @PrevHP;
PrevMA = @CurrMa;
CurrMA = %2;
...
...
|
where I calculate hp, ma, movepoints change since last prompt. All variables used in this script defined in MainWindow/InternalVars class.
Also I have 3 child windows for talks and chat. When I switch to them and main window continue receive mud output (and prompts), variable duplicating occurs. New variables with the same name created under child windows. Not all variables duplicates, for ex., I've see CurrHP and DiffHP being copied at the end of the session, but not PrevHP. On the next session everything may be different with other variables being duplicated. More, sometimes CMUD duplicate variables within the same main window class, so I end up with two variables (in MainWindow/@xxx and in MainWindow/InternalVars/@xxx, where it should be), which have different values.
It is the only place for now where I use these variables, no other expressions/triggers/etc. with them exists.
Small update: the trigger itself located in MainWindow (MainWindow/^<(%d)hp (%d)ma (%d)mv>) |
|
|
|
Thinjon100 Apprentice
Joined: 12 Jul 2004 Posts: 190 Location: Canada
|
Posted: Fri Sep 21, 2007 9:35 pm |
The script will usually create variables within whatever scope CMud is running at the time of execution. It seems for triggers this scope isn't changed to the triggering window, but is whatever window has focus (which is, unless I'm mistaken, how it's always been) so to specify where your variables are, try the //package/class/variable syntax.
//MainWindow/InternalVars/PrevHP = @CurrHP;
etc etc.
That should help. |
|
_________________ If you're ever around Aardwolf, I'm that invisible guy you can never see. Wizi ftw! :) |
|
|
|
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Sun Sep 23, 2007 4:12 pm |
This is probably a bug since triggers are supposed to have the scope of the window that triggered the text. Either that or you have some other scripts changing you class and module so that when CMUD applies it's scope search rules you're existing variable(s) aren't being found.
|
|
_________________ Asati di tempari! |
|
|
|
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
Posted: Sun Sep 23, 2007 8:39 pm |
This trigger is the only place where these vars used. Actually, I have not implement any use of them yet: first I need that problem with buttons to be fixed.
|
|
_________________ My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads |
|
|
|
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
Posted: Thu Sep 27, 2007 8:47 pm |
Zugg, have you reproduce this? I still have a lot of new variables after each session.
Is it possible somehow restrict variables to window the script is running from? I really don't want to use full variable names. |
|
_________________ My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Sep 27, 2007 9:36 pm |
Nope, I haven't reproduced this yet. So far in my testing the variables always get created in the window that got the text that fired the trigger.
|
|
|
|
|
|