[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]  Plugins
. . -> [Subject]  Adapting health bar plugin to Geas MUD
Home  |  Users  |  Search  |  FAQ
Register forum user name
Forgotten password?

Adapting health bar plugin to Geas MUD

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

Posted by Chaotzin   (2 posts)  [Biography] bio
Date Mon 30 Oct 2017 08:25 PM (UTC)
Hi all

I'm very new to scripting but have started playing Geas MUD and would like to adapt a few simple plugins to working over there.

As a start, I'm trying to modify Nick's 'improved health bar plugin' (as seen here: https://www.gammon.com.au/forum/bbshowpost.php?id=9270&page=1).

Geas MUD uses a text/description based prompt as opposed to a numerical one. The prompt always reports on physical, mental and fatigue status, but also reports on stamina when that value is not 100%.

The physical/mental/fatigue output looks like this:

You are slightly hurt, in full vigour and extremely alert.

And with stamina:

You are somewhat hurt, slightly degraded, extremely alert and breathing slightly faster.

I've modified the trigger in Nick's plugin to identify this prompt and to name the variables physical, mental, fatigue and stamina. When a stamina message doesn't show, the trigger picks up the punctuation instead for that variable - I plan to use this to give stamina a 100% value. The full trigger looks like this:

   match="^You are (?<physical>(at deaths door|barely alive|terribly hurt|in a very bad shape|in a bad shape|not in a good shape|not feeling very well|hurt|somewhat hurt|slightly hurt|feeling very well))\, (?<mental>(in a vegetable state|exhausted|worn down|indisposed|in a bad shape|not in a good shape|not feeling very well|degraded|somewhat degraded|slightly degraded|in full vigour))(\,| and) (?<fatigue>(extremely exhausted|very exhausted|exhausted|somewhat exhausted|slightly exhausted|extremely tired|very tired|tired|somewhat tired|slightly tired|extremely weary|very weary|weary|somewhat weary|slightly weary|slightly alert|somewhat alert|alert|very alert|extremely alert))( and )?(?<stamina>(completely out of breath|having trouble breathing|panting heavily|panting|breathing heavily|short of breath|slightly short of breath|breathing slightly faster|\.))\.?$"

I've tested this just by printing the wildcards and it all seems to work OK up to here. But I've run into a problem trying to assign numerical values to these descriptions.

This is my attempt at a table with numerical values that I've assigned to the various physical messages:

physical = { 
	"at deaths door" = 10,
	"barely alive" = 19, 
	"terribly hurt" = 28, 
	"in a very bad shape" = 37, 
	"in a bad shape" = 46, 
	"not in a good shape" = 55, 
	"not feeling very well" = 64, 
	"hurt" = 73, 
	"somewhat hurt" = 82, 
	"slightly hurt" = 91, 
	"feeling very well" = 100 

And the subsequent action to use these values in the do_prompt function:

function do_prompt (name, line, wildcards)

  local physical = physical [wildcards.physical]

I haven't used tables before so I expect I've got that part wrong. Appreciate any advice.

[Go to top] top

Posted by Fiendish   USA  (1,774 posts)  [Biography] bio   Global Moderator
Date Reply #1 on Mon 30 Oct 2017 10:45 PM (UTC)

Amended on Mon 30 Oct 2017 10:46 PM (UTC) by Fiendish


physical = { 
	["at deaths door"] = 10,
	["barely alive"] = 19, 
	["terribly hurt"] = 28, 
	["in a very bad shape"] = 37, 
	["in a bad shape"] = 46, 
	["not in a good shape"] = 55, 
	["not feeling very well"] = 64, 
	["hurt"] = 73, 
	["somewhat hurt"] = 82, 
	["slightly hurt"] = 91, 
	["feeling very well"] = 100 


[Go to top] top

Posted by Chaotzin   (2 posts)  [Biography] bio
Date Reply #2 on Tue 31 Oct 2017 09:09 AM (UTC)
Thanks Fiendish. All works perfectly now :)
[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]