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
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Mon May 12, 2008 6:51 pm   

[2.25] Bug with macros and module scope
 

  1. Open some test session (can be untitled one).
  2. Create module in main package, next to session window object, using this XML:
    Code:

    <module name="Persistent" global="true" id="1">
      <uid>{99F8498D-FDC0-4AD2-A380-0D1A5A16ED22}</uid>
      <class name="Vars" id="2">
        <var name="target_lists" type="Record" id="3">Person="Jack|Jill|Bob|Mary"|Mobile="fisher|rockeater|moose"</var>
        <var name="target_mode" id="4">Mobile</var>
      </class>
    </module>

  3. Create a test package, using the following XML for the module:
    Code:

    <module name="Test1" global="true">
      <uid>{1A4CB778-87A7-4DBC-8F6D-B1EAE70E0592}</uid>
      <class name="Test1" id="1">
        <func name="targets" id="2">
          <value>#RETURN %db(@target_lists, @target_mode)</value>
        </func>
        <macro key="ALT-CTRL-UP" id="3">
          <value>#SHOW "Targets: "@targets()</value>
        </macro>
        <alias name="tq" id="4">
          <value>#SHOW "Targets: "@targets()</value>
        </alias>
      </class>
    </module>

  4. At the command line, use TQ to show the list of targets, and you should see "Targets: fisher|rockeater|moose" displayed.
  5. Use the Alt-Ctrl-UpArrow macro, however, which executes the same code, and you'll see just "Targets: " instead of the actual list.
  6. In the options for your Test1 module, check the main session package to enable it. You'll find that the macro now shows the list of targets.


I'd like for the macro behavior to be the same as the alias behavior, please. Smile


P.S. This doesn't just apply to functions or variables. I also raise an event from my macro, and that, too, used the wrong scope rule. I have to enable the handler module for the raising module, and that breaks my model!


Last edited by Larkin on Tue May 13, 2008 11:43 am; edited 1 time in total
Reply with quote
Tech
GURU


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

PostPosted: Tue May 13, 2008 7:53 am   
 
Confirmed.
_________________
Asati di tempari!
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Fri May 30, 2008 12:44 am   
 
Is this on the list Zugg?
_________________
Taz :)
Reply with quote
Zugg
MASTER


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

PostPosted: Fri May 30, 2008 4:37 pm   
 
Missed this one, but have added it to the bug list. Thanks for the bump.
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Jun 02, 2008 9:05 pm   
 
I am having trouble reproducing this one, so maybe it's already fixed in v2.26. When I pasted your two modules and then tried the "tq" alias and the alt-ctrl-up macro, both worked fine. When I clicked on the Test1 module, the "untitled" main window was already checked (and in fact it is shown in gray text and disabled so that you cannot uncheck it). So I'm confused by your step number 6.
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Mon Jun 02, 2008 9:12 pm   
 
There's a Window (untitled) and a Module (Persistent), both in the untitled package tab. Are you putting the variables under the window directly? I pasted the XML to make it easier to recreate the settings just as I have them, but I could see where the instructions might throw you off just a little...
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Jun 02, 2008 9:17 pm   
 
Oops, OK. I missed the part where the "Test1" module needed to be pasted into a different package. I had it in the untitled package too. Now that I followed the instructions correctly, I have reproduced the problem.

I also noticed that when pasting these modules into CMUD, they are marked as "Local" instead of "Global", even though the XML says "Global=true". Maybe that is something new in 2.26, but I need to fix that too.

Edited: OK, found both of these bugs and have them fixed for 2.26.
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