[APT] A (almost) trigger-less NDB.

-- Log of it in action, for the needy people --

So when I started here, I found someone's NDB on the forums that I decided to play around with, since that's basically the only thing that was missing from WunderSys... The more I coded, the more I realised just how unfinished it felt... So I did what any normal person would do, and completely rewrote it from the ground up. This time without any wonky bugs in it.

It's much like the old one, with relatively similar syntax (after speaking with people, I realised how many others used it, so I figured this would help if they decided to switch)

Installation:
1) Make sure GMCP is enabled... Or don't, it doesn't actually use it really at all.
2) Install it via the package manager, as per usual.
3) Use 'aptinstall' to initialise everything.
Aliases used in the log:
[spoiler]
  1. qwp will check qwho, and then grab missing information from anyone not currently tracked.
  2. apt stats will display player count of each city.
  3. apt citizens <city> will display the citizens of a chosen city.  'apt citizens eleusis' for example.
  4. apt class <class> will display the tracked players of the chosen class.  'apt class runewarden' for example.
  5. apt remove will clear out all unranked people from the database; useful if it gets super large.
  6. apt redo will update the information of everybody currently in the database; except this one is near instantaneous updating as opposed to waiting a few minutes to honours everybody.
  7. whois (person) will display information on a chosen individual. 'whois alyxeri' for example.
  8. aptc show will display the current settings.
[/spoiler]

Something the previous version was missing, which I've seen some people wanting. Highlighting!
[spoiler]
  1. apt hl to toggle the highlighting on and off. Don't spam it, else it'll mess it up and you'll have to restart mudlet to fix it.
  2. aptc <arg1> <arg2> will change the highlighting of a city; the city can be either arg1 or arg2, for those who forget it. So 'aptc eleusis orange' will work, and 'aptc orange eleusis' will work. Currently there's no way to -not- highlight a city, sorry. I was too lazy for that. Just set it to grey, if you want the default serverside colouring.
[/spoiler]

Something else the previous version was sorely missing. An API to use with scripts, much like SVO's NDB has!
[spoiler]

  1. apt_exists("person") will return true or false, depending on if they're currently in the database.
  2. apt_isAshtani("person") will return true or false, if they are Ashtani.
  3. apt_isCyrenian("person") will return true or false, if they are Cyrenian.
  4. apt_isEleusian("person") will return true or false, if they are Eleusian.
  5. apt_isHashani("person") will return true or false, if they are Hashani.
  6. apt_isMhaldorian("person") will return true or false, if they are Mhaldorian.
  7. apt_isTargossian("person") will return true or false, if they are Targossian.
  8. apt_isRogue("person") will return true or false, if they are a rogue.
  9. apt_getCity("person") will return what city the person is currently a part of (or 'Unspecified' if not tracked)
  10. apt_getClass("person") will return the current class the person was last seen as (or 'Unspecified' if not applicable)

[/spoiler]

Enjoy.

«1

