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
Fang Xianfu
GURU


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

PostPosted: Sun Dec 31, 2006 6:26 pm   

Detecting a loaded package?
 
As an illustrative example, say I have a main package which contains most of my triggers and scripts, but I also have a supplementary windows package with windows for alerts, communication and things like that. I have a number of aliases I use for printing things to the screen. If the user has that window package loaded as well, I want the alias to print to those windows rather than the main one.

#alias print_alert {#if (%PackageIsLoaded(Windows)) {:Alerts:#echo {Alert: %-1} {#echo Alert: %-1}}

or perhaps

#alias print_alert {%if(%PackageisLoaded(Windows),:Alerts:)#echo {Alert: %-1}}

The PackageIsLoaded function doesn't exist, so anyone know a way to do this?
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sun Dec 31, 2006 7:00 pm   
 
As a work around you could always use %window to see if the window is open, but yeah a %package function would be nice to see if a package is enabled disabled or non existant


Code:
#ALIAS print_alert {
#IF (%window(Alerts)) {#WIN Alerts {%-1}} {#ECHO {Alert: %-1}}
}
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Zugg
MASTER


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

PostPosted: Wed Jan 17, 2007 10:26 pm   
 
I'll try to add something to detect if a package is loaded in the future. Of course, then you will probably also want some commands to load and unload packages, right? It's never ending :)
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Jan 17, 2007 10:32 pm   
 
Perhaps not, actually, since packages almost always contain modules that you can turn on and off instead of loading packages on the fly. Though a command like #T+ and #T- that controls modules would be nice. Or simply adding something like {||ModuleName|Class} or just {||Modulename} to it. That way you can control all or some of the settings in a package all at once.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
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