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 Goto page 1, 2  Next
kjaerhus
Magician


Joined: 18 Dec 2006
Posts: 317
Location: Denmark

PostPosted: Sat Nov 06, 2010 12:30 pm   

Organizing packages
 
I want to organize my scripts into packages so they are easily shared between different session packages and also to be able to share them with others.

So I have made a global package that can be opened from different session. So far so good. But what if I want to make a hierarchy of packages where some depends on others? In the manual it says:

Quote:
The main rule about Packages is that they should be self-contained. Advanced users can learn how to split functionality between multiple packages, but for most users, a package contains everything that it needs to perform it's function.


However, I have not been able to find the place to learn the "split functionality between multiple packages" feature. Can someone guide me? Until now I have had everything in the default session package so I am still new to the "sharing" concept.

I suppose all names need to be unique across different packages?
Reply with quote
Tech
GURU


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

PostPosted: Sat Nov 06, 2010 2:07 pm   
 
Packages are self-contained and you can't have a hierarchy of packages. What you can have are packages that use common variables and or events to communicate.

For example, in one mulitple package setup I do I register a global variable of the packages available. In another setup I raise various events to communicate between the packages.
_________________
Asati di tempari!
Reply with quote
kjaerhus
Magician


Joined: 18 Dec 2006
Posts: 317
Location: Denmark

PostPosted: Sat Nov 06, 2010 3:46 pm   
 
Well, the default session package is not self-contained so why does the rest have to be? Or am I wrong?

My plan is to make a package with all the basic elements like a command queue and so on. Then on top of that a combat package, a training package and so on.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Nov 06, 2010 4:34 pm   
 
Package dependencies is a future feature that hasn't really been touched on yet. Given that there's no ability to check on the existence/status of a package, and generally no distinction between reported results for uninstalled, undefined, and disabled, any type of user-created dependancy check is going to be incomplete and/or insecure (ie, the user could change the data.) Thus, while you could perhaps cleverly script a package-management system that uses SQL/COM scripting (to drill into the sessions.db file) and various triggers to monitor state variables and the like, basically it will be far, FAR easier and less hassling to simply build your packages to be completely standalone.
_________________
EDIT: I didn't like my old signature
Reply with quote
Tech
GURU


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

PostPosted: Sat Nov 06, 2010 4:56 pm   
 
Kjaerhus, I'm not sure what you mean when you say the default package is not self contained? How is it not self-contained. Maybe I misunderstand you, so exactly what do you mean by self-contained. Can you give an example or two, of exactly what you want to do.

While Matt is right you can not check for the existence of a package, you can use the %class function to check if a particular module is enabled or not. I have used this as well for enabling optional packages in my own package management systems.
_________________
Asati di tempari!
Reply with quote
kjaerhus
Magician


Joined: 18 Dec 2006
Posts: 317
Location: Denmark

PostPosted: Sat Nov 06, 2010 5:50 pm   
 
Tech wrote:
Kjaerhus, I'm not sure what you mean when you say the default package is not self contained? How is it not self-contained. Maybe I misunderstand you, so exactly what do you mean by self-contained. Can you give an example or two, of exactly what you want to do.

While Matt is right you can not check for the existence of a package, you can use the %class function to check if a particular module is enabled or not. I have used this as well for enabling optional packages in my own package management systems.

What I mean is this: When you create a new session you get a default session package. Then you might go find a published package and use this besides your default package. This works fine it seems. Of course you might then call some of the elements in the package you found and use them in your own package and thereby relying on the other package. Then you are not self contained. Is this not the way to use published packages?
Reply with quote
Tech
GURU


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

PostPosted: Sun Nov 07, 2010 12:36 am   
 
Yes that is the way they work. I did not understand what you meant. I thought you wanted to have hierarchical package structure, i.e. a package with a package.

What you're describing is easily doable with just some planning and the tips we provided earlier.
_________________
Asati di tempari!
Reply with quote
kjaerhus
Magician


Joined: 18 Dec 2006
Posts: 317
Location: Denmark

PostPosted: Sun Nov 07, 2010 8:52 am   
 
Tech wrote:
What you're describing is easily doable with just some planning and the tips we provided earlier.

Could you elaborate on that please? Smile

Maybe there is some sort of "best practice" concerning this. I suppose most people have some basic structure that many scripts rely on. My thought was to encapsulate these basic structures in a package for itself and then make other packages that handle different groups of script on top of that, like combat, training, capturing and coloring, etc. And then only have very few things in my default session package as this is the one I get every time I create a new session.

