Signal callback support. - 23/06/06 09:51 PM
I think the /signal command should have callback support. This would make it a lot easier to make modules for scripts. What I think should be added is:
Add the /sreturn command, which only works in a signal.
This command could be called multiple times, each being added to a list. You can then use the $signal identifier to retrieve the lines by their number.
Also, when the /signal command is given, the list would be reset for that signal name.
Add the $signal identifier. This would be used to get the data returned by the /sreturn command.
Also, if the -r switch is used on the /signal command and no /sreturn is used in the on SIGNAL event, the list of returns would be to parameters of the /signal.
Add the -r switch to /signal.
Sorry if this is a bad explanation, if it is i'll try and explain better.
Add the /sreturn command, which only works in a signal.
Code:
/sreturn <text> - <text> is the line of text to be added to the list.
This command could be called multiple times, each being added to a list. You can then use the $signal identifier to retrieve the lines by their number.
Also, when the /signal command is given, the list would be reset for that signal name.
Add the $signal identifier. This would be used to get the data returned by the /sreturn command.
Code:
$signal(<name>,<N>) - <name> is the name of the signal that had the /sreturn. - <N> is which line to get.
Also, if the -r switch is used on the /signal command and no /sreturn is used in the on SIGNAL event, the list of returns would be to parameters of the /signal.
Add the -r switch to /signal.
Code:
/signal -r <name> <parameters>[code] Here is a small example: [code]on ^*:TEXT:*:?:{ ;The -r switch is used, so if there is no signal, $nick and $1- will be added to the list as line 1 and 2. signal -r ontext $nick $1- ;$signal is used to get the lines returned by the ontext signal. echo -a $signal(ontext,1) $signal(ontext,2) halt } on *:SIGNAL:ontext:{ ;Add $+(<,$1,>) to the list as the first line, because its the first /sreturn used. sreturn $+(<,$1,>) ;Add $2- to the list as the second line. sreturn $2- }
Sorry if this is a bad explanation, if it is i'll try and explain better.