Comments

  • I won't lie, I love this.  It was one of the things on my "next to do" list but I grabbed PT_track and have been using it (adapting it for things I wanted to do like coloring names in my "Players Here" window by city).   This does everything I would have wanted to implement.  Thanks for saving me the time...again

  • Thank you. Much appreciation for your contribution to this little community with your code. I'll let you know if I find any bugs. (p.s. also check your character for... uh... donations. it's not much... but I can't express my gratitude enough.))
    That is not an ordinary star, my son. That star is the tear of a warrior. A lost soul who has finished his battles somewhere on this planet. A pitiful soul who could not find his way to the lofty realm where the great spirit awaits us all.
  • edited October 2017
    Lucianus said:
    Thank you. Much appreciation for your contribution to this little community with your code. I'll let you know if I find any bugs. (p.s. also check your character for... uh... donations. it's not much... but I can't express my gratitude enough.))
    :O Thank you. Let me know if you want any more functionality added to it.
  • So clean, so light, so fast, yet so complete. Highly recommended. A+++++
  • edited November 2017
    Mind if I hand out your package as part of TReX? TReX Doesnt have an NDB as of yet. Also Goodwork!!
    • Will now auto grab info for people from the newbie trial, when they join your city.
    • Added city tracking of people currently online, since people asked me for it. This will only show when you do 'qwp' - if there's people to add then it will do that, before being allowed to display who's around. This is to prevent untracked people erroneously being displayed/added to false cities.
    The latter uses the colouring of whatever highlights you choose, sorry if you didn't want that. It saved me having to pick colours.

    @Nehmrah would prefer to not have my scripts packaged with other people's stuff, for a number of reasons. Sorry.


  • Also thanks to @Penwize for detailing the proper way to use string.format for echoes. It shortens a lot of things.
  • edited November 2017
    Alyxeri said:
    • Will now auto grab info for people from the newbie trial, when they join your city.
    • Added city tracking of people currently online, since people asked me for it. This will only show when you do 'qwp' - if there's people to add then it will do that, before being allowed to display who's around. This is to prevent untracked people erroneously being displayed/added to false cities.
    The latter uses the colouring of whatever highlights you choose, sorry if you didn't want that. It saved me having to pick colours.

    @Nehmrah would prefer to not have my scripts packaged with other people's stuff, for a number of reasons. Sorry.


    After I asked for it, I figured it out myself.  But then I left it at work.  So this just saved me a bit of time re-writing what I had (and is likely very similar).  

    Thanks.

    edit:  Doesn't appear to do the online players *every* time I do QWP  

    Didn't do it the first time, figured maybe it just needed to be initialised.  Worked the second time.  hasn't since.

  • [ERROR:] object:<APT Qwho> function:<Trigger1256>
             <[string "function apt_exists(name)..."]:104: bad argument #1 to 'insert' (table expected, 
    got nil)>

  • edited November 2017
    Caelan said:
    [ERROR:] object:<APT Qwho> function:<Trigger1256>
             <[string "function apt_exists(name)..."]:104: bad argument #1 to 'insert' (table expected, 
    got nil)>
    Judging by what that line is, you probably have someone whose city is hidden from the API. Means you gotta manually honours them!

    Try do 'apt redo' to regrab the honours of everybody, shouldn't take more than 10s or so to parse through them all if your internet is fine. It'll alert you to anyone who needs manual honours to update their city. Big red WARNING line.

    Also as stated in the post, it won't show online people if there's data of people that need to be grabbed. You'll have to do it a second time, for it to display. QWP prios grabbing data > displaying citizens online.
  • edited November 2017
    When it gave the red line for manualling, I did it.  Then did QWP again and again until it didn't catch new people.  Still didn't show.

    I'm at work right now and will install it here and see if maybe there was something on the home profile interfering.


    edit:  Seems to be working now. 

  • Can you add a city/house/order enimies highlight to this @Alyxeri?
  • edited November 2017
    Kayle said:
    Can you add a city/house/order enimies highlight to this @Alyxeri?
    Can I? Probably.

    Will I? Probably not. Who knows.

    I don't really feel like adding a highlight hierarchy. I've been meaning to add the ability to disable highlighting for <x> cities, if the user chooses, though.
  • edited November 2017
    I hooked over to SVO NDB to color my enemies.

    So..you can find this function and add this bolded line and it will bold italic underline your enemies from svo's enemy database:
    function apt_highlight(name, colour)

      local c, k = 1, 1

      while k > 0 do
        k = line:find(name, k)
        if k == nil then return end
        c = c + 1

        if k == line:find("%f[%a]"..name.."%f[%A]", k) then
          if selectString(name, c-1) > -1 then
            if colour     then fg(colour) end
            if ndb.isenemy(name) then setItalics(true) setUnderline(true) setBold(true) end --doch added
            resetFormat()
          else return end
        end

        k = k + 1
      end
    end



    I use APT for highlighting specifically...


  • Svos ndb doesnt capture all the enemies though. Its weird. I have to go in and set people and it sometimes doesnt save the manual change
  • AhmetAhmet Wherever I wanna be
    Kayle said:
    Svos ndb doesnt capture all the enemies though. Its weird. I have to go in and set people and it sometimes doesnt save the manual change
    It doesnt do personal enemies, but it does house/city/order, plus you can set a whole city as enemy or ally.
    Huh. Neat.
  • [ERROR:] object:<event handler function> function:<apt_gotInfo>
             <InvalidJSONInput: lexical error: invalid char in json text.
                                           C:\Users\MyNameHere\.conf
                         (right here) ------^
     at lua_yajl1.c line 256>

  • edited November 2017
    Got it working for the displaying of the numbers by toggling the highlighting and specials a few times, but it's doing that.

    Assuming it's because I'm on 2.1 on my home PC because I couldn't be bothered to upgrade.  Now that I did at work, I won't be doing so here at home because I'm not about to have the same issue with UserWindows


  • Caelan said:
    Got it working for the displaying of the numbers by toggling the highlighting and specials a few times, but it's doing that.

    Assuming it's because I'm on 2.1 on my home PC because I couldn't be bothered to upgrade.  Now that I did at work, I won't be doing so here at home because I'm not about to have the same issue with UserWindows

    No idea about that error, never seen it before.
  • I've had ndb bold and underline enemies, bit leaving the colours as they are. It is the best way. :)
    image
  • Rangor said:
    I've had ndb bold and underlxine enemies, bit leaving the colours as they are. It is the best way. :)
    Same. They are the reason why you get webbed repeatedly and guards are called. 
  • So I was getting errors earlier.  It would highlight, but not display the count of members from each city.  Troubleshot and discovered - for me - it didn't get past the Divine, so I just manually entered

     "lua apt.players["Deucalion"].city = "Rogues" 

     and did that for all the Divine, then it worked.  Obviously you need the LUA alias

    Another issue was that it wasn't saving people that didn't pop up, like Morthif or Seragorn who have veils or gems, but you manually HONOURS.  It would display the correct color for their names but not save it when you quit.   For that, just do "lua apt_download("NAME")" and it saves it for the next time.

    Overall I really like this little package.  It ties in nicely with my "people in the room" items and I can even use it on my homebuilt "WHERE" function to call names in the same room as someone else.  The is_<cityName> is great and easy to throw into an alias to enemy the first 20 people from any city. 

    Thanks @Alyxeri


  • Troubleshooting tip:

    If anyone adds people manually via honours <name> and they don't appear highlighted. You may want to toggle highlight on and off (apt hl).

    That should run the apt_clearHighlights() and apt_loadHighlights() functions. Should be able to see the person's name highlighted after that.


    @Alyxeri Been testing and trying it out. Loving it so far. It is brilliant coding.

    That is not an ordinary star, my son. That star is the tear of a warrior. A lost soul who has finished his battles somewhere on this planet. A pitiful soul who could not find his way to the lofty realm where the great spirit awaits us all.
  • I've occasionally seen one of the errors that Caelan was getting, and now finally bothered to figure it out.
    If the hidden person is a rogue, the honours trigger doesn't capture that as being a rogue is the absence of a line, rather than a line to be triggered upon.

    I added this
    <div>if not apt.players[honoursPerson].city then&nbsp;</div><div>    apt.players[honoursPerson].city = 'Rogues'</div><div>end</div>

    at the start of the 'Close Trigger' for 'Get honours info'.
    Simply, if the prompt has been reached after honours-ing a person and no city has been set, assume rogue.

    And lastly - thanks a bunch @Alyxeri for sharing this script. I've been playing Achaea for a really short time now and already have no idea how I survived playing other IRE muds for so long without it.

  • Leffe said:

    <div>    apt.players[honoursPerson].city = 'Rogues'</div><div>end</div>

    Yeah I usually just "lua apt.player...."  from command line because it isn't a big deal.  More annoying that it doesn't always pick up Divine


  • I wanted to see enemies in bold while still retaining their city colour like so



    If you also want something like that, do a search for
    colour = apt.highlighting.Enemies
    in the apt_highlightName() function (line 79 of the APT Highlighting script) and simply replace it with
    colour = apt.highlighting[city]
    then just use the APT EHL (b|i|u) alias as normal to set what you want.
  • Gilliam said:
    I wanted to see enemies in bold while still retaining their city colour like so



    If you also want something like that, do a search for
    colour = apt.highlighting.Enemies
    in the apt_highlightName() function (line 79 of the APT Highlighting script) and simply replace it with
    colour = apt.highlighting[city]
    then just use the APT EHL (b|i|u) alias as normal to set what you want.
    V neat.
    "All we have to decide is what to do with the time that is given to us."

  • edited April 2018
    So seen a lot of the frustration with Divine, and had my own in that they loved to break my beautiful QWP to sort people into their boxes (I love boxes).

    So, naturally, I decided to fix that! 

    Attached is my personal edit for APT that includes Divine as a 'city' category for the purpose of sorting them. It looks a little like this:

    https://ada-young.appspot.com/pastebin/J14xfBXI

    For those that would prefer to do it themselves!

    You'll need a new trigger within the honors trigger that captures,
    ^(She|He) was born before time was counted.

    Trigger value will be
    apt.players[honoursPerson].city = "Divine"<br>selectString(line, 1)<br>fg(apt.highlighting["Divine"])
    After this, you'll need to edit some scripts. As follows:
    In APT API:
    function apt_isDivine(name)<br><br>if apt_exists(name) then<br>return (apt.players[name].city == "Divine" and true or false)<br>else<br>return false<br>end<br>end
    Lower in the same function under apt_Echo(" City affiliations..."):
    cecho(string.format("\n<%s>[Divine] :<span>(<span>%d)<%s> %s.", apt.highlighting.Divine, #onlinePeople.Divine, apt.highlighting.Divine, table.concat(onlinePeople.Divine, ", ")))<br></span></span>
    In the apt_displayOnline(players) - line 101-ish, you'll need to add "Divine = {} into the local onlinePeople. You'll also want to add this code into the for _, person in pairs(players), roughly line 105:

    elseif apt_getCity(person) == "Divine" then
    table.insert(onlinePeople.Divine, person)

    This elseif will need to be inserted ABOVE the elseif for Rogues (roughly line 108 in APT API)

    You'll also want to add Divine = "your colour" in apt_Install (line 44 in the APT Settings Functions), "Divine" into the local cities in line 15.

    In your alias "Set Colours for Orgs", be sure to add in Divine to cities there, too!

    Lastly, in Show Settings (apt show), you'll insert below Rogues:
    cecho("\n <"..apt.highlighting.Divine..">Divine     <white> will be highlighted in          <"..apt.highlighting.Divine..">"..apt.highlighting.Divine..".\n")

    Be sure to remove the \n from the Rogues above it unless you want an extra blank line between Divine and Rogues. 

    Thats it!

    Let me know if you have questions on how I added Divine for APT. It is amazing and ALL the credit to the amazing author, @Alyxeri who made an amazing, lightweight person tracking system. 
  • Yessss i love boxes! :)
Sign In or Register to comment.