My hope is to make it easier to reuse the same scripts from several sessions (like different characters on the same mud) and also perhaps make it easier to share my scripts with others.
Reply with quote
kjaerhus
Magician


Joined: 18 Dec 2006
Posts: 317
Location: Denmark

PostPosted: Sun Nov 07, 2010 1:18 pm   
 
Also I'd love to know whether there is a command to copy a setting from one package to another. Say if I want to make the whole GUI interface in a package and then create a setup alias that when called copies the GUI elements to the session window. It's ofcourse important that I can give the copies an ID so I can overwrite them.

I can make a setup script that creates all the GUI, but there are so many settings on an element that it would be easier to just make them using the editor.

Important thing is that the end user needs only fire off a command to get the GUI elements and that he can do it as many times as he likes.

EDIT: Perhaps the smartest thing would be if I could create a GUI element by a piece of xml. Is that possible?
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon Nov 08, 2010 5:17 pm   
 
There are no "best practices" yet. Generally, you can organize your packages however you want. The only trick is that if you have one secondary package using variables or aliases defined in another, you need to set the package to see the other.
In one mud, I set up all my magic-related stuff in one package, all my mapping stuff in another, all my crafting stuff in a third. I minimized the crossover necessary between these packages, making them as independent of each other as possible. But I also set up a couple packages of helper functions and aliases, which were utilized in many of my packages. How you do it is up to you. I do recommend as much compartmentalization as possible, except for packages specifically set up to provide general-purpose functionality needed in many packages. One example--my general function package has a function called @intersection() which would return the set intersection of two stringlists. I used that in several other packages.
Reply with quote
kjaerhus
Magician


Joined: 18 Dec 2006
Posts: 317
Location: Denmark

PostPosted: Mon Nov 08, 2010 8:11 pm   
 
Rahab wrote:
There are no "best practices" yet. Generally, you can organize your packages however you want. The only trick is that if you have one secondary package using variables or aliases defined in another, you need to set the package to see the other.
In one mud, I set up all my magic-related stuff in one package, all my mapping stuff in another, all my crafting stuff in a third. I minimized the crossover necessary between these packages, making them as independent of each other as possible. But I also set up a couple packages of helper functions and aliases, which were utilized in many of my packages. How you do it is up to you. I do recommend as much compartmentalization as possible, except for packages specifically set up to provide general-purpose functionality needed in many packages. One example--my general function package has a function called @intersection() which would return the set intersection of two stringlists. I used that in several other packages.

That sounds pretty much as what I am aiming for. Do you have any input on the GUI items? I'd love to have those in a package so I could always start a new session and setup everything by running an alias or something.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon Nov 08, 2010 9:12 pm   
 
GUI items? Not sure what you are asking for.
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Mon Nov 08, 2010 11:24 pm   
 
Rahab, Are your packages out in the package library? It would interesting to install them and see how they interact with each other give us other package developers some good ideas.
_________________
Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian)
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Nov 09, 2010 12:07 am   
 
I have one package in the library, but it is specific to Dartmud, for tracking skill improvements. I am working right now on a package I hope to put in the library. It will essentially be a relational database code based on Cmud variables. I could have waited for Zugg's eventual overhaul of the db code, but that will probably be another year at least. Or I could have used an external database driver. But I'm hoping my code will be simple enough for people who don't want to learn SQL, lacking advanced features that will confuse someone who just wants to track pc acquaintances or crafting recipes, while having features that are especially useful in a mud environment such as db variables suitable for inclusion in a trigger pattern.
Reply with quote
Tech
GURU


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

PostPosted: Tue Nov 09, 2010 5:22 pm   
 
Kjaerhus, I'm not sure exactly what you're looking for when you ask for best practices. Beyond what has already been mentioned it comes down to how you want to organize your code. Compartmentalization is always to limit dependencies across packages. Then it's a matter of checking for the existence of optional packages, and determining the best way to communicate based on your usage scenario.

Most, if not all GUI elements have a corresponding command to create them, though this is not always practical. The #BUTTON command is a great example of this. This is typically a moot point since GUI elements can be distributed with a package as well. Then enable the package for the desired window, and the GUI elements are now available.

A better approach to get help here may be to describe the packages you are trying to create, what they do, and exactly how you would like things to work. Then we can provide insight as to what approaches would work best.

