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
Tharius
Beginner


Joined: 15 Apr 2013
Posts: 24

PostPosted: Mon Apr 20, 2020 1:43 pm   

Segregating Packages to the character they're attached to
 
In an effort to solve some corruption issues I've been setting my triggers into packages and associating them with different character sessions.

For example:

Mage
+ - generalTriggers
+ - mageTriggers

Cleric
+ - generalTriggers
+ - clericTriggers

I see the per session variables created which has stopped the corruption issue I was having previously. What I am now seeing I'll describe as access bleed.

The packages are set to global, I've tried to find some explanation of local but haven't been successful.

If I have multiples of both types of characters on, or sometimes even with only 1 of each, I will see triggers firing in the mage window that are defined in the cleric package. This happens regardless of whether or not the trigger is the same.

CMudPro 3.34 under Win10

Thanks!
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4671
Location: Pensacola, FL, USA

PostPosted: Tue Apr 21, 2020 12:14 pm   
 
I find the simplest way is for each Character to have a session, with triggers that are unique to that one character in its package.
Anything that might be shared, is a separate package.
Make sure that each character session only has the relevant packages in its package list. (don't enable a cleric package for a mage)

I also find it helps to run each session in a separate instance of CMUD.

Global vs local is a scoping concern.
Global means that any and all windows can see a given setting(s), not just the session window that called it.
You want capturing triggers to be local, to prevent a recursive loop where it keeps fireing on the newly captured line in the child window.
Whereas coloring triggers are likely more effective when global.
_________________
Discord: Shalimarwildcat
Reply with quote
Tharius
Beginner


Joined: 15 Apr 2013
Posts: 24

PostPosted: Wed Apr 22, 2020 1:12 am   
 
For years I've run with the single character single set of triggers style, but managing it across a horde of characters is time consuming and frustrating. So when I reinstalled I decided a structure where packages would represent groups of common functionality. Seems to rather fit with the idea of packages.

Now if they're broken, then fine. Rather than go to the multiple instance model (which I find absurd, are you insinuating that windowing in CMud is fundamentally broken?) I'll put ifchecks at the top of my triggers to guard the against the class of the character.

#if ( @MSDP.class == "cleric" ) {
...
}
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4671
Location: Pensacola, FL, USA

PostPosted: Wed Apr 22, 2020 12:44 pm   
 
It's a foolproof way to avoid the scoping issues is all.

Make sure that your shared packages have little to no variables in them. They can make use of them, but any variables that apply to the individual should be saved in the individual character packages.
_________________
Discord: Shalimarwildcat
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