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


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Fri Dec 03, 2010 3:00 am   

[3.32] Bug when calling a function using @{} when the function calls an alias.
 
Basically if you call a function that contains an alias using '#call @{"Function()"}' everything within the called function will execute Except any aliases.
In fact I found this bug because I was consistently getting an error that stated one of my aliases had unmatched braces when in fact it did not.
I could type the alias or call it from a trigger or directly from '#call @Function()' and it would work fine.
This test doesn't reproduce the error I was getting, but it does show that something is wrong.

1. Start a blank session and paste the following into the package editor.
2. Type test.

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <alias name="a" copy="yes">
    <value>#print "Alias a is executing."</value>
  </alias>
  <alias name="Test" copy="yes">
    <value><![CDATA[#print "<c red>Calling Alias a.</c>"
a
#print "<c red>Calling Function F1.</c>"
#call @F1()
#print "<c red>Calling Function F2.</c>"
#call @F2("F1()")
#print "<c red>Done calling Function F2.</c>"]]></value>
  </alias>
  <func name="F1" copy="yes">
    <value>#print "Function F1 is executing."
a
#Return</value>
  </func>
  <func name="F2" copy="yes">
    <value>#print "Function F2 is executing."
#call @{$var}
#Return</value>
    <arglist>$var</arglist>
  </func>
</cmud>
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram

Last edited by Arminas on Sat Dec 04, 2010 6:41 pm; edited 2 times in total
Reply with quote
shalimar
GURU


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

PostPosted: Fri Dec 03, 2010 11:05 am   
 
I believe it has been stated that anytime the value of an @something is an aliasname, that is when you need to use #EXEC.

#EXEC {@{$var}}
_________________
Discord: Shalimarwildcat
Reply with quote
Zugg
MASTER


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

PostPosted: Fri Dec 03, 2010 5:38 pm   
 
I'm not sure I follow your script. Your F2 function needs an argument ($var) but when you call it in the "Test" alias, you are not giving it any argument.

Also, you do not need to use " and {} together with #print. Just use one or the other depending upon whether you want to expand variables or not.
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Fri Dec 03, 2010 11:47 pm   
 
Apologies, I was a little tired when I made the post.
I have corrected the original post by adding '"F1()"' to the correct spot in the test alias.
I have also changed the {""} in the #print commands to simply ""; this however makes
no difference to the final result

Note that when the function F1 is called by itself the alias is executed, but when it is called
by the function F2 it is not.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Dec 06, 2010 5:04 pm   
 
OK, I see what you are talking about now. Added to bug list.
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