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
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Sat May 10, 2008 4:58 pm   

CMUD 225 - Settings Editor odd behavior.
 
Normally, when the editor recognizes an alias, or other item that has been previously defined, in the text of a script, it colors it blue. However, the new editor is not recognizing defined items that are located in the root (that is, hanging from the main session window). It has no problems recognizing items that reside in modules. There is a variation with defined variables in the root: They show up in red in the scripts (which normally means they are not defined), again, no problem recognizing variables defined in modules. This does not affect script execution, just makes debugging a bit harder. The problem with not recognizing variables was intermittent with the 2.18 editor, it is persistent in this edition.
EDIT: Root includes any classes and sub-classes attached to the main session window.
_________________
Sic itur ad astra.
Reply with quote
gamma_ray
Magician


Joined: 17 Apr 2005
Posts: 496

PostPosted: Sat May 10, 2008 6:13 pm   
 
OK, so I guess the obvious question is: are the scripts you're trying to use these things from in the same package? (I'm guessing they are since you say the scripts work, if they're not then the bug is that your scripts work at all, rather than with the highlighting.)
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Sat May 10, 2008 6:19 pm   
 
I have only one package.
_________________
Sic itur ad astra.
Reply with quote
Tech
GURU


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

PostPosted: Tue May 13, 2008 5:00 pm   
 
Can we get XML snapshot of your settings to try and reproduce this. With out, or more specific steps in recreating the problem there's not much we'll be able to do.

Does this happen in a blank session for you? Does it only happen with one chararacter, or a particular set of aliases?
_________________
Asati di tempari!
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Wed May 14, 2008 12:27 am   
 
The problem is general. The fact that it colors the settings in a script red when they are not in the same module is just an aspect of the problem. All you have to do is delete the alias you are viewing and you will notice that all the color on the settings will disappear until you do something that will make the Editor reload its data.
Besides, the unrecognized declared settings problem does not occur 100% of the time, but about 90%. All I can tell you at this point is, that it only occurs with settings not in the same module. I thought that it only applied to settings hanging from the root, but the general problem is recognition across modules (and perhaps packages, but as I said, I only have one so I can't testify to that).

EDIT: Another thing, and this may be a design decision by Zugg, paired parentheses and brackets are no longer in yellow or marked in red when unpaired.

EDIT: An update on the coloring of matching parentheses and brackets. It appears that the coloring of these items only take place while one is writing the script. Once it is saved clickling on a parenthesis or bracket will not color it. It would under CMUD 2.18.

EDIT: I've also traced a problem in the way the #IF trees are generated. It seems that the closing bracket is not included in the tree and this is causing the coloring to come out wrong. The ELSE portion of a complex statement comes out in black (indicating that a bracket is missing). This does not prevent the #IF statement from being correct, it just appears to be so.
Code:

....
#IF (%bitand( $req, 2)) {
  #IF (%null( $zone)) {$zone = %roomzone( )}
  {#IF (!%isnumber( $zone)) {
      #IF (%lower( %left( $zone, 4)) = "the ") {$zone = %right( $zone, 4)}
      $rec = @commdb.Execute($sql1, %concat( "%", $zone, "%"))
      #IF (!%null( $rec)) {$zone = %db( %item( $rec, 1), ZoneID)}
      {$zone = %roomzone( )}
      }
    }
  $sql2 = %concat( $sql2, "ZoneID = ", $zone, " AND ", $name)
 }
{$sql2 = %concat( $sql2, $name)} <----- HERE
....

The portion pointed to by HERE is colored black.

However, if I move this code snippet to an alias and make sure that the invoked variables exist, the coloring appears correct (except for @commdb, of course, which continues to be colored red... The original cause of this post).

I am sure that are better ways to code this but, at this time perhaps, that is beside the point.
_________________
Sic itur ad astra.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Wed May 21, 2008 11:35 pm   
 
Another odd behavior by the Editor is that it will randomly show the English Directions and English Keypad as modules hanging from the root window. They will disappear from the tree while one browses them.
_________________
Sic itur ad astra.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Thu May 22, 2008 1:21 am   
 
An extreme example of this:
I try to enter a command and the path recording box pops up while the command parsing icon gets crossed out. No matter what I do, I can't get the box to stay off. I can close it, I can click "cancel recording", but after that anything I enter on the command line will cause the box to re-appear. Hitting [b]esc/[b] does nothing. (All this while trying to get the hell out of an aggro room that's eating me alive. Result: death)
During this episode the command line won't accept any characters.
Problem resolution: reload CMUD.
_________________
Sic itur ad astra.
Reply with quote
Zugg
MASTER


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

