|
Joined: Aug 2003
Posts: 66
Babel fish
|
OP
Babel fish
Joined: Aug 2003
Posts: 66 |
I saw this on usent and think it might be interesting to dabble around abit with for a while. Anyway the goal is to have a normal user (not a irc op or channel op) be able to take away their own ability to chat on a channel. So they dont accidently type in the wrong window and send chat to a channel they dont want to send it into. I have may basic script of:
on 1:input:#channelname:{
echo -a This is a read only channel
halt
}
But I want to add some functionality to it. I want to be able to edit the channel or channels on the fly. Probably with typing something somewhere. Remember this is all being entered by the user running the script not by others so it could be tricky but I think there is a way, just not sure what it is. Thanks!
|
|
|
|
Joined: Aug 2003
Posts: 66
Babel fish
|
OP
Babel fish
Joined: Aug 2003
Posts: 66 |
/me looks around and is a bit amazed that no one yet has an answer and continues to look on his own as well as seeing if the message board will provide assistance
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
[code] on ^*:INPUT:$(%readonly):{ if ((/* iswm $1) && ($ctrlenter)) return echo 4 -at This channel is read only. haltdef }
alias readonly { if (($1 == add) && (#* iswm $2) && (!$istok(%readonly,$2,44)) { set %readonly $addtok(%readonly,$2,44) echo 5 -at Added $2 to read-only list } elseif (($1 == del) && (#* iswm $2) && ($istok(%readonly,$2,44)) { set %readonly $remtok(%readonly,$2,1,44) echo 5 -at Removed $2 from the read-only list } elseif ($1 == list) { echo 5 -at Read-only list: $replace(%readonly,$chr(44),$chr(44) $+ $chr(32)) } else { echo 5 -at Syntax: /readonly add #channel echo 5 -at Syntax: /readonly del #channel echo 5 -at Syntax: /readonly list } } [code] (untested)
-genius_at_work
|
|
|
|
Joined: Aug 2003
Posts: 66
Babel fish
|
OP
Babel fish
Joined: Aug 2003
Posts: 66 |
Doesnt work;
If I enter the command: /readonly
/readonly list
/readonly add #channelname
i get this back:
* /if: invalid format (line 15, script1.ini) - * /if: invalid format (line 15, script1.ini) - * /if: invalid format (line 15, script1.ini)
|
|
|
|
Joined: Dec 2004
Posts: 66
Babel fish
|
Babel fish
Joined: Dec 2004
Posts: 66 |
This line: if (($1 == add) && (#* iswm $2) && (!$istok(%readonly,$2,44)) {
needs a ")" added: if (($1 == add) && (#* iswm $2) && (!$istok(%readonly,$2,44))) {
|
|
|
|
Joined: Aug 2003
Posts: 66
Babel fish
|
OP
Babel fish
Joined: Aug 2003
Posts: 66 |
ok that fixed the errors: [15:11:38] Read-only list: [15:11:42] Syntax: /readonly add #channel [15:11:42] Syntax: /readonly del #channel [15:11:42] Syntax: /readonly list [15:11:51] Added #fudge to read-only list However it did make the channel a read-only channel ... I was still able to send text to the channel.
on ^*:INPUT:$(%readonly):{
if ((/* iswm $1) && ($ctrlenter)) return
echo 4 -at This channel is read only.
haltdef
}
alias readonly {
if (($1 == add) && (#* iswm $2) && (!$istok(%readonly,$2,44))) {
set %readonly $addtok(%readonly,$2,44)
echo 5 -at Added $2 to read-only list
}
elseif (($1 == del) && (#* iswm $2) && ($istok(%readonly,$2,44))) {
set %readonly $remtok(%readonly,$2,1,44)
echo 5 -at Removed $2 from the read-only list
}
elseif ($1 == list) {
echo 5 -at Read-only list: $replace(%readonly,$chr(44),$chr(44) $+ $chr(32))
}
else {
echo 5 -at Syntax: /readonly add #channel
echo 5 -at Syntax: /readonly del #channel
echo 5 -at Syntax: /readonly list
}
}
|
|
|
|
Joined: Dec 2004
Posts: 66
Babel fish
|
Babel fish
Joined: Dec 2004
Posts: 66 |
In the line:
on ^*:INPUT:$(%readonly):{
remove the "^" so it's:
on *:INPUT:$(%readonly):{
|
|
|
|
Joined: Aug 2003
Posts: 66
Babel fish
|
OP
Babel fish
Joined: Aug 2003
Posts: 66 |
Ok that works.
Now the real tricky part ... I /readonly added another channel. This did not overwrite the original channel nor did it add a second channel. I think it would be good to have the ability to have multiple channels set as "read only"
Thanks again
|
|
|
|
Joined: Dec 2004
Posts: 66
Babel fish
|
Babel fish
Joined: Dec 2004
Posts: 66 |
hmm, try a few more times and double check. looks to me as if that part should work. If it doesn't maybe show us your input/output.
|
|
|
|
Joined: Aug 2003
Posts: 66
Babel fish
|
OP
Babel fish
Joined: Aug 2003
Posts: 66 |
dont know why it didnt work before when i tested it but it does now.
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
also change
if ((/* iswm $1) && ($ctrlenter)) return
to
if ((/* iswm $1) || ($ctrlenter)) return
This well mean if while in that channle you enter a command using / it well work OR if you hold CTRL down while pressing enter the line well go to channel, so u have a imediate overrider of the script. I beleive it was ment to be a || (OR) and not a && (AND) to begin with.
|
|
|
|
Joined: Aug 2003
Posts: 66
Babel fish
|
OP
Babel fish
Joined: Aug 2003
Posts: 66 |
on *:INPUT:$(%readonly):{
if ((/* iswm $1) || ($ctrlenter)) return
echo 4 -at This channel is read only.
haltdef
}
alias readonly {
if (($1 == add) && (#* iswm $2) && (!$istok(%readonly,$2,44))) {
set %readonly $addtok(%readonly,$2,44)
echo 5 -at Added $2 to read-only list
}
elseif (($1 == del) && (#* iswm $2) && ($istok(%readonly,$2,44))) {
set %readonly $remtok(%readonly,$2,1,44)
echo 5 -at Removed $2 from the read-only list
}
elseif ($1 == list) {
echo 5 -at Read-only list: $replace(%readonly,$chr(44),$chr(44) $+ $chr(32))
}
else {
echo 5 -at Syntax: /readonly add #channel
echo 5 -at Syntax: /readonly del #channel
echo 5 -at Syntax: /readonly list
echo 5 -at Syntax: /readonly clear
}
}
I just noticed something with this script. It works great execpt for the CLEAR command ... it doesnt exist :-)
|
|
|
|
|