[ SOLVED ] Quick Geyser and GMCP question

Iktomi
Posts: 46
Joined: Sat Sep 03, 2011 4:00 am

Re: Quick Geyser and GMCP question

Post by Iktomi »

Sorry it took so long. Here's what the script looks like.
Attachments
script.jpg

Knute
Posts: 87
Joined: Fri Mar 05, 2010 12:08 am

Re: Quick Geyser and GMCP question

Post by Knute »

Changing the size of the text using Geyser is easy.

Code: Select all

whatever:echo(<text you want to echo>, <text color>, <text formatting>)
The <text you want to echo> can either be a variable or "text".
<text color> can either be nil (which means it won't change the color) or a "color" from the showColors() function.
<text formatting> can be nil or a justification such as c for center and or a text size.

Code: Select all

test:echo("Test text going to be red and centered size 12", "red", "c12")
p.s. The way that you have your function written, MAY lock up mudlet, as you have it being called from within the function. Not a great way to keep that info up to date.

HTH
--
Knute

Iktomi
Posts: 46
Joined: Sat Sep 03, 2011 4:00 am

Re: Quick Geyser and GMCP question

Post by Iktomi »

Hey Knute, thanks for the info. What would be a better way to do it? I can't get it to update at all unless I'm saving the script after altering it.

Knute
Posts: 87
Joined: Fri Mar 05, 2010 12:08 am

Re: Quick Geyser and GMCP question

Post by Knute »

Well, do you have gauges that you update? You could toss the function in there.

The other option has already been mentioned, and that is to update it with the prompt.
Also, since you are checking gold, you could call the function every time you pick up gold, or whatever other status messages show up. Just call your function from those triggers, and the data will refresh, even if you have the prompt method as well.
--
Knute

Iktomi
Posts: 46
Joined: Sat Sep 03, 2011 4:00 am

Re: Quick Geyser and GMCP question

Post by Iktomi »

Okay, now I'm really confused. I created the -- return isPrompt() -- trigger with -- charStatus()-- as the action. It is still not updating my little window with the correct values!

Here is the whole section for this label:

Code: Select all

nameinfolabel = Geyser.Label:new({
  name = "nameinfolabel",
  x = 4, y = "4%",
  width = 296, height = 200,
})
nameinfolabel:setColor(35, 0, 0)
nameinfolabel:setStyleSheet([[
  qproperty-alignment: 'AlignLeft | AlignTop';
  font-family: Calibri;
  font-size: 30;
  font-style: bold;
  border: 2px solid firebrick;
  font size="30"
]])

nameinfolabel:echo(myname.."<br>Level: "..mylevel.."<br>Gold: "..mygold.."<br>Messages: "..mymessages)
edit: the font-family tag in there works, but not the other. I tried it the way that you suggested, putting the info in the echo, but I think since there's so many concat'd stuff in there, it doesn't pay any attention to it.

Knute
Posts: 87
Joined: Fri Mar 05, 2010 12:08 am

Re: Quick Geyser and GMCP question

Post by Knute »

Ok, so let's step back here. This last that you posted sets up your lablel, it's position, etc....

Your echo in that code will update it with the information in those variables at that time.
You function is what keeps the info current.

Ok, now your trigger for your prompt.... Does it resemble your prompt in any way?

So if your prompt was: 400hp, 300mp, 100end >
Then your trigger for the prompt would have to look something like: (\d+)hp, (\d+)mp, (\d+)end >

Does that make sense?
--
Knute

User avatar
Akaya
Posts: 412
Joined: Thu Apr 19, 2012 1:36 am

Re: Quick Geyser and GMCP question

Post by Akaya »

Changing font size:
Code: [show] | [select all] lua
mylabel:echo([[<span style="font-size:20px">Hello World</span>]])
Changing font color AND size:
Code: [show] | [select all] lua
mylabel:echo([[<span style="color: yellow"><span style="font-size: 16pt">Hello World Again!</span></span>]])

User avatar
Oneymus
Posts: 321
Joined: Thu Sep 17, 2009 5:24 am

Re: Quick Geyser and GMCP question

Post by Oneymus »

It looks to me like, if you just removed that call to charStatus within the charStatus function (which will cause it to call itself infinitely, or until you hit a stack overflow), you should be fine. It should update every time the gmcp.Char.Status event is raised by Mudlet.

With the script as you have it now, with the name and event the way it is, just copy and paste what I gave you in the script box. Unless something else is terribly broken in your setup, it should work.

Iktomi
Posts: 46
Joined: Sat Sep 03, 2011 4:00 am

Re: Quick Geyser and GMCP question

Post by Iktomi »

Sometimes I hate coding.

The problem was my label was named "nameinfolabel" and the echo that I was trying to do was "namelabel:echo"

I do have the function being called from a -- return isPrompt() -- trigger though.

ANYWAYS. Moving on the label styling.

Akaya, your suggestion works... except for when the variables are included. Doing:

Code: Select all

nameinfolabel:echo([[<span style="color: yellow"><span style="font-size: 16pt">myname.."<br>Level: "..mylevel.."<br>Gold: "..mygold.."<br>Messages: "..mymessages</span></span>]])
Just echoes the variable name.

Knute
Posts: 87
Joined: Fri Mar 05, 2010 12:08 am

Re: Quick Geyser and GMCP question

Post by Knute »

You need to use braces to single them out:

Code: Select all

    nameinfolabel:echo([[<span style="color: yellow"><span style="font-size: 16pt">]] .. myname .. [["<br>Level: "]] .. mylevel .. [["<br>Gold: "]] .. mygold .. [["<br>Messages: "]] .. mymessages .. [[</span></span>]])
--
Knute

Post Reply