Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ Bug reports ➜ SetTriggerOption(t, "name", tt) does not work

SetTriggerOption(t, "name", tt) does not work

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by WillFa   USA  (525 posts)  Bio
Date Thu 15 Jun 2017 03:43 PM (UTC)
Message
no error, no effect, appears to work but actually does nothing.

p.s. you have the most annoying password strength policy I have ever encountered. And I've worked in infosec. Please read xkcd comic #936. I can't use a 28 character sentence because the space character appears too many times????
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 15 Jun 2017 10:54 PM (UTC)
Message
What do the variables "t" and "tt" have in them?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by WillFa   USA  (525 posts)  Bio
Date Reply #2 on Fri 16 Jun 2017 08:51 AM (UTC)

Amended on Fri 16 Jun 2017 08:58 AM (UTC) by WillFa

Message
Valid names of triggers. Doesn't matter if you CTRL+SHIFT+8 and pick a trigger and copy n paste it's label, If you're in a for k,v in iPairs(GetTriggerList()), if you're getting the trigger name from a function filter(s) in the Filter By dialog box...


How I discovered this is a little funny and a little embarrassing. On the mud I play is the Necromancers guild ("Necros" as everyone in the world would be wont to shorten it), and I was commenting that while I love our mutual friend, I hate partying with him because the guild is spammy as hell with epileptic seizure inducing ansi changes. Friend C said he agrees and that's why he has the entire guild's spam gagged. I said "Ooooh, gimme them triggers!" and so he sent me the file with his TinTin++ #gags... Some quick search 'n' replace in my favorite text editor and I changed all the #gag {matchtext}; into AddTrigger("NecroGag01", "matchtext", "", 7, -1, 0, "", ""), incrementing the name as appropriate.

You might notice that flags are only 7 (enabled, omit, omitlog)... and I forgot the RegEx flag. And I wanted to throw all of them into a group for quick n easy plugin wizard export... And UH OH, that's a really unfortunate typo for a white guy in America to make... yeaaaa... "NecroGag01" doesn't have a "c" in it, it has an erroneous "g". I should REALLY change that. And that's when I found out the following code doesn't work, and while debugging it, none of the "name" changes work even from the command prompt with a Send to Script character preceding it.


function filter (s)
--print (s, type(s), s:find("negrogag"))
if s:find("negrogag") then
  SetTriggerOption(s, "group", "NecroGags")
  local tempname = s:gsub("egro", "ecro")
  SetTriggerOption(s, "name", tempname)
  return true

elseif s:find("necrogag") then
  return true
else
  return false

end

end -- filter


Modifying the group works, adding the RegEx flags worked (in previous iterations of the code); so I am grabbing the correct trigger name and modifying them correctly. The "name" case in SetTriggerOption does not function.

And I did try just a single line SetTriggerOption line from the command window just in case this was a time when modifying a list during traversal has undefined results.
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 17 Jun 2017 02:18 AM (UTC)
Message
You can't change the name of a trigger/timer/alias using SetXXXoption. The documentation is incorrect in this respect.

The name is its "key" and not part of the data. I suggest you do something like ExportXML to get the trigger data, and then ImportXML using a different name. See, for example:

http://www.gammon.com.au/forum/?id=7123

Example code:


require "addxml"  -- get extension script

-- get trigger "foo"
t = addxml.save ("trigger", "foo")

-- change its name
t.name = "bar"

-- put it back
addxml.trigger (t)

-- get rid of old one
DeleteTrigger ("foo")

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by WillFa   USA  (525 posts)  Bio
Date Reply #4 on Sat 17 Jun 2017 05:44 PM (UTC)
Message
Thanks, Nick.

I actually just opened the MCL in Sublime Text and did a search and replace in there.

Just wanted to let you know of the issue (apparently in the docs, not code).
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


17,291 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.