Lost in LUA

Scripts and support for your favorite MUD client.
Vaarkus
Sojourner
Posts: 7
Joined: Fri Apr 06, 2018 9:14 pm

Lost in LUA

Postby Vaarkus » Fri Apr 06, 2018 9:24 pm

Hello reader,

First I need to make it clear that I am not typical. I suffered a severe head injury that has left me handicaped when it comes to forming opions, making choices, and interpreting information.

That being said, I need help trying to create a graphical representation of my hp and whatever else is important to see. I can create a bar using Gyser(maybe spelled wrong) and I can style it, but I dont know how to make it capture my hp. Mostly I dont know how to translate the prompt in to code. I know its alot to ask and I would understand if people are too busy or whatever they have going on. Either way thank you for taking the time to read this post and I hope y'all have a great day.

Sincerly,
Vaarkus
Nyyrazzilyss
Sojourner
Posts: 30
Joined: Tue May 19, 2015 6:30 am

Re: Lost in LUA

Postby Nyyrazzilyss » Sat Apr 07, 2018 8:41 pm

Afu has an example hp gauge in another thread, however, assuming you're using my script with mudlet another way to create one would be to look for the script in it named 'promptEvent', and at the start of it replace one of the first lines ( 'function promptEvent(event)' with the below code. This will create a basic gauge showing hp.

In particular when it comes to the prompt, I have a trigger that captures all prompt information and places it into an accessible structure.

The lua command prompt:get( "variablename" ) will return any value from the prompt. variablename = hp, maxhp, etc

In the below code, the line 'hpBar:setValue( prompt:get("hp"), prompt:get("maxhp") )' by itself is sufficient to place your hp into a pre-existing gauge named 'hpBar'


Code: Select all

function promptEvent(event)
   -- testing: hp gauge

   if not hpBar then
      hpBar = Geyser.Gauge:new({  name="hpBar", x="54%", y="50%", width="10%", height="20px",})

      hpBar.front:setStyleSheet([[background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #98f041, stop: 0.1 #8cf029, stop: 0.49 #66cc00, stop: 0.5 #52a300, stop: 1 #66cc00);
         border-top: 1px black solid;
         border-left: 1px black solid;
         border-bottom: 1px black solid;
         border-radius: 7;
         font-size:18px;
         padding: 3px;
      ]])

      hpBar.back:setStyleSheet([[background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #cc3300, stop: 0.1 #cc6600, stop: 0.49 #ff0000, stop: 0.5 #993300, stop: 1 #993300);
         border-width: 1px;
         border-color: black;
         border-style: solid;
         border-radius: 7;
         font-size:18px;
         padding: 3px;
      ]])
   end

   if hpBar then
      hpBar:setValue( prompt:get("hp"), prompt:get("maxhp") )
   end
Vaarkus
Sojourner
Posts: 7
Joined: Fri Apr 06, 2018 9:14 pm

Re: Lost in LUA

Postby Vaarkus » Sun Apr 08, 2018 6:50 am

Thank you so very much! You have no idea how much this will help me. Thank you.

Return to “MUD Client Help”

Who is online

Users browsing this forum: No registered users and 14 guests