PostPosted: Wed May 28, 2008 7:22 pm   
 
First, please create NEW POSTS for each different error/problem that you are reporting. Otherwise it is very difficult for me to track different problems on my bug list and it reduces the chance that I can fix the bug and makes it harder for other people on this forum to help you with your problems.

On the original problem, I did this simple test in a blank session:
Code:
#ALIAS test {hello world}
#TRIGGER {zugg} {test}

and when I opened the settings editor and selected the "zugg" trigger, the "test" alias was colored blue as expected, even though "test" was in the main session module.

Also, your terminology is a bit confusing. Nothing other than windows or modules should be attached to the "root" of the tree. Every other setting must be within a module or window. If you have other settings that are actually at the "root" level, then your package is corrupted.

The Scintilla text editor component that is used in CMUD doesn't recolor *everything*. It only recolors what it can after the position of your editing changes. This can sometimes cause part of the syntax to remain uncolored or not updated. Use the View/Refresh menu item to force the entire editor display to be refreshed and recolored. This will also fix/update any issue with the collapsable code sections. Unfortunately, this is just how Scintilla works and nothing I can do about it. If I forced the entire script to recolor after every edit, then it would be unbearably slow.

If the English Directions and English Keypad modules are shown, then you have probably clicked on the All view, which is perfectly normal.

There *does* seem to be some problem with the color styles not being set properly. I've noticed that the brace/paren highlighting isn't working properly either, but if I go into the Preferences Styles and check the syntax editor, they are set correctly. But somehow they don't show up in the editor itself. The line numbers also do not have the correct color. So something is definitely going wrong with the color style settings in the editor and I've added that to the bug list.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Thu May 29, 2008 12:08 am   
 
Yes, the alias name will be colored properly. The problem of the coloring happens during editing, opening a saved script will have the correct coloring, mostly. Variables that are outside the class will, for the most part, show up in red (not defined), but not always, just most of the time. This problem also occurred in previous CMUD versions, but cut/pasting the variable would solve the problem. That doesn't work for this CMUD version, if the variable shows up in red, it will remain so, no matter what one does. Also, if one deletes a setting, then all other settings one views will show up in black only unless one either selects a settings type other than the one currently active or selects another class and views a setting in that class. Since deleting a settings causes the editor to bring a new setting to the display, the all-black problem shows up immediately. As to the English Directions and English Keypad settings, it is not a matter of me clicking on the All-View, that is my default setting, and if this showed the folders all the time, it wouldn't worry me. What I am saying is that they randomly pop-up into the view tree and when I click on either one of them, they disappear. What should happen is that they folders should be opened just as any other folder would.
_________________
Sic itur ad astra.
Reply with quote
Zugg
MASTER


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

PostPosted: Thu May 29, 2008 3:32 am   
 
I created a variable outside the class and it showed up in blue as expected. Make sure your class containing the variable is not getting disabled somehow. This version fixed a bug in previous versions that was caching the red/blue of variables incorrectly. If a variable is red in this version, then it means it isn't visible to the currently edited setting for whatever reason (class disabled, variable disabled, etc). My guess is that there is something weird in your settings, so you'll need to try and reproduce it in a blank session if it's really a bug.

I've never seen the English Directions/Keypad show up like that, so I'll need to know what you were doing when it happened. It might also be an indication of a problem in your settings, but I just can't see how it would just randomly show those.
Reply with quote
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: Thu May 29, 2008 3:44 am   
 
Zugg wrote:
Nothing other than windows or modules should be attached to the "root" of the tree. Every other setting must be within a module or window. If you have other settings that are actually at the "root" level, then your package is corrupted.


Package>Class>trigs etc

is correct, right? It doesn't need to be
Package>Module>Class>trigs etc


I tried to create a module inside a package, a few days back, to move the contents of a class into it, but after I did this the script no longer worked. I've been meaning to look at it closer but got distracted. There is never enough time in a day.
_________________
Athlon 64 3200+
Win XP Pro x64
Reply with quote
Toxic
Adept


Joined: 27 May 2008
Posts: 299

PostPosted: Thu May 29, 2008 3:56 am   
 
Its got to be either Package>Window>Class>settings
or Package>Module>Class>Settings

