Greater and lesser operator

Posted by Indoum on Mon 17 Apr 2006 05:23 PM — 3 posts, 14,328 views.

Sweden #0
When doing this alias,
<alias enabled="y" keep_evaluating="y" match="^!(?:symptom|cured) (\w+)" regexp="y" send_to="12">
    <send>if not aff['%1'] and affunknown < 1 then Execute("_illusion symptom/cure without the affliction or unknown registered") end</send>
</alias>


I get this error (line 1134 is the <send></send> one),
Line 1134: Element name must start with letter or underscore, but starts with " " (problem in this file)


It seems to be because of the "affunknown < 1" comparison. When I try to recreate the alias using MUSHclient's builtin editor, it's replaced with "affunknown &lt; 1", which doesn't work well with LUA.
Australia Forum Administrator #1
This is not a bug, you are getting confused between the way aliases are represented when you copy and paste in XML format, and how they are stored internally.

Fixing it up so you can paste it:


<aliases>
  <alias
   match="^!(?:symptom|cured) (\w+)"
   enabled="y"
   regexp="y"
   send_to="12"
   keep_evaluating="y"
  >
  <send>if not aff['%1'] and affunknown &lt; 1 then 
  Execute("_illusion symptom/cure without the affliction or unknown registered") 
end</send>
  </alias>
</aliases>



In the above example the "<" is indeed converted to "&lt;", however when you paste that into the alias screen the "&lt;" becomes "<" again, which is what Lua expects.

I wouldn't be making aliases manually in the text editor myself, just use the GUI screens to do it, then you don't have to worry about the "<" symbols.
Sweden #2
I write all my LUA/XML code in an editor called EditPlus2, far more efficient that way. The builtin editor is iffy and I'm easily lost when searching through thousands of triggers.

Does MUSHclient store the script with &lt; or <? If the first, then I could just enter &lt; in my plugin and MUSHclient would convert it at loadtime, just like with the worldfile?

EDIT: I went ahead and tested it myself, works like a charm.