Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Doxedon
Novice


Joined: 01 Dec 2007
Posts: 49

PostPosted: Tue Mar 18, 2008 12:01 am   

[2.20] Macro -> Alias/Variable
 
I created a macro to function for Shift-F5 that does FE1 and FJ. When using the Macro, FE1 is returning blank lines, and not calling up the variables/not storing them properly.

Code:

<macro key="SHIFT-F5" id="319">
  <value>fe1;fj</value>
</macro>


FJ is working correctly as far as I can see. FE1 chooses a random line from the stringlists and stores it in line1 and line 2. The variables for FE1 are stored in a different module.
Code:

<alias name="fe1" id="295">
  <value>line1=%item(@illusionWithered,%random(1,%numitems(@illusionWithered)))
line2=%item(@illusionElixslow,%random(1,%numitems(@illusionElixslow)))</value>
</alias>


When using the macro, the output is:
Code:

cast illusion


Doing FE1;FJ manually returns the proper result I'm looking for:
Code:

cast illusion You feel your throat tighten.                                                   Your ability to digest elixirs seems off for some reason.                       


Both Aliases and Macros are in the same module. My thoughts: when the macro is calling up the alias, it isn't parsing the variables.
Reply with quote
Tech
GURU


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

PostPosted: Wed Mar 19, 2008 6:55 am   
 
Can you provide the code the the fj alias? It's hard to test this properly without it. I tried too, but just don't have enough information to make a determination.
_________________
Asati di tempari!
Reply with quote
Doxedon
Novice


Joined: 01 Dec 2007
Posts: 49

PostPosted: Wed Mar 19, 2008 12:10 pm   
 
Code:

<alias name="fj" id="270">
  <value>currentline1=%concat(@line1,%repeat(" ",%eval(80-%len(@line1))))
currentline2=%concat(@line2,%repeat(" ",%eval(80-%len(@line2))))
cast illusion @currentline1@currentline2</value>
</alias>


Essentially, FJ adds in extra spaces to the text in @line1 so that it reaches 80 characters.

The issue is that through the macro, it's not calling up the variable @illusionWithered and @illusionElixslow which is in a separate package to the macro/aliases. The alias works fine, calling up those variables, but the values of line1/2 remain blank when performing the same alias in the macro.
Reply with quote
Tech
GURU


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

PostPosted: Fri Mar 21, 2008 3:12 am   
 
I tried to recreate this error and still didn't get the behavior you described. Here's the code I'm using
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<module name="test" global="true">
  <uid>{C4AE4934-82FE-41E7-8973-8B0E9C42B815}</uid>
  <var name="illusionWithered" type="StringList" copy="yes">look|book|nook|hook|rook</var>
  <var name="illusionElixslow" type="StringList" copy="yes">toy|boy|roy|soy</var>
</module>
  <var name="illusionElixslow" type="StringList" copy="yes">toy|boy|roy|soy</var>
  <var name="illusionWithered" type="StringList" copy="yes">look|book|nook|hook|rook</var>
<window name="untitled" host="0" usesession="false">
  <uid>{189D4896-7EAC-4B2B-A43D-3D30FD973F19}</uid>
  <packages>untitled</packages>
  <macro key="SHIFT-F5" copy="yes">
    <value>fe1;fj</value>
  </macro>
  <alias name="fe1" copy="yes">
    <value>line1=%item(@illusionWithered,%random(1,%numitems(@illusionWithered)))
line2=%item(@illusionElixslow,%random(1,%numitems(@illusionElixslow)))</value>
  </alias>
  <alias name="fj" copy="yes">
    <value>currentline1=%concat(@line1,%repeat(" ",%eval(80-%len(@line1))))
currentline2=%concat(@line2,%repeat(" ",%eval(80-%len(@line2))))
cast illusion @currentline1@currentline2</value>
  </alias>
  <var name="line1" copy="yes">book</var>
  <var name="line2" copy="yes">roy</var>
  <var name="currentline1" copy="yes">book                                                                            </var>
  <var name="currentline2" copy="yes">roy                                                                             </var>
</window>
  <alias name="fe1" copy="yes">
    <value>line1=%item(@illusionWithered,%random(1,%numitems(@illusionWithered)))
line2=%item(@illusionElixslow,%random(1,%numitems(@illusionElixslow)))</value>
  </alias>
  <alias name="fj" copy="yes">
    <value>currentline1=%concat(@line1,%repeat(" ",%eval(80-%len(@line1))))
currentline2=%concat(@line2,%repeat(" ",%eval(80-%len(@line2))))
cast illusion @currentline1@currentline2</value>
  </alias>
  <var name="currentline1" copy="yes">book                                                                            </var>
  <var name="currentline2" copy="yes">roy                                                                             </var>
  <var name="line1" copy="yes">book</var>
  <var name="line2" copy="yes">roy</var>
  <macro key="SHIFT-F5" copy="yes">
    <value>fe1;fj</value>
  </macro>
</cmud>



The output I get from the alias combo and the macro is the same.
Code:
cast illusion hook                                                                            soy                                                                             
cast illusion look                                                                            toy                                                                             
cast illusion look                                                                            roy                                                                             
cast illusion look                                                                            soy                                                                             
cast illusion book                                                                            roy                                                                             
cast illusion rook                                                                            toy                                                                             
cast illusion hook                                                                            soy                                                                             
cast illusion book                                                                            toy                                                                             
cast illusion rook                                                                            toy                                                                             
cast illusion hook                                                                            boy                                                                             
cast illusion book                                                                            roy                                                                             


What is the scope of your module?
_________________
Asati di tempari!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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