Rahab, in lieu of the db code rewrite why not use the integrated SQLite feature. I had a similar DB based package, that I converted over to SQLite. The only drawback there of course is that you don't have the DB GUI, which you may or may not need.
_________________
Asati di tempari!
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Nov 09, 2010 8:55 pm   
 
Tech,
Yeah, I did consider that, and I happened to recently refresh my memory of SQL. That actually plus trying to learn Java was partly what inspired me to reconceive how I was approaching storing information within Cmud, which previously was being done by dozens of stringlists and db variables, and scripts specific to each application.

I might take another look at using SQLite. It occurs to me that I could actually use the same function and alias names I have already created for the project, so I wouldn't have to change any scripts using the package. I would just have to change the internal code within those functions to use SQLite commands instead of pushing data around Cmud variables. I have what I think is a slick Cmud interface, where an alias will display all the key-value pairs for a record, with MXP links which allow editing the values or displaying the corresponding record if the value is a record ID (or list of IDs).

[edit] Actually, I should take a look at your package, to see whether I can build on top of that.
Reply with quote
kjaerhus
Magician


Joined: 18 Dec 2006
Posts: 317
Location: Denmark

PostPosted: Wed Nov 10, 2010 9:07 pm   
 
Rahab wrote:
GUI items? Not sure what you are asking for.

Elements that you can actually see on the screen - the Graphical User Interface. That includes windows, buttons, gauges, etc.
Reply with quote
kjaerhus
Magician


Joined: 18 Dec 2006
Posts: 317
Location: Denmark

PostPosted: Wed Nov 10, 2010 9:22 pm   
 
Tech wrote:
Kjaerhus, I'm not sure exactly what you're looking for when you ask for best practices. Beyond what has already been mentioned it comes down to how you want to organize your code. Compartmentalization is always to limit dependencies across packages. Then it's a matter of checking for the existence of optional packages, and determining the best way to communicate based on your usage scenario.

Best practices is all about proven ways of doing things. Perhaps there was reccomendations on how to organize your packages for the scenario I described. But then there have to be more than a few people using it I guess. I would have thought that many of the gurus in this forum had very good ideas on how you should do and where you should definitely not go... Razz

Tech wrote:
Most, if not all GUI elements have a corresponding command to create them, though this is not always practical. The #BUTTON command is a great example of this. This is typically a moot point since GUI elements can be distributed with a package as well. Then enable the package for the desired window, and the GUI elements are now available.

A better approach to get help here may be to describe the packages you are trying to create, what they do, and exactly how you would like things to work. Then we can provide insight as to what approaches would work best.

Well, let's say I want to make a complete "environment" for a DragonRealms player with windows for filtering certain types of information into, status bars with gauges and some buttons that activates common actions. If I could make such a package it would be easier for me to just start a new session, load a few packages and perhaps run a setup script to be up and running like CMUD was a dedicated DragonRealms client like Stormfront or Genie for instance.

That is my overall goal. Regarding the GUI I find that it is either very difficult or impossible to create the desired elemtes without using the editor so my thought is whether it's possible to create it all using this and then use the xml or something to save it and recreate it another time. Or how would you do it?
Reply with quote
shalimar
GURU


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

PostPosted: Wed Nov 10, 2010 11:18 pm   
 
If you are truely trying to mimic StormFront, I would suggest you make your button panels into seperate windows.
With the #MAKEWINDOW command you can even remove the scrollbars and get nitty-gritty with it.

Then the windows would all be in the package and the end user could arrange them to his/her whims.
The only problem is i don't think there is a way to share the associated layout file for such a complex scheme, to allow out-of-the-box playing without having to dock things first.

Unless.....

#MAKEWINDOW can specify window positions as well... you might want to make an alias to throw out default values, or several for that matter, for various screen resolutions.
_________________
Discord: Shalimarwildcat
Reply with quote
kjaerhus
Magician


Joined: 18 Dec 2006
Posts: 317
Location: Denmark

PostPosted: Sun Nov 14, 2010 11:55 am   
 
I think everything right now falls with the lack of support of setting all parameters for settings through the command line. There are simply too many things you can do in the editor which cannot be done if you want to create your settings from some sort of setup script.

The only solution I see right now is to share the packages and provide the used xml for the windows in the session packages so people can manually set this up. Regarding the layout file and the map there is a small problem I think as these have to be downloaded somehow.

Perhaps this could be an idea for the next version of CMUD. Instead of adding lot's of new features for the few it would be great if expert users could create "super packages" that is out-of-the-box environments for playing a certain mud. That would really open CMUD for non-expert users that want to use all their time playing muds and not troubleshooting client-related issues.
Reply with quote
Tech
GURU


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

