Welcome to the Achaea Forums! Please be sure to read the Forum Rules.

help with GMCP

ArdrilArdril Member Posts: 2
Okay I'm stumped. I'm trying to create a GUI table for my defences and afflictions. It shouldn't be this hard! But I simply can't figure it out.

You don't have to tell me EXACTLY how to do it or write the whole script for me... just push me in the right direction.

I have Valden's roominventory script and I'm trying to base it off of that, to no avail.

Comments

  • RekhyrRekhyr Member Posts: 56 ✭✭✭ - Distinguished
    edited April 2015
    I think the best way is to use gmcp events to update a local table containing your afflictions / defences. Then have your table displayed in a MiniConsole|Label.

    Things you may want to check if the above statement makes little sense to you, assuming you are using Mudlet:
    This should get you started! Good luck!
  • KeneanungKeneanung Member Posts: 610 ✭✭✭✭ - Eminent
    Just to add to that, I documented the fields and their (sometimes interpreted) meaning of the GMCP-messages here.
    Rekhyr
  • TaelTael Member Posts: 1,197 @ - Epic Achaean
    This depends somewhat on whether you're using Mudlet or HTML5. For HTML5, no one presently knows how to make custom UI elements like this in an easy way, though that looks likely to change pretty soon.

    For Mudlet, it's probably easier to figure this out in three steps:

    First worry about tables and looping and basic Lua. If you haven't scripted before, this is a lot less difficult than it sounds. You could learn to do this in a few minutes. At minimum, learn how to create a table, how to insert an element into a table, how to change an element in a table, and how to print an element in a table. Then learn how to loop through the elements of a table with for-loops in order to do things like print out the whole table.

    Then worry about GMCP. Figure out how to capture the relevant GMCP messages and save them to a table. Print that table line by line to the screen or something so you can make sure it's working, but don't worry about outputting to a fancy GUI element yet. To capture GMCP, you'll need to learn how to create an event handler in Mudlet (think of it like this: when Mudlet receives a line of normal text from the game, it "raises an event" that tells all the triggers to do something, then all of the triggers function as event handlers - what you need here is to add an event handler for when Mudlet receives a line of GMCP and raises the GMCP event, sort of like a trigger for GMCP), which the last tutorial Rekhyr linked will teach you to do.

    Finally, worry about the GUI. Figure out how to print a simple line of text to a UI element you create. For Mudlet, you'll want to use either geyser or vyzor. It's almost certainly easier to start with geyser.

    Then put it all together. When you log in, a UI element will be created to display afflictions/defences to. When Mudlet raises a GMCP event to add/remove an affliction/defence, an event handler will look at the GMCP message (which is stored as a table), grab the relevant table element that actually has the affliction/defence name in it, add/remove that affliction/defence from the table of current afflictions/defences, then print the afflictions/defences in that table to the UI element.
  • ArdrilArdril Member Posts: 2
    Thanks so much for your detailed replies. And yes, I'm sorry, I should have specified, this is for Mudlet.
  • OrzaansynOrzaansyn Member Posts: 663 @@ - Legendary Achaean
    edited April 2015
    Tael said:
    This depends somewhat on whether you're using Mudlet or HTML5. For HTML5, no one presently knows how to make custom UI elements like this in an easy way.
    Ahem... I know... But probably I'm no one. :wink: 

    More generaly, and not at all directed to you in particular, I'm very tired to see everywhere on forums that "noone knows about HTML5" when it's false, we are a few to know about it, and there is a documentation about it that 99% of people who seek assistance did not even bother to read.
    image
  • AntoniusAntonius Member Posts: 4,770 @@ - Legendary Achaean
    The HTML5 client UI is essentially just HTML and CSS with JavaScript event handlers, right? Modifying it should be pretty trivial, in that case; probably a lot easier than learning how to build UIs in Mudlet since those technologies are used for a lot more than MUDs.
  • OrzaansynOrzaansyn Member Posts: 663 @@ - Legendary Achaean
    yeah, and it accepts JQuery so it's even more easy. What is asked here can be done in 5 minutes, ciggie included.
    image
  • TaelTael Member Posts: 1,197 @ - Epic Achaean
    edited April 2015
    Orzaansyn said:
    Tael said:
    This depends somewhat on whether you're using Mudlet or HTML5. For HTML5, no one presently knows how to make custom UI elements like this in an easy way.
    Ahem... I know... But probably I'm no one. :wink: 

    More generaly, and not at all directed to you in particular, I'm very tired to see everywhere on forums that "noone knows about HTML5" when it's false, we are a few to know about it, and there is a documentation about it that 99% of people who seek assistance did not even bother to read.
    I'm pretty familiar with the client. I've read all of the documentation (though there isn't much of it), all of the threads, and the majority of the actual Javascript that actually generates the client, and I have virtually no idea how to add new UI elements like this.

    I spent a few hours trying to get it to work, but I still haven't managed to add custom tabs with my own content. I've seen you and a couple other people changing various parts of the UI, but I still haven't seen anyone who had done that, and I asked around a fair amount too. If you do know how to create and write to a custom tab, you should seriously post a thread on how to do it - I managed to create a tab, but it broke a fair amount of the styling and I couldn't get anything to print to it.
  • RekhyrRekhyr Member Posts: 56 ✭✭✭ - Distinguished
    edited April 2015
    I think there are enough JavaScript jQuery css html5 and whateverTHAT tutorials out there.
    Orzaansyn
  • TaelTael Member Posts: 1,197 @ - Epic Achaean
    Rekhyr said:
    I think there are enough JavaScript jQuery css html5 and whateverTHAT tutorials out there.
    Which I guess is fine if you just want to just hack a random element into the UI on top of everything or something and do all of the positioning and such by hand, dealing with all the conflicts with the normal client's UI, but I wouldn't call that "easy".

    If you want to actually add tabs to the existing UI framework so everything plays together nicely and resizes and can be moved and all that nice stuff that's already been implemented in the client, you have to understand how their framework works. Admittedly I don't read Javascript very often and I haven't looked at newer versions of the HTML5 client, but I found it pretty hard to try to figure that out without documentation, trying to work through the client's script. If anyone has solved that problem, I wasn't being facetious, I really would love to see it and how to do it.
    Orzaansyn
  • OrzaansynOrzaansyn Member Posts: 663 @@ - Legendary Achaean
    Tael said:
    If you do know how to create and write to a custom tab, you should seriously post a thread on how to do it - I managed to create a tab, but it broke a fair amount of the styling and I couldn't get anything to print to it.
    Yeah, I do.

    But I certainly won't waste my time to write a thread.

    I used to be helpful with people about it or about other things in the game, but the more I witness the behaviour of the people I'm trying to help, the less I want to help them.

    I think I'll just stop to say anything about the HTML5 client, and to reply in the HTML5 Support Clan, and finally let the people in their ignorance.

    After all. I do not need any help.
    image
  • RekhyrRekhyr Member Posts: 56 ✭✭✭ - Distinguished
    @Tael I agree some kind of documentation would be nice.
Sign In to Comment.