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
gamma_ray
Magician


Joined: 17 Apr 2005
Posts: 496

PostPosted: Sun Sep 09, 2007 3:14 pm   

[2.03] Variable scope in multiple packages.
 
If you have a global module with some variables, then triggers from other packages which assign values to variables will use [those variables], even if the package containing the variables is not enabled for the module containing the trigger. Aliases from other packages will NOT use [those variables], unless the package containing the module is enabled for the module containing the alias. Could this be standardized, preferably to the first method mentioned?
Reply with quote
Tech
GURU


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

PostPosted: Mon Sep 10, 2007 3:35 am   
 
I believe this works as expected. Remember triggers always run in the context of the window, so if the Window has these Global modules enabled then the triggers will have access to them. Aliases work as described and expected. If you want access to it, you have to enable the module.
_________________
Asati di tempari!
Reply with quote
gamma_ray
Magician


Joined: 17 Apr 2005
Posts: 496

PostPosted: Mon Sep 10, 2007 4:56 am   
 
I think it would make more sense (and be easier besides) if aliases inherited the context of whatever called them. Aliases on the command line would have the context of that window, aliases in triggers would have the context of the trigger which would be the window, etc. Anyway, just my two gold.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Sep 10, 2007 11:52 am   
 
Aliases don't have to be called from the context of a window. They can be called by events, directions, the mapper, room scripts, anything. Triggers are always triggered by text appearing in a window.

Personally, I agree that the inconsistency outweighs any benefit having it this way round might give (though I honestly don't know what those benefits are...). But that's the logic for having it this way.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
gamma_ray
Magician


Joined: 17 Apr 2005
Posts: 496

PostPosted: Mon Sep 10, 2007 2:36 pm   
 
That's what I think is best about the inheritance idea. Almost* everything could eventually be traced back to a window, after all, events don't just raise themselves. You could have an event raised from an alias which was called from a trigger that was triggered by text in a window, and it would set one variable, and then you could have it raised some how from a different window in a different package and it'd set the variable in that package instead (going up the different levels and checking to see if that variable exists at each level)... Anyway, I think it'd be neat.

* The things that wouldn't would be include right click > Execute Script, and some of the triggers like alarm, etc., when they're used as the first or only state in a trigger.... Interestingly enough, using execute script on a trigger in a separate package, which shouldn't be able to see the variables I'm talking about, was still able to set said variable.
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