PostPosted: Sun Nov 14, 2010 8:18 pm   
 
What you're describing is the feature set Zugg hopes to implement when he integrates the zApp functionality.

I still have a hard time understanding what you are trying to do that has to be created at run-time but can't be distributed with the package itself.

Maybe a screenshot of you desired end-state would help.
_________________
Asati di tempari!
Reply with quote
shalimar
GURU


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

PostPosted: Sun Nov 14, 2010 11:48 pm   
 
I can't speak for him really, but I can supply a screenshot of Stormfront to give folks a better idea of the complex layout they use:



Notice the right panel is a superwindow for a bunch of tiled windows, complete with a scrollbar (that disappears when not needed!) for if the superwindow is too big for the screen.
When you look in a container it makes a temporary window displaying the contents (I could code that part) into one of the side panels, but you can also drag objects between windows to move them between containers.

I don't think we can do those currently in CMUD.
_________________
Discord: Shalimarwildcat
Reply with quote
kjaerhus
Magician


Joined: 18 Dec 2006
Posts: 317
Location: Denmark

PostPosted: Mon Nov 15, 2010 5:32 pm   
 
shalimar wrote:
I can't speak for him really, but I can supply a screenshot of Stormfront to give folks a better idea of the complex layout they use:



Notice the right panel is a superwindow for a bunch of tiled windows, complete with a scrollbar (that disappears when not needed!) for if the superwindow is too big for the screen.
When you look in a container it makes a temporary window displaying the contents (I could code that part) into one of the side panels, but you can also drag objects between windows to move them between containers.

I don't think we can do those currently in CMUD.

You've got the idea allright. I am not asking for the stuff not possible with CMUD's GUI at the moment though although I could think up features that would be nice to have (like graphics so you could make the environment look less-office and more-roleplay like).

I actually think for the time being I might go back to single-package thinking for the time being as the packages today really can't do what I want. As you mentioned yourself there are certain important elements like the layout file, maps, etc. that would have to be shared through another channel anyway.

It would be nice though if there was more focus on customisation of CMUD through some sort of mods tailored for specific muds. I'd definitely vote for that direction. Smile
Reply with quote
Tech
GURU


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

PostPosted: Mon Nov 15, 2010 7:52 pm   
 
Can you post a screen shot of what you have done in CMUD that you can't distribute via package. That's the part I'm struggling with. If you can create it in CMUD, which it seems you can, I'm not clear as to why you can't distribute it as a package. That part is not clear to me.

Are you saying you also want to distribute your map file?
Are you saying you want to be able to control the exact initial layout of windows?

If I find time I may try and mimic some of the storm front layout and put it in a package. I'm sorry if I seem dense or redundant, but it's still not clear to me what exactly is not working for you. I think I understand that StormFront layout is an example of your desired end-state, but what specific problem is preventing you from getting there?
_________________
Asati di tempari!
Reply with quote
kjaerhus
Magician


Joined: 18 Dec 2006
Posts: 317
Location: Denmark

PostPosted: Mon Nov 15, 2010 8:08 pm   
 
Tech wrote:
Can you post a screen shot of what you have done in CMUD that you can't distribute via package. That's the part I'm struggling with. If you can create it in CMUD, which it seems you can, I'm not clear as to why you can't distribute it as a package. That part is not clear to me.

Are you saying you also want to distribute your map file?
Are you saying you want to be able to control the exact initial layout of windows?

If I find time I may try and mimic some of the storm front layout and put it in a package. I'm sorry if I seem dense or redundant, but it's still not clear to me what exactly is not working for you. I think I understand that StormFront layout is an example of your desired end-state, but what specific problem is preventing you from getting there?

Layout, database and map could surely be nice to be able to share of course but I already have a problem sharing for instance GUI settings and we also talked alams in another thread.

Let's say you want to make a package for players of DragonRealms including a very cool button. Ok, so I see two possibilities: Either you just have the button in your package or you have some sort of script you run to create it in the session package. The first option can be a problem if the user has more than one window that can access your package and the other I have no idea how to make as there is a lot of settings in the editor that I don't find in the command for creating a button. Even if it was possible to create it with a command it would be quite a job unless you could create the button in the editor and get the creation code for it.

Basically I think right now the easiest way to solve the problem is probably to make one package with all settings and distribute this so people can unzip it in the CMUD directory and create a new session using this package. I just thought I was able to make something with packages but I am not so sure it's worth the effort.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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