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


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Wed Jan 09, 2008 6:44 am   

[2.18] %eval issues **Main problem found, possible bug?**
 
EDIT: Reduced spam since problem was found. Read below about numbered aliases and %eval functions processing the alias first.

Charneus


Last edited by charneus on Tue Jan 15, 2008 8:41 am; edited 4 times in total
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Wed Jan 09, 2008 7:36 am   
 
I see 9 and hours:1 mins:5 secs:17 respectively in untitled session. There is something on your side.
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Wed Jan 09, 2008 7:44 am   
 
I figured as much, but I don't see what it could be that's causing that. It's not triggers or anything. I guess worse comes to worse, I'll reinstall and see if that fixes it. But it's just weird...

Charneus

EDIT: One thing I've found out is that it works in my captures window, but doesn't show anything to the main output...
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Wed Jan 09, 2008 11:16 pm   
 
Bumping this up. See the above. I decided to edit the original post instead of creating this new one, but found out it doesn't bump it. :\

Charneus
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Thu Jan 10, 2008 8:26 pm   
 
Not so much a solution, but a way to work around it..
Use the #MATH command since it also evaluates expressions.

Code:
<func name="eval" id="35">
  <value>#var eval_temp {}
#math  eval_temp %params(1)
#return @eval_temp
</value>
</func>


#ECHO @eval(30-%len("somestupidthing")+58)
instead of
#ECHO %eval(30-%len("somestupidthing")+58)
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Thu Jan 10, 2008 10:18 pm   
 
Right, but the problem is, this script is disabling the %eval function, which I use in a lot of other scripts. I don't think scripts should be able to do that. So I'm guessing it's a bug of some sort that a script can terminate usage of it.

Charneus
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Thu Jan 10, 2008 11:55 pm   
 
How did you export that to XML?

The 'MQF_Zroom6' variable isn't correctly exported. It contains < and > which weren't changed to &gt and &lt properly in the export you posted.


<var name="MQF_Zroom6">%mapquery( %concat( "[ZoneId] = ", %1, " AND ([Name] LIKE '", %string(%2), "' OR [Name] LIKE '", %string(%2), " (G)' OR [Name] LIKE '", %string(%2), " [[]**> PK <**[]]')"))</var>

rather than

<var name="MQF_Zroom6">%mapquery( %concat( "[ZoneId] = ", %1, " AND ([Name] LIKE '", %string(%2), "' OR [Name] LIKE '", %string(%2), " (G)' OR [Name] LIKE '", %string(%2), " [[]**> PK <**[]]')"))</var>


Edit: damn, when I try to post with '& g t' (without the spaces) it's getting changed to >. anyway, the export isn't right in the one you posted Charneus ;)
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Fri Jan 11, 2008 12:05 am   
 
Actually, it imports correctly. The forum eats the &gt and &lt. *shrug* Could someone import it into an untitled session and see if it affects their %eval? I've done it, so I know it affects mine... Of course, in order to import it correctly, you'll have to change that variable so that it reads the PK. But then again, you can just take that part out...

Charneus
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Fri Jan 11, 2008 8:45 am   
 
Ok... so now I'm getting somewhere.

Apparently, the bug lies in with using numbers as aliases. In the script, there are 20 numbered aliases (1-20). %eval is NOT broken after all. It just won't output any number that is matched by an alias. For example:

Code:
#alias 1 {do something here}
#SHOW %eval(10-9)
//blank line shown
#SHOW %eval(10-8)
2


I'm not sure how many other people actually use numbers in their aliases, but this does pose quite a big problem, so I'm gonna guess that it's a bug. That's just my thoughts, though.

Charneus

EDIT: Additional info - if you type #show %eval("10-9"), it'll show 1 appropriately...
Reply with quote
Tech
GURU


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

PostPosted: Fri Jan 11, 2008 9:54 am   
 
I don't think this a bug. Personally I think it breaks most naming conventions to have an alias as a number (sort of along the line of not allowing the '-' in the alias name.)
_________________
Asati di tempari!
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Fri Jan 11, 2008 3:39 pm   
 
If it's not a bug, then it's a very big inconvenience. I use the script to be able to choose from a list of rooms that I will walk to, and it's much easier to type "17, enter" than "seventeen, enter." I can't use letters because, well, most letters are shortcuts for something else (such as "d" for "down," "c" for "cast," etc.) I suppose I could make macros, but then that limits my ability to use numbers in general chat.

But the fact remains that it's showing a blank line instead of the number. But if I convert it to a string, then it shows up properly. And if I have an alias named 1, I can still do %eval(10-1) with no problem. The only problem is if I type %eval(10-9).

Using numbers as an alias wasn't a problem in zMUD, so I don't see why it would be a problem in CMUD. Didn't stop any functions/commands, didn't break any scripts, and was just another alias. *shrug* But what do I know? I just try to write scripts for ease of use. :\

Charneus

And Tech, I'm not trying to sound pissy towards you. I just woke up, and probably would have said things in a nicer way, but my brain can't function like that right now. So please, just take it with a grain of salt. :P
Reply with quote
FishyBug
Newbie


Joined: 10 Jan 2008
Posts: 3

PostPosted: Fri Jan 11, 2008 3:46 pm   
 
Aliases shouldn't START with a number. Try starting each alias with a single letter and you should be fine. Something like R##.
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Fri Jan 11, 2008 4:18 pm   
 
As a workaround, you could use an #ONINPUT trigger instead of an alias.
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Fri Jan 11, 2008 4:31 pm   
 
I also use numbers as an alias, for casting certain spells. I always have and always will. Of course I use MUD based aliases for it so it isn't a problem for me either ;) There is nothing quite as simple as "1 frog" to have inferno casted on the frog ;) But again, I do this in mud, all my zMUD/CMUD aliases are 2 characters long or more and all are alphabetic characters only.hat

Still, as an aside, that is a fairly weird behavior in zMUD, I would think this falls into that "undocumented and unintended" functionality.
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
MrCheviot
Novice


Joined: 02 Dec 2007
Posts: 42

PostPosted: Fri Jan 11, 2008 4:33 pm   
 
Agreening w/ FishBug here - 'c1' and 'c2' for casting, 'r1' or 'r17' for running, etc?

Surely prepending a single letter and moving on isn't that big of a deal, is it? Might seem awkward for a few days, but like everything else you'll get used to it.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Fri Jan 11, 2008 5:24 pm   
 
Guinn, I don't know why I didn't think of that originally. I've used #ONINPUT in a number of cases, and this works much better now... using ^(%d)$ instead of having 20 different aliases. :P Thanks for the suggestion.

Charneus
Reply with quote
Taz
GURU


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

PostPosted: Fri Jan 11, 2008 6:00 pm   
 
CMUD does allow aliases to begin with numbers. It didn't originally but because so many zMUD users had used aliases beginning with numbers, an unintended feature, Zugg decided to allow the behaviour.

This is still potentially a bug report but glad to see you have a workaround charneus.
_________________
Taz :)
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Jan 11, 2008 9:28 pm   
 
I did a quick test of this and have to say it is a bug, %eval should not be affected by the existence of an alias with a particular name. My testing didn't find any other expression methods to be affected.

Procedure
1. Launch CMud
2. Close Sessions window (ESC)
3. Enter at the command line
Code:
#ALIAS 1 {a};#ALIAS abc {bad}

4. Enter at the command line
Code:
#SHOW {1:%eval(1) 2:%eval(2) abc:%eval(abc)}
_________________
The only good questions are the ones we have never answered before.
Search the Forums
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