But unless your package is corrupt you should have no settings that aren't under a window or a module.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Thu May 29, 2008 4:29 am   
 
Normally I would agree with the reasoning that the variable or class etc., was disabled. However, since the scripts run, then the variables must be accessible. Proof of this is that one of the most common red-flagged variables are the references to COM objects, but the scripts that use them run properly.
_________________
Sic itur ad astra.
Reply with quote
Zugg
MASTER


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

PostPosted: Thu May 29, 2008 4:34 pm   
 
Quote:
Package>Class>trigs etc is correct, right?

No! If you have classes in the root level, then your package file is corrupted and you will have *lots* of problems. The root level should only contain Modules or Windows. All Classes must be inside of a module or window.

As far as the red variables, the syntax checker in the editor might not be doing as complete of a search as running the script. There are lots of ways in a script to get around scoping issues. For example, normally a variable in another window is private to that window. But you can still force CMUD to access it using the full @//WindowName/Varname syntax. But if you try to reference the variable in the editor, the editor will color it red because it is normally not accessible.

Also, your script might be enabling the class before accessing it. If the class containing the variable is disabled, then the editor will show the variable as red. If your script enables the class and then accesses the variable, then disables the class, then the script will work even if the editor show red.

In any case, if you have classes directly in the root level of your package, then that could explain a *lot* of the problems you are reporting that we cannot reproduce.
Reply with quote
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: Thu May 29, 2008 4:58 pm   
 
Zugg wrote:
Quote:
Package>Class>trigs etc is correct, right?

No! If you have classes in the root level, then your package file is corrupted and you will have *lots* of problems. The root level should only contain Modules or Windows. All Classes must be inside of a module or window.

I think its just a communication error on my part.
By default, all packages contain a single module in them on creation, right?
Best way is a screenshot, I think. In the following, the package name is 'Concoctions' and I believe it is set out correctly?

_________________
Athlon 64 3200+
Win XP Pro x64
Reply with quote
Toxic
Adept


Joined: 27 May 2008
Posts: 299

PostPosted: Thu May 29, 2008 5:22 pm   
 
In this case, we cant really see what your package name is... Your module name is however Concoctions, and the things under it are of course your classes.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Thu May 29, 2008 5:46 pm   
 
Mmm, the layout there is Package (the whole tab) -> Module ("Concoctions") -> Classes, abc and "bowing deeply" trigger. The module/window is the vital step.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Zugg
MASTER


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

PostPosted: Thu May 29, 2008 6:08 pm   
 
Yep, so you are fine...your classes are within a module. And sorry I got confused between Caled's reply and Anaristos. I thought it was Anaristos who was having classes or settings in the root level.

So, back to the original post...can anyone else reproduce a variable outside the class being red instead of blue. Or, I'm still waiting for a more detailed procedure from Anaristos on how to reproduce this.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Thu May 29, 2008 11:08 pm   
 
Here is something interesting that I have just found. Looking for instances of red-flagged variables yielded the following:

Declared variables across modules are colored blue as they should be, unless the module containing the referring script has a window attached to it. If this is the case then trans-module variables will be colored red even if already declared. So it seems that a window within the module disturbs the editor.
As I pointed out before, the fact that the editor does not recognize the variable(s) does not affect the script.

NOTE: In my posts above and elsewhere, when I refer to the root class, I am referring to the window/module that has the same name as the package.

EDIT: Just a reminder that to see the loss of color effect in the Editor all one has to do is delete a setting. This will cause the Editor to load another setting into the display window. The setting will be displayed in black only. This condition will persist until one either chooses a different filter and setting or chooses a setting in another window/module. Also, while this problem affects mostly variables, it can and does affect other settings from time to time.
_________________
Sic itur ad astra.
Reply with quote
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: Fri May 30, 2008 2:00 am   
 
Fang Xianfu wrote:
Mmm, the layout there is Package (the whole tab) -> Module ("Concoctions") -> Classes, abc and "bowing deeply" trigger. The module/window is the vital step.

The bit that confused me is that the module there (and in all my packages) is created automatically upon package creation, and in the tree view if I click on the 'all' tab, all I see is:

Root>Modules/Windows

Where all the modules share the same names as the packages, so I assumed they were representing the packages themselves. However, it seems that packages are not actually represented anywhere at all, except for the fact that modules/windows within them show in the tree view and can be shown in tabs across the top.
_________________
Athlon 64 3200+
Win XP Pro x64
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Fri May 30, 2008 2:05 am   
 
