Quote:
How about this for a solution:
FireEvent(<type>, <data>)
Responder: Sub GlobalEvent(<ID>, <type>, <data>)
OK, yes this sounds quite practical.
Assuming that the event cannot be cancelled then you *know* your other plugins, if installed, will get it. Also the ID (the ID of the sending plugin) will be supplied by MUSHclient, and thus cannot be spoofed.
So, your event handler might look like this:
Sub OnPluginEvent (id, type, data)
If id = "4aa4239d9a3d479fa6559ef5" Or _
id = "df84905195b4526b510d2fa5" Then
' process event
End If
End Sub
By testing for the IDs of your known plugins, you eliminate events (possibly with the same names) which are sent by unknown plugins.
The only possible downside is that the other plugins (ones you didn't write) might react in an unexpected way to your event, but hopefully that won't occur. If you are really worried about it you simply use CallPlugin to call them directly, and not use events.
As for groups, what is really achieved there? Someone can always claim to be in your group when they are not.
BTW, you can use the "Arrayxxxx" functions to pass multiple arguments by name, like this:
ArrayCreate "args"
ArrayClear "args
ArraySet "args", "name", "Shadowfyr"
ArraySet "args", "language", "C++"
ArraySet "args", "client", "mushclient"
FireEvent "foo", ArrayExport ("args", ",")
This passes the three arguments (name, language, client) to the event handler. It then extracts them like this:
Sub OnPluginEvent (id, type, data)
dim name, language, client
' extract args
ArrayCreate "args"
ArrayClear "args
ArrayImport "args", "data", ","
If type = "foo" Then
name = ArrayGet ("args", "name")
language = ArrayGet ("args", "language")
client = ArrayGet ("args", "client")
' process args here
End If ' end of event foo
End Sub
|