Register forum user name 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 ➜ Suggestions ➜ Alias/timer/trigger script callbacks

Alias/timer/trigger script callbacks

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


Posted by Twisol   USA  (2,257 posts)  Bio
Date Sat 13 Feb 2010 04:06 AM (UTC)
Message
When calling the function named in the 'script' field of aliases/timers/triggers, would it be possible to send the internal name, regardless of whether it's not named? To be clear, I meant that if you have an unnamed alias, I want to be sent "*alias1234" as the name, not "" (empty string). This is important so I can get at the details/options of the alias that was used, regardless of the status of its name.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Rakon   USA  (123 posts)  Bio
Date Reply #1 on Sat 13 Feb 2010 04:16 AM (UTC)
Message
I'd like this as well. A lot of my triggers/aliases are not named.

Alternatively, I'd be happy if say, the error returned the 'match' and 'sequence' number of a trigger, or alias. This would also help immensely.

Yes, I am a criminal.
My crime is that of curiosity.
My crime is that of judging people by what they say and think, not what they look like.
My crime is that of outsmarting you, something that you will never forgive me for.
Top

Posted by Fadedparadox   USA  (91 posts)  Bio
Date Reply #2 on Sat 13 Feb 2010 04:21 AM (UTC)
Message
Agreed.
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #3 on Sat 13 Feb 2010 09:14 AM (UTC)
Message
Good idea. Never needed it, but I don't see any harm for plugin compatibility in practice. The chance someone will check for an empty name when handling the trigger script will not be likely to contain specialized handling, only handling for not calling a dozen functions which would obviously not work with an empty name.

However, in cases that people do use the name to radically change the logic of a trigger, I have to both question the sanity of using the same trigger for named and unnamed triggers, as they clearly aren't much alike. As a temporary solution, such scripts should be adjusted to check the first few lines of the script for *alias/*trigger, or maybe a plain * as I don't think it is an allowed character for names anyhow.
Top

Posted by Errorman   (1 post)  Bio
Date Reply #4 on Sat 13 Feb 2010 09:57 AM (UTC)
Message
hello ;)
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #5 on Sat 13 Feb 2010 07:07 PM (UTC)

Amended on Sat 13 Feb 2010 07:08 PM (UTC) by Twisol

Message
Worstje said:
However, in cases that people do use the name to radically change the logic of a trigger

It's not so much about treating unnamed triggers differently than treating them all the same, whether they're named or not.

EDIT: In the case that you're talking about other people who check "" - it's not quite clear which you meant - and treat them differently based on that, then I agree.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #6 on Sat 13 Feb 2010 08:19 PM (UTC)

Amended on Sat 13 Feb 2010 08:22 PM (UTC) by Worstje

Message
I was indeed talking about if-checks like 'if name ~= "" then DoDifferentStuffWithValidName(name) else DoWeirdStuffForUnnamedThingy(name) end' :)
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #7 on Sat 13 Feb 2010 08:31 PM (UTC)
Message
Right, yeah. Anyone who did that would be crazier than I am.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #8 on Sat 13 Feb 2010 09:05 PM (UTC)
Message
It wasn't easy to do, but I have incorporated this suggestion in version 4.50. [commit 2919843]

The main problem was that trigger/alias/timer *pointers* were being passed around, which means that at that stage they are divorced from whatever name they were stored in the map with.

Now every trigger/timer/alias script function should be given a non-empty name, with the first character being "*" if the name was not assigned by a human. This name can be used in GetTriggerInfo, GetTimerInfo, GetAliasInfo.

- Nick Gammon

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

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #9 on Sat 13 Feb 2010 09:19 PM (UTC)
Message
Also GetAliasOption and the like as well, I hope? Both *Option and *Info work this way in the current version, I want to make sure it wasn't changed inadvertently.

(Actually, I imagine that any Alias, Trigger, or Timer function that accepts a name should work as expected, not just the Option/Info ones)


Also: Thanks, Nick!

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #10 on Sat 13 Feb 2010 10:10 PM (UTC)
Message
I think a while ago all those functions were changed to accept the internal names (so you could use GetAliasList for example).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


30,020 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.