[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  what's wrong with this?
Home  |  Users  |  Search  |  FAQ
Register forum user name
Forgotten password?

what's wrong with this?

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Posted by Aznvt33   (18 posts)  [Biography] bio
Date Thu 01 Jun 2006 01:36 AM (UTC)
I am trying to write a plugin for Achaea and I think everything is alright but now i'm stuck. I keep getting this error:

Line 73: Element name must start with letter or underscore, but starts with " " (problem in this file)


Here is the actual plugin:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Wednesday, May 31, 2006, 3:53:56 PM -->
<!-- MuClient version 3.70 -->

name="Health Change"
purpose="Shows Health Changes"
date_written="2006-05-31 15:53:56"

<description trim="y">
This plugin will show health changes on your prompt when you heal or are attacked.

prompt (on|off) to turn it on or off


match="(?P&lt;chp&gt;\d+)h, (?P&lt;cmp&gt;\d+)m, (?P&lt;end&gt;\d+)e ([cexkdb]+)\-$"
<send>world.SetVariable("chp", %&lt;chp&gt;)
world.SetVariable("cmp", %&lt;cmp&gt;)


match="^prompt (on|off)$"
<send>if "%1" == "on":
world.EnableTriggerGroup("Prompt", 1)


def = HPprompt(name,output,wildcards):
world.SetVariable('chp', wildcards[0])
world.SetVariable('cmp', wildcards[1])
CSHP = int(world.GetVariable('CSHP'))
chp = int(wildcards[0])
defs = wildcards[3]

diff = CSHP-chp
if diff < 0:
diff = str(diff)
Ndiff = diff.replace('-','+')
diff = Ndiff
world.ColourTell('Silver','black','[' + str(diff) + ']')

elif diff:
world.ColourTell('Silver','black','[-' + str(diff) + ']')



Any ideas?
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #1 on Thu 01 Jun 2006 01:57 AM (UTC)
Well, that's not Lua code, so it's not surprising that it's not working correctly since you're telling it to work as Lua. :) Try setting the language to Python.

Also, in the future, you should use the code tag to make it easier to read the plugin, and also indicate which line is the trouble-line, so that we know where to look.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #2 on Thu 01 Jun 2006 04:12 AM (UTC)
You might want to take a look at http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=6606&page=999999

The plugin there is much bigger, but it's Lua and it does what you want.
[Go to top] top

Posted by Nick Gammon   Australia  (21,607 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Thu 01 Jun 2006 05:45 AM (UTC)

Amended on Thu 01 Jun 2006 05:46 AM (UTC) by Nick Gammon

Well for one thing the plugin is missing the final line:


However let's assume you have that there and didn't paste it into the message.

Line 74 is this line:

if diff < 0:

The problem here is that, the XML parser that is reading in the plugin is expecting an entity name (like <script> ) after the "<" symbol.

Your solution is to do either:

  • Change every < into &lt; and > into &gt; and & into &amp;


  • Bracket the entire script in a CDATA block, like this:

    ... your script here ...

    Now, you can leave everything as it is (assuming you don't have "]]>" inside the script itself).

Also, as Ksilyan said, you may have chosen the wrong language when you created the plugin, you might want to change that.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum

[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]