[ SOLVED ] Quick Geyser and GMCP question

fetaera
Posts: 191
Joined: Sat Aug 03, 2013 7:00 pm

Re: Quick Geyser and GMCP question

Post by fetaera »

Honestly, I can't stress hard enough just how bad an idea it is to use a prompt detection trigger for this. You're going to experience severe performance issues before long.

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

Re: Quick Geyser and GMCP question

Post by Iktomi »

What else should I try then? I'm not sure where else to put it. Having it as a prompt detector is the only thing that I've found that works...

If I understand Oneymus' suggestion correctly, doing

Code: Select all

function charStatus()
    mylevel = gmcp.Char.Status.level
    mygold = gmcp.Char.Status.gold
    myname = gmcp.Char.Status.fullname   
    mymessages = gmcp.Char.Status.unread_msgs
    mynews = gmcp.Char.Status.unread_news
    myage = gmcp.Char.Status.age

nameinfolabel:echo(myname.."<br>Level: "..mylevel.."<br>Age: "..myage.."<br>Gold: "..mygold.."<br>Messages: "..mymessages.."<br>Unread News: "..mynews)
end

charStatus()
...with the function being called at the end, does not work for me, it doesn't update the nameinfolabel

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

Re: Quick Geyser and GMCP question

Post by Knute »

fetaera may have a point.

The other way that you could do it is to call the function when certain things happen in the mud, such as picking up gold, or if there is a message that comes up when you have unread messages, that sort of thing.

Since your name probably isn't going to change soon, and you know when you pick up gold.
If you aren't having performance issues, then don't worry about it. I would caution you that putting a ton of functions on the prompt -can- cause performance issues, as the prompt is a pretty regular thing, so if you have other functions that are running off the prompt (status gauges for instance that track health, etc..) You may want to make sure that you aren't doubling up that info you are getting.
--
Knute

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

Re: Quick Geyser and GMCP question

Post by Oneymus »

Iktomi wrote:If I understand Oneymus' suggestion correctly, doing
You are definitely not understanding my suggestion. I even gave you the exact code to copy and paste into the charStatus script object. You do not need to call charStatus yourself: it is called when the gmcp.Char.Status event is raised.

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

Re: Quick Geyser and GMCP question

Post by Iktomi »

Except it doesn't work. See the screenshot below.

You can see that I sent myself a message, then checked my SCORE which, as indicated, calls gmcp.Char.Status.

In that SCORE screen you can see that it says I have 1 message, but as indicated in the upper left, the label which the value is echoed to does not show that I have a message.

On the far left of the image you see that the script is exactly as you suggested (with the addition of some styles for the echo). You can also see that gmcp.Char.Status is registered as an event handler.


If I call the function manually from the input line with -- lua charStatus() -- then the label updates just like it should.

The function isn't being called when the event is raised.
Attachments
proof.png

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

Re: Quick Geyser and GMCP question

Post by Oneymus »

Except your script is no longer named "charStatus". It's now named "CharacterStatus". For the event to work, your script must be named the same as the function you wish to call. In one of your earlier screenshots, the one to which I responded with the solution, this was true.

Before you come back with "it doesn't work", I highly suggest you do your due diligence and make sure you've done everything you can to make sure you aren't the problem. This includes double-checking variable names, function names, script names. Open the error dialogue. If it's giving you an error, figure it out.

The tools are all at your fingertips, and the solution is reachable on your own. Programming isn't magic. It's the very embodiment of logic and determinism. It's an intellectual exercise that, yes, can be mystifying and frustrating. But there's always a reason something doesn't work, and 9 times out of 10 it's programmer error.

I apologize if this comes across as snarky. I understand your frustrations. I can see that you put a lot of time into your screenshots to prove to me it doesn't work. But I noticed the problem within a few seconds. That time would have been better spent debugging.

Chalk it up to experience if you want, but that was experience earned after hours of banging my head against the wall debugging problems exactly like this. I promise, it gets easier with time.

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

Re: Quick Geyser and GMCP question

Post by Iktomi »

Oh thank goodness.

Don't worry, I didn't take it as (too) snarky. None more than my own post, heh. And believe me, I know all about programmer error and how frustrating it is.

I don't remember when or why the script name got changed, but that fixed it. Even though I've used Mudlet on and off for years now, I've never tried my hand at working on scripts, just triggers and aliases, so I'm still learning the rules.

I want to thank everyone who posted, sometimes repeatedly, to help me figure out something that's really easy once you get the hang of it!

Post Reply