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
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

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


Joined: 12 Jul 2004
Posts: 190
Location: Canada

PostPosted: 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! :)
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Sat Sep 22, 2007 10:44 am   
 
Thinjon100

I'm sure it will work, but I would like to have simple syntax work too. At least, as it declared in docs Smile
http://www.zuggsoft.com/modules/mx_kb/kb.php?page=3&mode=doc&k=2654
(you must specify full name to create another variable with the same name in another class)
Reply with quote
Tech
GURU


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

PostPosted: 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!
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: 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
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

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


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

PostPosted: 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.
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