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

Quick Coding Questions

2456712

Comments

  • KayeilKayeil Washington StateMember Posts: 2,628 @@ - Legendary Achaean
    So usually I just ask Seragorn these questions, but he's gone for the weekend, so...

    In mudlet, how do I make it overwrite original text and put what I want? I've seen people use this to rewrite their hunting attacks and such which is only visible on their end, but I'd like to use it for some other function.
    What doesn't kill you gives you exp.

  • KeneanungKeneanung Member Posts: 517 ✭✭✭✭ - Eminent
    Most use either a combination of selectString/selectCaptureGroup and replace or a combination of deleteLine and [c|d|h]echo.

    Which one to use depends on if you want to change only a part (first variant) or the whole message (second).
  • KayeilKayeil Washington StateMember Posts: 2,628 @@ - Legendary Achaean
    Keneanung said:
    Most use either a combination of selectString/selectCaptureGroup and replace or a combination of deleteLine and [c|d|h]echo.

    Which one to use depends on if you want to change only a part (first variant) or the whole message (second).
    You've confused me even more...  O.o I don't get this stuff at all.

    Luckily Seragorn logged in again and saved the day! :hurrah: Thank you anyways, though! I appreciate it.
    What doesn't kill you gives you exp.

  • AustereAustere TennesseeMember Posts: 1,958 @@ - Legendary Achaean
    What would cause a table value to equal <cycle>? That's all it says.  It's not a string, as far as I know, because it doesn't have parentheses around it.  Gonna try to type this out on my phone, so if syntax is off slightly,  I  apologize 

    Table = {["Austere"] = {},["Jadys"] = <cycle>}
  • SeifurSeifur Member Posts: 64 ✭✭✭ - Distinguished
    edited September 2015
    A cycle can be made like this:

    local a = {}
    a[1] = a

    {
      [1] = <cycle>
    }

    local b = a
    a[2] = b

    {
      [1] = <cycle>,
      [2] = <cycle>
    }

    It happens when you have a table that contains the same table.
    retired
    Austere
  • AustereAustere TennesseeMember Posts: 1,958 @@ - Legendary Achaean
    So the problem is somewhere I am doing something similar to Table.Jadys = Table? It's mostly likely a "make sure my table is set" error using Table.Jadys = Table.Jadys or {} and I missed the Jadys part.  Easy fix, if so.  Thanks! 
  • SobriquetSobriquet Member Posts: 1,347 @@ - Legendary Achaean
    Simple question here:

    I've got an alias of:

    ^pc (\w+)$

    which does:

    send("puppet command " ..matches[2])

    But will only work with one word commands like pc restore. How do I set that to capture anything else I put in, such as pc touch tree, or pc apply restoration to head or pc sing i'm a little teapot?

    tia.
    image
  • AustereAustere TennesseeMember Posts: 1,958 @@ - Legendary Achaean
    So I am going to start coding a name database tonight. I have been looking into the database functions in mudlet, and thus far feel very confused about how to go about this.  I was just wondering if there is any true benefit to using a database over a table using table.save and table.load. I feel that creating the triggers to highlight names on load is going to turn out a lot easier for me personally if I use tables, and a table is capable of storing all the relevant data, so I guess my real question is how will this effect processing times. 

    Also, how safe is it to create temp triggers for every person in a database for coloring purposes? I was planning on naming them after the person I want to highlight, so it makes it easier to adjust people's faction on the fly.  Any tricks to reduce script lag? I have a lot of grand ideas about this, just want to make sure I am not missing anything relevant.
  • AmranuAmranu Member Posts: 705 ✭✭✭✭ - Eminent
    edited September 2015
    Database is useful if you wanted to create an external program to access that data. Especially if you use mudlet to connect to a mysql instance or something similar. You could for instance have mudlet check certain information, add it to the database and have a webserver connecting to the same database that would be updated at the same time. There's also potentially performance improvements that can be had from using an sql database over simple tables.
    Additionally, it's much easier to search databases for instance, for all members of a class or city than it is to search tables for that information.
  • TahquilTahquil Member Posts: 3,545 @@ - Legendary Achaean
    I use the YATCO chat capture still. I want to put a nice border about it just so it looks a little cleaner in my GUI. What would people advice on how to go about this?
  • SobriquetSobriquet Member Posts: 1,347 @@ - Legendary Achaean
    I'm looking at coding something using tables but not sure how to do it.

    Basically want to say IF <name is in a table> do X ELSE do y.

    Any pointers on where to start?
    image
  • AntoniusAntonius Member Posts: 3,919 @@ - Legendary Achaean

    A table in Lua can actually be one of two things: a dictionary or an ordered list. A dictionary is a set of key value pairs, a list is just a list. If you're familiar with JavaScript, think object versus array.

    How you go about checking depends on which type you have. If it's an ordered list, then:

    if table.contains(yourtable, "name") then x else y end

    If it's a dictionary where the names are keys, then:

    if yourtable["name"] then x else y end

    SobriquetUtianima
  • SiodhachanSiodhachan Washington, USAMember Posts: 20 ✭✭✭ - Distinguished
    Amranu said:
    Additionally, it's much easier to search databases for instance, for all members of a class or city than it is to search tables for that information.
    That depends on how your database and your tables are structured. Tables could actually make such a search quite trivial.

    The earth is so good to me;
    So giving and so kind.
  • TahquilTahquil Member Posts: 3,545 @@ - Legendary Achaean
    I've seen a few people who have date/time trackers on their GUIs and I was wondering on how they have done them? I assumed it would have been triggered on changes to  (gmcp.IRE.Time.List) however despite this my (gmcp.IRE.Time) is still showing it to be late afternoon on the 21st of Glacien despite it being midnight on the 23rd.
  • LyrLyr Member Posts: 419 ✭✭✭✭ - Eminent
    I did it the old school way and just triggered every ambient message (as well as TIME, DATE) and had it auto-update on the new day message.
  • KeneanungKeneanung Member Posts: 517 ✭✭✭✭ - Eminent
    @Tahquil IRE.Time.List get only sent on request (either via gmcp or DATE/TIME commands). All other changes get sent via IRE.Time.Update. See https://github.com/keneanung/GMCPAdditions/blob/master/README.md#iretime
  • TharvisTharvis The Land of Beer and Chocolate!Member Posts: 3,107 @@ - Legendary Achaean
    actually @Keneanung I've found that IRE.Time.List only gets updated on login. Never updated for me on checking DATE, TIME or any other actions than logging out and back in
    Aurora says, "Tharvis, why are you always breaking things?!"
    Artemis says, "You are so high maintenance, Tharvis, gosh."
    Tecton says, "It's still your fault, Tharvis."

  • TahquilTahquil Member Posts: 3,545 @@ - Legendary Achaean
    edited September 2015
    Can confirm that using DATE/TIME commands does not update IRE.Time.List
    @Keneanung : I've been using your documentation as a bible. But this is uh, a pit fall as I wish I could have an updating time/date to help out whne you are stuvk indoors for a while
  • KeneanungKeneanung Member Posts: 517 ✭✭✭✭ - Eminent
    Maybe I remember wrong then and it was a (almsot) completely filled update. I'll have a look at that again. But the actual answer to Tahquil's question is still that she has to use the "Update" ;)
  • TahquilTahquil Member Posts: 3,545 @@ - Legendary Achaean
     vlua gmcp.IRE.Time.Update
    {
      daynight = "15"
    }

    vlua gmcp.IRE.Time
    {
      Update = {
        daynight = "15"
      },
      List = {
        time = "The shadows have lengthened. It is late afternoon in Achaea.",
        moonphase = "Waning Gibbous",
        day = "21",
        month = "Glacian",
        daynight = "81",
        year = "694",
        hour = "39",
        mon = "11"
      }
    }


    Still no dice.
  • TharvisTharvis The Land of Beer and Chocolate!Member Posts: 3,107 @@ - Legendary Achaean
    update goes up a number every few seconds, and at stages where "moonphase" etc rolls over, the variable daynight vanishes from Update and update becomes

    Upate : {
     time = "...."
     moonphase = "...."
     something else
    }

    anyway. Daynight seems to go up to 360, could be wrong
    Aurora says, "Tharvis, why are you always breaking things?!"
    Artemis says, "You are so high maintenance, Tharvis, gosh."
    Tecton says, "It's still your fault, Tharvis."

  • SenaSena Member Posts: 3,757 @@ - Legendary Achaean
    Tahquil said:
    I've seen a few people who have date/time trackers on their GUIs and I was wondering on how they have done them?
    Mine doesn't use GMCP, I just use a timer and synchronise with the day/night messages. The timer fires every 2.5 seconds (1 Achaean minute), incrementing the IC time and recording the current OOC time. When I'm outdoors to see the time messages (or on the day change, which is visible indoors), they set the correct time and reset the timer. When I first log in, it calculates the expected time based on the last OOC time recorded by the timer (so if I've been logged out for 15 OOC minutes, it adds 6 IC hours to the time), and if it's wrong (because of server lag/downtime/timewarps) it will be corrected on the next synchronisation (this is the biggest weakness, if I stay indoors after logging in it could have the wrong time for up to an hour).
  • KeneanungKeneanung Member Posts: 517 ✭✭✭✭ - Eminent
    Tharvis said:
    update goes up a number every few seconds, and at stages where "moonphase" etc rolls over, the variable daynight vanishes from Update and update becomes

    Upate : {
     time = "...."
     moonphase = "...."
     something else
    }

    anyway. Daynight seems to go up to 360, could be wrong
    Up to 200 and resets with the morning (Not sure about the exact moment, but I believe sunrise)
  • NaisarNaisar Member Posts: 255 ✭✭✭✭ - Eminent
    edited September 2015
    Speaking of GMCP-

    1. @Keneanung That github page is amazing, thanks.

    2. Is there any reason why it was decided to create arbitrary module pairings for request/responses instead of clients sending the module they want a response for?  For example, right now clients have to send Char.Skills.Get to receive an update to Char.Skills.List - wouldn't it make more sense to just have clients send Char.Skills.List?

    3. Why is GMCP like five characters away from valid JSON?
    Char.Skills.Get { "group": "elemancy", "name": "firelash" }
    instead of something like
    {"Char.Skills.Get": { "group": "elemancy", "name": "firelash" }}

    ?

  • AntoniusAntonius Member Posts: 3,919 @@ - Legendary Achaean

    #2 would need to be answered by somebody who works for IRE, and I don't know if/how often they look at this particular thread.

    #3 sounds like it would need to go to whoever was in charge of designing the GMCP protocal. That's not anybody involved with Achaea/IRE specifically, as far as I know.

  • NaisarNaisar Member Posts: 255 ✭✭✭✭ - Eminent
    Yeah I know this probably isn't the best place for those questions, I was just hoping someone who checked the thread had some insight.
  • SenaSena Member Posts: 3,757 @@ - Legendary Achaean
    edited September 2015
    From what I remember (it's been a long time), the not-quite-JSON (though some JSON parsers will accept it) was pretty much just an arbitrary decision by IRE and Zugg (mostly Zugg, I think?). I don't remember there being any particular reason for it.
  • LyrLyr Member Posts: 419 ✭✭✭✭ - Eminent
    One question would be: how does the HTML5 client know what time it is?

  • DaironDairon Member Posts: 217 ✭✭✭ - Distinguished
    I'm on a Mac and Mudlet always starts up too small for anything. 

    Is there a way to set the main window size to a certain size so I don't have to resize each time I log into Achaea?
Sign In to Comment.