Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Tue May 27, 2008 2:31 pm   

Variables Across Packages
 
If I create one package for all of the general stuff that is the same between characters, the values of the variables still need to be different. If I put something in one package, and then put its reference variables in another (the character's package) will I be able reference my variables?
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed May 28, 2008 3:19 am   
 
Yep, as long as they're in a global module. But if you don't care about the right values being stored across sessions, and only during the current session, it might be easier just to turn off the shared option for your package. That'll load a separate instance of the package for each session, allowing each session to have its own value for the variables.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed May 28, 2008 10:51 am   
 
Well, the reason I wanted a global package was for some of the variables to be global. Namely, the ones that have values that all of the characters would use regardless, such as attack_type, etc... as I add to those I want it to affect all of my sessions. Hence the reason for a global package. But, as I did that, I realized that I wanted plenty of the other variables to remain localized, even if the triggers and such that used them could be globalized. So, if I kept them in the character's package, but the triggers that used them were in the global one, I'd be able to turn this off for individual variables? Is there a way to do that from the command output so I can include it with my copy and paste?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed May 28, 2008 11:25 am   
 
chamenas wrote:
if I kept them [the variables] in the character's package, but the triggers that used them were in the global one, I'd be able to turn this off for individual variables?

Be able to turn what off?
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed May 28, 2008 11:42 am   
 
The sharing values across packages.

Could I, for instance, say:

Variable_A in Package_1 is not shared
Variable_B in Package_1 IS shared

Variable_C in Package_2 IS shared

And would they all be accessible by triggers in both packages?
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed May 28, 2008 12:59 pm   
 
You're confusing yourself, Chamenas. The answer to your basic question is Yes, if you have variables in your session package, your addon packages can use them. So put the global variables in the addon package, and the session-specific variables in the session package.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed May 28, 2008 1:25 pm   
 
Yeah, I think that's the route I want to go. Razz

I forget where the reference was for directing triggers and variables to go in one package or another via command line, anyone have a link?
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed May 28, 2008 4:57 pm   
 
#module. Anything in a global module is, well, global. Anything in a local module is visible only to other stuff in that package.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu May 29, 2008 4:25 pm   
 
And since I know you like to specify a class when creating triggers on the command line, the format for specifying the module name is: //module/class
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion 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