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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  MUSHclient LUA plugins that use a "Dummy" World - HELP!!

MUSHclient LUA plugins that use a "Dummy" World - HELP!!

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


Posted by Zantiln   (9 posts)  [Biography] bio
Date Fri 07 Nov 2008 08:17 PM (UTC)
Message
Does anyone know of any examples or VERY simple plugins that I could look at to help me create my own plugin to display, for example, the real-time value of my health points, updated every second or so?

I tried to look at the source code for the Aardwolf_Stats plugin, but there is too much going on for me to understand what does what.

I have already created a "Dummy" World in my MUSHclient using the quick connect feature, and its setup for IP 0.0.0.0. Now if I can just find a very simplified .XML file or code sample that will:

1 - Capture my current health points (similar to how Aardwolf_Stats script captures your stats)
2 - Clear all the text in the "Dummy" World
3 - Display the captured value in the "Dummy" World
4 - Repeat steps 1 through 3 every second

Eventually, if I can learn how to do the above, I would like to create a plugin that will monitor and display multiple stats, spells, and other info in real-time.

Can anyone help? Thanks in advance...
[Go to top] top

Posted by Nick Gammon   Australia  (23,000 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sat 08 Nov 2008 02:56 AM (UTC)
Message
See http://mushclient.com/faq point 23 for some details about that.

You could use DeleteOutput to remove the output window contents (on the dummy world, not the main world).

http://www.gammon.com.au/scripts/doc.php?function=DeleteOutput

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,000 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Sat 08 Nov 2008 03:35 AM (UTC)
Message
You might be much better off using miniwindows rather than a dummy world. This saves mucking around making the world, and sending stuff to it.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,000 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Sat 08 Nov 2008 03:49 AM (UTC)
Message
To get you started, here is a simple plugin that shows the current exits (in a miniwindow). It simply uses a trigger that matches the exits line, and when found, makes a window in the top-right corner to show that, so you can always see where the exits are.


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>

<muclient>
<plugin
   name="Show_Exits"
   author="Nick Gammon"
   id="c6b565073f07ed0679e13d16"
   language="Lua"
   purpose="Shows the current exits"
   date_written="2008-11-08"
   requires="4.34"
   version="1.0"
   >
<description trim="y">
<![CDATA[
Shows the current exits in a miniwindow.
]]>
</description>

</plugin>


<!--  Triggers  -->

<triggers>

  <trigger
   enabled="y"
   match="Exits: *"
   script="exits_line"
   sequence="100"
  >
  </trigger>
    
</triggers>

<!--  Script  -->


<script>
<![CDATA[

-- configuration

background_colour = 0xE7FFFF
text_colour = 0x000000
font_name = "FixedSys"   


function Display_Line (line, text, id, colour)

local left = 5
local top =  (line - 1) * font_height

  WindowText (win, id, text, left, top, 0, 0, colour)

end -- Display_Line

function exits_line (name, line, wildcards, styles)
  
  width = WindowTextWidth (win, font_id, line)
  
 -- recreate the window the correct size
  WindowCreate (win, 
               0, 0,   -- left, top (auto-positions)
               width + 10,     -- width
               font_height + 5,  -- height
               6,       -- auto-position: top right
               0,  -- flags
               background_colour) 
  
  Display_Line (1, line, font_id, text_colour)
    
  WindowShow (win, true)

end -- exits_line


function OnPluginInstall ()

  win = GetPluginID ()
  font_id = "fn"

  -- make win so I can grab the font info
  WindowCreate (win, 
                 0, 0, 1, 1,  -- 1 x 1 pixel
                 1,   -- position - irrelevant
                 0,   -- flags
                 0)   -- background colour
                 
  check (WindowFont (win, font_id, font_name, 8))  -- normal
  font_height = WindowFontInfo (win, font_id, 1)  -- height
  
end -- OnPluginInstall

]]>
</script>

</muclient>



- 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.


12,692 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 HostDash]