[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
Username:
Register forum user name
Password:
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)
Message
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 -->

<muclient>
<plugin
name="Health Change"
author="Jinze"
id="99e5a40f9e8c83f43dba7ff4"
language="Lua"
purpose="Shows Health Changes"
save_state="y"
date_written="2006-05-31 15:53:56"
requires="3.7"
version="1.2"
>

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

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

]]>
</description>

<triggers>
<trigger
enabled="y"
expand_variables="y"
group="Prompt"
keep_evaluating="y"
match="(?P&lt;chp&gt;\d+)h, (?P&lt;cmp&gt;\d+)m, (?P&lt;end&gt;\d+)e ([cexkdb]+)\-$"
regexp="y"
script="HPprompt"
send_to="12"
sequence="100"
>
<send>world.SetVariable("chp", %&lt;chp&gt;)
world.SetVariable("cmp", %&lt;cmp&gt;)

</send>
</trigger>
</triggers>

<aliases>
<alias
match="^prompt (on|off)$"
expand_variables="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>if "%1" == "on":
world.EnableTriggerGroup("Prompt", 1)
else:
world.EnableTriggerGroup("Prompt",0)
</send>
</alias>
</aliases>

<script>

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) + ']')
world.SetVariable('CSHP',chp)

</script>

=========================================

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)
Message
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

http://david.the-haleys.org
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #2 on Thu 01 Jun 2006 04:12 AM (UTC)
Message
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,391 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

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


</muclient>


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;

    or

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

    
    <script>
    <![CDATA[
    
    ... your script here ...
    
    ]]>
    </script> 
    


    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.


3,624 views.

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.

[Home]


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]