mapper: remove echo for certain UID's

Posted by Magellan on Mon 27 Nov 2017 03:35 AM — 3 posts, 15,196 views.

#0
not sure if i am using the correct terminology so if i use some vocabulary that is wrong i apologize in advance. I'm pretty novice at LUA so this is all a bit overwhelming. I'm working inside the mapper plugin trying to remove the line that would look like this:



Room -99 name updated



again, specifically any number that is -1 through -99.

i appreciate the insight.

the code i believe that sends it to the mud is this:



  if (config2.show_database_mods) then
    mapper.mapprint("Room", uid, "name updated")
  end



i was thinking trying to wrap an exception in an if check to verify if the UID was -1 to-99 but don't want to break the whole thing. the mapprint is analog to a Note so my attempt to just gag it failed and I want to keep the utility of it alerting me to any other kind of room being added. the negative numbers in this mud are not mappable so it's just unnecessary spam which causes issues with VI players.
Australia Forum Administrator #1
I would suggest:


  if config2.show_database_mods and
     (tonumber (uid) > -1 or 
      tonumber (uid) < -99 or
      tonumber (uid) == nil) then
    mapper.mapprint("Room", uid, "name updated")
  end


The "tonumber" function ensures that the uid is a number (not a string) and checking for nil is in case it isn't a number at all.
#2
much appreciation. this worked exactly as i needed it to. my version wasn't quite as clean as can be expected but i wasn't using the AND in mine and i think that's the bulk of my issue. Every day i look at this stuff its a learning experience! thanks Nick!