Difference between revisions of "XP Counter for MUSHclient"

From Discworld MUD Wiki
Jump to: navigation, search
m (Added backlink)
m (Text replacement - "http://discworld.starturtle.net/" to "https://discworld.starturtle.net/")
Line 1: Line 1:
This is an XP Counter for [[MUD_client#MUSHclient|MUSHclient]] by [http://discworld.starturtle.net/lpc/secure/finger.c?player=beale Beale] and [http://discworld.starturtle.net/lpc/secure/finger.c?player=sciante Sciante].  
This is an XP Counter for [[MUD_client#MUSHclient|MUSHclient]] by [https://discworld.starturtle.net/lpc/secure/finger.c?player=beale Beale] and [https://discworld.starturtle.net/lpc/secure/finger.c?player=sciante Sciante].  
Copy the following into a notepad file, or similar:
Copy the following into a notepad file, or similar:

Latest revision as of 16:29, 30 November 2020

This is an XP Counter for MUSHclient by Beale and Sciante.

Copy the following into a notepad file, or similar:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient [
  <!ENTITY trigger_match 
   "(?:> |)Hp: (\d+) ?\((\d+)\) +(?:Gp: (\d+) ?\((\d+)\)) +(?:Xp: (\d+))($|  Burden: (\d+\%)$)"> 
<!-- Saved on Monday, April 28, 2003, 9:53 AM -->
<!-- MuClient version 3.41 -->

<!-- Based on the Plugin "Health_Bar" (by Nick Gammon) generated by Plugin Wizard -->
<!-- Rewritten in LUA by Beale (Ian Kirker) -->
<!-- Modified by Sciante (Magnus Lundborg) to show xp and time statistics -->
<!-- and to work properly using wine in Linux (sorry that the bars had to go) -->
<!-- Slightly inspired by the Timer plugin by Nick Gammon -->
<!-- Sux2b VBScript. -->
<!-- This version has been updated to account for the addition of burden to 'score brief'.-->

You will probably need to customise the trigger to match your MUD.

See ENTITY line near top of file. The above trigger will match on:

  Hp: x (X) Gp: y (Y) Xp: z

where x, X, y, Y and z are numerical values.

   author="Magnus Lundborg"
   purpose="Shows HP, GP, XP as well as using a timer to calculate xp gain"
   date_written="2003-04-28 09:50:05"
   date_modified="2005-05-05 16:00"
<description trim="y">
Install this plugin to show an info bar with HP, GP, 
and Experience points. You also get information about xp gain over
a given time period, which can be reset by typing "resettimer".

You need your score line to display the appropriate information,

Customise the plugin if you want to match a different sort of score line.

To see this message, type: Statistics_Bar:help



<!--  Triggers  -->


<!--  Aliases  -->


<!--  Script  -->


local time=0
local basexp
local xp
local mins

--  Called by alias to zero timer
function TimerToZero (sName, sLine, wildcards)
	time = 0
	world.Info("Timer and xp counter reset. Restarted on next score output.")

function DoPrompt(sName, sLine, wildcards)

	local xpdiff
	local timediff
	local str


	if time==0 then
		time = world.GetConnectDuration()


	timediff = (world.GetConnectDuration()) - time


	--This is the font used in the text.
	--Clear the Infobar.
	world.Info("HP: " .. wildcards[1] .. " \(" .. wildcards[2] .. "\) ")
	world.Info("  GP: " .. wildcards[3] .. " \(" .. wildcards[4] .. "\) ")
	world.InfoFont(sFont, 12, 1)	
	world.Info("  XP: " .. xp)
	world.Info("           " .. xpdiff .. " xp gained in " .. mins .. " minutes")
	world.Info("         Average xp/hour: " .. (math.floor ((xpdiff/(timediff/3600))*10+0.5))/10)
	world.Info("                  To reset the time and xp counter type \"resettimer\"")

--  Do this once


Save the file as:

in c:\Program Files\MUSHclient\worlds\plugins\ (or where ever your plugins for MUSHclient are located.)

Next, in MushClient select 'File' from the top menu, then 'Plugins'. Hit the Add button, click on statistics_bar-lua.xml to select it, then hit open. The file should now be listed on your plugins window. Now type score brief into the mud, if it's working some extra text should show up in your info bar near the bottom of the Mushclient window. To track your xp, the trigger needs you to use the "score brief" command frequently in order to make the calculations. It's a good idea to add it to the beginning and end of your idle aliases. Be sure your info bar is being displayed: Select View from the top menu, and Info Bar should be checked.

If you ever want to restart the timer, go to File, then Plugins, then hit the ReInstall button while the script name is highlited. This is essential after spending xp. (or simply type resettimer into the mud)

To adjust the font size (which may be necessary, depending on how big your window is), modify the "12" in this line:

	world.InfoFont(sFont, 12, 1)