|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Tue Nov 09, 2010 3:57 am
Package Change Request |
One thing I would like to see as a change with the package library is:
1) When you select a package to install that it would be able to detect what session you are in and put the package into a subdirectory under the mud session directory and open the package in that session instead of just downloading it. |
|
_________________ 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) |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Nov 09, 2010 2:36 pm |
I can understand the desire, but you don't always want to do that. Perhaps have it as an option.
|
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Tue Nov 09, 2010 3:19 pm |
Rahab wrote: |
I can understand the desire, but you don't always want to do that. Perhaps have it as an option. |
I find that when I do download a package (install) it puts it in your: My Documents\My Games\CMUD\Packages Directory --- Which the verbiage is deceiving since it really doesn't install the package but downloads it.
Anyways, so when you open the package in your session it saves the package variables still in the above package directory. Now if you want to open (install) the package into another mud session it also uses the same package directory structure, which means your will loose any changed variables from the previous install location.
Another thing I find is if you download the package and then move it to another directory structure like my above suggestion in a package directory under the mud session; that when the package developer has a newer version of the package and goto update it, the package fails to update.
Also if you open the library under a new session with no packages installed the library still says you have XXX number of packages installed, which isn't true for this session. It would be very confusing to new users to CMUD Package Library. |
|
_________________ 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) |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Nov 09, 2010 4:47 pm |
But once you download the package into the Packages folder, you don't have to install it again. You can load that package into any other session without going back to the Package Library. That is why it is put into the Packages folder rather than a specific mud folder. When it says "install" it means "install into Cmud", not "install into this specific session".
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Nov 09, 2010 5:16 pm |
Rahab is correct that it means "Install into CMUD". Each session has it's own list of packages, and maybe I need to add a button to the Package Library to show the packages specific to your session. But what makes it complicated is that you might have multiple sessions open when you open the package library.
|
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Tue Nov 09, 2010 6:47 pm |
Zugg wrote: |
Rahab is correct that it means "Install into CMUD". Each session has it's own list of packages, and maybe I need to add a button to the Package Library to show the packages specific to your session. But what makes it complicated is that you might have multiple sessions open when you open the package library. |
Okay I get that it does put it one directory so every session can access it. So how to you use the same package in multiple sessions but they would have different values in the global variables. Hmmm. Something to think about. I guess that is why every package is MUD specific. |
|
_________________ 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)
Last edited by darmir on Tue Nov 09, 2010 6:54 pm; edited 1 time in total |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Nov 09, 2010 6:53 pm |
It depends on how the package is built. A well-designed package would not store session-specific variables within the package itself, but let them be created in your own session. Then every session will have it's own variables which are used by the package, even if you have multiple sessions running at the same time with the same packages. A badly-designed package might have session-specific variables already defined within the package itself, which would lead to the problem you describe. If the package does not define where the variable is to be created, it will usually be created in your session package, not the secondary package.
[edit] Actually, that is a generalization. There are situations where you might want one session to know about the variables associated with a different session. In that case, a well-designed package would automatically keep track of which variable belonged to each session, possibly by using classes or variables based on the name of the session or character. My skill-tracking package does that, because I wanted it to track skills for my pets as well as my character. It had the side-effect of making the variables of any of my characters accessible from any other of my characters. |
|
Last edited by Rahab on Tue Nov 09, 2010 7:02 pm; edited 1 time in total |
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Tue Nov 09, 2010 6:57 pm |
Then say for instance how would I change my Speech Type script then to save the speech variable to the specific session? On one mud I play I use the stutter type and another I use the Old English Type. You can get my package from the library if you want to see it.
Also I have the same issue with my Mundane Auto Eat Scirpt for the food and container values. |
|
_________________ 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) |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Nov 09, 2010 8:01 pm |
If a shared package refers to a variable (without a full module path), then CMUD will look for that variable in the current session window. So just don't create the variable within the package itself. Let CMUD create the variable within the session window. Packages are not supposed to store session-specific variables if you intend the package to be shared across multiple sessions.
|
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Tue Nov 09, 2010 9:04 pm |
If you give it a class path then it will create the class in the session window. For example:
#var ClassName/variablename 0 |
|
_________________ 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) |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Nov 09, 2010 9:09 pm |
That is correct. Is that not what you wanted to do?
|
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Tue Nov 09, 2010 9:44 pm |
Rahab wrote: |
That is correct. Is that not what you wanted to do? |
If I just give it the path with a classname will it create it in the session? When I tried that it put the variable in a existing class with that name in my package. |
|
_________________ 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) |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Nov 09, 2010 10:11 pm |
Well, Rahab isn't exactly correct. When you use a path like that within a different module, it will create a class folder within the module it's being used from if no other variable is found. If you want to create the initial variables in the session window, you would do this:
Code: |
#MODULE %window
#CLASS ClassName
#NEWVAR VariableName 0
#CLASS 0
#MODULE 0 |
This will switch the current module to the current session window (%window), then create/switch to the class called ClassName. #NEWVAR will force the VariableName to be created in this class folder regardless of whether there are other copies of it elsewhere. Then it switches the class and module back to the original values.
However, you should only do this once if you are trying to initialize the variables. When using the variables in your shared package later, just use @ClassName/VariableName and CMUD will get the correct variable for the current session window.
Just be sure that you do NOT have a ClassName/VariableName within your shared package...otherwise CMUD might use that existing variable instead of the session variable. It *should* use the session variable, but scripts just get confusing if you have the same variables named in your package as in the session window. |
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Tue Nov 09, 2010 10:17 pm |
Zugg, I would like to initialize this only once. How would you suggest to do that in the package, without it initializing each time you load the package.
I answered my own question on how to get it to load only once. I made onLoad event and checked for a variable called setup if it is set to 0 it creates the class and variable as you stated how to do it, then I set the setup variable to 1. This way next time it doesn't run again.
My only issue is that with your above example the speech variable using the syntax of #NEWVAR variablename 1 didn't create it in the new class that was created.
Here is my code:
Code: |
#if ( @setup = 0) {
#MODULE %window
#CLASS SpeechTypeGV
#NEWVAR speech 1
#CLASS 0
#MODULE 0
#VARIABLE setup 1
}
|
I even tried it with
Code: |
#NEWVAR @SpeechTypeGV/speech 1 |
|
|
_________________ 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) |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Wed Nov 10, 2010 12:23 am |
The easiest thing to do is to not specify a class name at all--just a variable name. If there is no variable already existing in the scope of the package function, it will create the variable under the session window. The user can then move the variable wherever he wants. Do you really need to specify a class name? Can't you let the user decide where to put the variable?
|
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Wed Nov 10, 2010 12:42 am |
I was using the wrong syntax.
Here is what I finally came up with.
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<event event="onLoad" priority="800">
<value><![CDATA[#local $curwin
$curwin = %window
#if ( !@SpeechTypeGV/setup) {
#MODULE %window
#CLASS SpeechTypeGV
#NEWVAR SpeechTypeGV/speech 1
#NEWVAR SpeechTypeGV/st_intensity 3
#NEWVAR SpeechTypeGV/setup 1
#CLASS 0
#MODULE 0
#PRINT {<color yellow>#################################</color>}
#PRINT Speech Types Package has been installed for $curwin
SpeechHelp
#PRINT {<color yellow>#################################</color>}
#PRINT {}
}]]></value>
</event>
</cmud>
|
|
|
_________________ 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) |
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Wed Nov 10, 2010 4:35 am |
I just realized that when I moved the speech variable to be in the module window under the SpeechTypeGV class. My multi-state button now doesn't work. I doesn't recognize the speech variable now.
Here is the code:
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<button type="Multistate" variable="@SpeechTypeGV/speech" autosize="false" width="86" height="24" autopos="false" left="-2" top="-2" toolbar="2" priority="630">
<caption>Command</caption>
<value>// This button is used to set the speech type for your character.</value>
<button>
<caption>Command</caption>
<value>#class CommCmnd 0</value>
</button>
<button>
<caption>Stutter</caption>
<value>#class CommCmnd 1</value>
</button>
<button>
<caption>Old English</caption>
<value>#class CommCmnd 1</value>
</button>
<button>
<caption>Lisp</caption>
<value>#class CommCmnd 1</value>
</button>
</button>
</cmud>
|
Also setting the variables from the alias doesn't work:
See this code
Code: |
#vari#local $channel, $input
$channel = %1
$input = %params( 2)
#variable @SpeechTypeGV/speech 4
#send @SpeechType($channel,$input)
|
When I look at the variable it doesn't change. |
|
_________________ 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) |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Wed Nov 10, 2010 1:22 pm |
Are the buttons in your main session window, or a different window? Likewise, is that alias defined in your main session window, or a different window? If it is a different window, it will not be able to see variables defined in your main session window.
|
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Wed Nov 10, 2010 3:11 pm |
Rahab wrote: |
Are the buttons in your main session window, or a different window? Likewise, is that alias defined in your main session window, or a different window? If it is a different window, it will not be able to see variables defined in your main session window. |
Why not! You can reference the variable that isn't in your main session window in triggers and aliases.
Also when updating the variable from an alias not in your main session window as I show above doesn't work either. |
|
_________________ 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) |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Wed Nov 10, 2010 5:27 pm |
A window can reference variables, triggers, aliases, etc. that are defined in _modules_ outside itself. But it cannot reference anything that is defined in a different _window_. This is one of the main differences between modules and windows.
[edit] A bit more detail:
A module can reference anything defined within itself or in any window or module in a package that it has been told to check.
A window can reference anything defined within itself, or in any module in a package that it has been told to check.
A window cannot reference anything defined in a different window. |
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Wed Nov 10, 2010 6:14 pm Bug in button variable or not? |
Rahab wrote: |
[edit] A bit more detail:
A module can reference anything defined within itself or in any window or module in a package that it has been told to check.
A window can reference anything defined within itself, or in any module in a package that it has been told to check.
A window cannot reference anything defined in a different window.
|
Let me explain a little further with the button here.
My button is defined in my module Speech Types. I want it to use a variable that is defined in my mud session window. When I try to update the variable from the button, it doesn't recognize the variable in the window. See screenshot below: I should be able to do this according to what you said.
As for assigning the value to the variable as I stated above, I was doing it wrong in my alias and triggers they are now working.
I was using:
Code: |
#variable @SpeechTypeGV/speech <value> |
and I should have used:
Code: |
#variable SpeechTypeGV/speech <value> |
|
|
_________________ 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) |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed Nov 10, 2010 10:07 pm |
Quote: |
My button is defined in my module Speech Types. I want it to use a variable that is defined in my mud session window.
|
You can't do it like that. Stuff inside a window simply doesn't EXIST to any other stuff outside that window. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Wed Nov 10, 2010 10:16 pm |
MattLofton wrote: |
Quote: |
My button is defined in my module Speech Types. I want it to use a variable that is defined in my mud session window.
|
You can't do it like that. Stuff inside a window simply doesn't EXIST to any other stuff outside that window. |
Matt,
I believe you are wrong here. That is whole whole purpose of being able to put variables into other windows from a module.
I can change that variable from my module with an alias, so why can't I do it with the button?
Per Rahab,
Rahab wrote: |
A module can reference anything defined within itself or in any window or module in a package that it has been told to check.
|
So I can reference that variable in the window by my Speech Types module. I do it with a few aliases reside in my module and updates the speech variable in the mud session window. |
|
_________________ 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) |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Nov 10, 2010 10:18 pm |
Matt is correct. But shared buttons are a bit special. When you put a Button into a shared package (global module), CMUD actually creates a separate "instance" of that button within each session that has the global module enabled.
Now, when a button is *clicked*, CMUD executes the script for the button instance within the context of the window that contains the button. So the script for the button will use variables within the specific session window that has the button. The Button Caption is also evaluated within the context of the local session window. This was tested with a shared button that displays a HP gauge, for example.
The problem is that this was never tested or made to work for multistate buttons. It seems that the State variable for the multistate button is being searched within the context of the module and not the local window.
It's possible that specifying the class name is causing this problem, so try it with just @speech as the button variable name and see if it works.
If not, I'll have to add this to the wish-list for a future version. It's too major of a change for a simple bug fix in the public version, sorry. |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4715 Location: Pensacola, FL, USA
|
Posted: Wed Nov 10, 2010 10:29 pm |
why not just have the button run the alias?
:%item(%name,1):aliasname |
|
_________________ Discord: Shalimarwildcat |
|
|
|
|
|