I think that somehow we have ended with two distinct threads here...
_________________
Sic itur ad astra.
Reply with quote
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: Fri May 30, 2008 3:04 am   
 
If you look closely you'll notice that while the thread did indeed diverge - it has already converged.
_________________
Athlon 64 3200+
Win XP Pro x64
Reply with quote
Zugg
MASTER


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

PostPosted: Fri May 30, 2008 3:15 am   
 
OK folks, we need some serious work here to get everyone talking the same language. CMUD can be very complicated, but it gets much worse if you don't use the correct terminology.

Package: This is just the *.PKG file. It contains Modules and Windows.
Module: Contains classes and other settings. Can be global, external, or local. Does not have any associated visual component.
Windows: Like a Module, but has an associated visual "window" component.

When you create a new package, a Module with the same name as the package is created automatically. In the Tree View, a Tab normally represents an entire package file, showing the contents of that file. The file can have multiple modules/windows at the top level. However, do not associate a "tab" in the editor directly with a package file since you can also customize tabs yourself to only show a particular class or module within a package. So just remember that a Package is a single file on the disk.

The "All" tab shows all settings no matter what file they are in. So it will show all of the modules/windows, with all of the various class folders and settings within. In the "All" view, it can be difficult to determine which module/window is stored in which package file.

OK, so now let me address something Anaristos said to get back to the main problem report of this thread:
Quote:
Declared variables across modules are colored blue as they should be, unless the module containing the referring script has a window attached to it.

This makes no sense. There is no way for a "module containing the referring script" to have a "window attached to it", unless you are talking about a "Window" object instead of a "Module" object. You cannot have a Windows within a Module. You cannot have a Module within a Module. You cannot have a Module within a Window. Windows and Modules can only contain classes and other settings (variables, aliases, etc).

If your variable is within a "Window" object, then as I've mentioned before, all settings within a Window are local to that specific window and cannot be seen by scripts in other modules or windows, even within the same package file. In a script there are ways to get around this, and your script might be executing within the context of the window containing the variable (like if it's a trigger). So it doesn't matter whether the script runs or not. All the settings editor can do is determine if the variable is directly visible.

Let's look at a concrete code example. Execute this code from a blank session:
Code:
#WINDOW MyWindow
#VAR MyVar "This is a variable within MyWindow"
#MODULE MyModule
#ALIAS Test {#SHOW @MyVar}
#TRIGGER {fire} {#SHOW @MyVar}

If you open the settings editor and look at the "Test" alias within the MyModule module, you will see that the @MyVar is red. This is because @MyVar is declared within the "MyWindow" Window, and anything within a Window is private to the window and cannot be seen by any module outside of that window. If you look at the trigger called "fire", you will also see that @MyVar is red. Again, because @MyVar is within the other Window.

But now execute the following command:
Code:
:MyWindow:#SHOW fire

This causes the global trigger to fire within the context of the MyWindow window. And it will display "This is a variable within MyWindow" within the MyWindow window. That is because triggers execute within the context of the window that received the text that matches the trigger. And when the global trigger runs within MyWindow, then the @MyVar is defined. So this is a case where the script can access @MyVar, but the settings editor will show it as red. The settings editor has no idea what window will run the trigger and what variables will be available at runtime.

So, (1) please everyone try to be more careful with your terminology. Learn the proper "language" for talking about CMUD stuff. It will help you in the future to avoid confusion, and it will help others trying to answer your questions. It's just like any scripting language where you need to learn the proper terms. And (2) hopefully you can see some valid cases where the variables in the settings editor will be red even though the script might run fine. This isn't a bug...it's just how context and scoping work in CMUD. Context and Scoping can be *very* complex topics. But usually you don't need to worry about it...your scripts will usually just run how you'd expect them.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Fri May 30, 2008 4:19 am   
 
I apologize for the terminology. No, the window is not attached to the module but scripts in a module which has a window following it (alphabetcially in my case) will experience the coloring problem (as long as the referred setting is outside the module), while a module that has no window following it directly, will not have scripts having this problem.
_________________
Sic itur ad astra.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Fri May 30, 2008 5:32 am   
 
Caled wrote:
it seems that packages are not actually represented anywhere at all

The tabs across the top are the packages. If you create another module within any of the packages (tabs) you have, it won't create a new tab for that module - it'll be represented on the tab for that package.

Packages can contain as many modules or windows as you want - add a bunch and you'll see what I mean.
_________________
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
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