I am just wondering if it is possible to control mudlet (e.g enable or disable trigger class) across different profile?
Let say if I am work on Profile A, but I want to tell Profile B to en/disable a specific trigger class without switching to Profile B.
Is this possible? Thanks.
Mudlet Control Across Different Profile
Re: Mudlet Control Across Different Profile
Hello Beckham,
I'm fairly new to Mudlet, but I do have a solution that is a bit of a workaround for this.
If you use this in one profile you can create an alias on the other profile that activates on "recoverStart" and has an enableTrigger() function.
I suspect that a better method does exist, but this is what I've been using currently.
I'm fairly new to Mudlet, but I do have a solution that is a bit of a workaround for this.
Code: Select all
local updateStatus = "recoverStart" or {}
expandAlias(updateStatus)
raiseGlobalEvent("sysSendAllProfiles", updateStatus)
I suspect that a better method does exist, but this is what I've been using currently.
Re: Mudlet Control Across Different Profile
raiseGlobalEvent() is the way to go!
I wouldn't use expandAlias(), but rather make a function:
I wouldn't use expandAlias(), but rather make a function:
-
- Posts: 15
- Joined: Thu Aug 30, 2018 2:07 pm
Re: Mudlet Control Across Different Profile
I do know that there is a code raiseGlobalEvent()
however, that isn't what I want to do, because as far as I understand when I use raiseGlobalEvent to en/disable trigger class X; trigger class x will be en/disable in BOTH profile.
meanwhile what i want to achieve is just en/disable trigger class X in profile B from profile A, while trigger class X (let say they have the same class name) in profile A stay unchanged.
however, that isn't what I want to do, because as far as I understand when I use raiseGlobalEvent to en/disable trigger class X; trigger class x will be en/disable in BOTH profile.
meanwhile what i want to achieve is just en/disable trigger class X in profile B from profile A, while trigger class X (let say they have the same class name) in profile A stay unchanged.
Re: Mudlet Control Across Different Profile
It will not disable it in both profiles, try it first
You can also pass the profile name with the event so you can tell which event the profile came from.
You can also pass the profile name with the event so you can tell which event the profile came from.
-
- Posts: 15
- Joined: Thu Aug 30, 2018 2:07 pm
Re: Mudlet Control Across Different Profile
I don't quite understand how the code works, but yay it works. Big thanks and I will try work on it.
Do I have to register each function I want to call globally?
Also let say if I have profile A, B & C, if I raise global event it will also call in both profile B & C?
Re: Mudlet Control Across Different Profile
Check out https://wiki.mudlet.org/w/Manual:Event_Engine which explains how to work with events, that'll get you a long way!
You can't register a function globally, you register it within each profile (so you can customise it if you want) and when the global event fires, every profile will locally call that function.
You can't register a function globally, you register it within each profile (so you can customise it if you want) and when the global event fires, every profile will locally call that function.
-
- Posts: 15
- Joined: Thu Aug 30, 2018 2:07 pm
Re: Mudlet Control Across Different Profile
So registerAnonymousEventHandler is required for EACH function I want to call upon globally (or set it up in script window)?Vadi wrote: ↑Tue Jan 26, 2021 8:33 amCheck out https://wiki.mudlet.org/w/Manual:Event_Engine which explains how to work with events, that'll get you a long way!
You can't register a function globally, you register it within each profile (so you can customise it if you want) and when the global event fires, every profile will locally call that function.
currently when I use raiseGlobalEvent("sysSendAllProfiles", "updateStatus") from profile a, two things happen in profile b:
1. the function itself (disable trigger + print)
2. it sends a cmd "updateStatus"
is that normal?
Re: Mudlet Control Across Different Profile
> So registerAnonymousEventHandler is required for EACH function I want to call upon globally (or set it up in script window)?
No because a single function calls all others as needed. You just need to define them in the same way control.updateStatus is
> 2. it sends a cmd "updateStatus"
That's not normal and the code above doesn't do that - I think you might have changed something locally
No because a single function calls all others as needed. You just need to define them in the same way control.updateStatus is
> 2. it sends a cmd "updateStatus"
That's not normal and the code above doesn't do that - I think you might have changed something locally
-
- Posts: 15
- Joined: Thu Aug 30, 2018 2:07 pm
Re: Mudlet Control Across Different Profile
Now I know why, it is because there is a "send-text-to-all-games" package loaded in both of my profiles (part of the default package I think).Vadi wrote: ↑Wed Jan 27, 2021 4:12 pm> So registerAnonymousEventHandler is required for EACH function I want to call upon globally (or set it up in script window)?
No because a single function calls all others as needed. You just need to define them in the same way control.updateStatus is
> 2. it sends a cmd "updateStatus"
That's not normal and the code above doesn't do that - I think you might have changed something locally
Which means all "sysSendAllProfiles" event is duplicate, the 2nd cmd is in fact a expandAlias("updateStatus")
Should I remove the "send-text-to-all-games" package?