View previous topic :: View next topic |
Author |
Message |
ORATEGOD Voice
Joined: 08 Jun 2020 Posts: 14
|
Posted: Sun Jan 10, 2021 10:28 pm Post subject: Mrc to TCL !!! Plissssssssss !!!! |
|
|
Code: | on *:join:#CHAN1:{ mode #CHAN2 +v $nick } |
thanks a lot for the help friends |
|
Back to top |
|
 |
CrazyCat Owner

Joined: 13 Jan 2002 Posts: 673 Location: France
|
Posted: Mon Jan 11, 2021 6:57 am Post subject: |
|
|
You probably must begin to learn TCL.
Here is the basic "conversion":
Code: | bind join - "#chan1 *" voice
proc voice {nick uhost handle chan} {
pushmode "#chan2" +v $nick
} |
And a better procedure:
Code: | proc voice {nick uhost handle chan} {
if {$nick eq $::botnick} { return }
if { |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3690 Location: Mint Factory
|
Posted: Mon Jan 11, 2021 7:15 am Post subject: |
|
|
Code: |
bind join - * voice
proc voice {nick uhost hand chan} {
if {[isbotnick $nick] || ![string equal -nocase $chan "#chan2"] || ![botisop $chan]} return
pushmode $chan +v $nick
}
|
isbotnick - returns 0 or 1 if the nick is the bot itself
string equal with the -nocase argument compares the channel name with #chan2
botisop - returns 0 or 1 if the bot has channel operator status
pushmode - sends out a channel mode change, it's one of the methods with a slow queue
the ! (exclamation mark) in front of the [function] negates the result, basically turns the IF statement into an IF NOT _________________ Once the game is over, the king and the pawn go back in the same box. |
|
Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1117
|
|
Back to top |
|
 |
CrazyCat Owner

Joined: 13 Jan 2002 Posts: 673 Location: France
|
Posted: Mon Jan 11, 2021 10:18 am Post subject: |
|
|
caesar wrote: | Code: |
bind join - * voice
proc voice {nick uhost hand chan} {
if {[isbotnick $nick] || ![string equal -nocase $chan "#chan2"] || ![botisop $chan]} return
pushmode $chan +v $nick
}
|
isbotnick - returns 0 or 1 if the nick is the bot itself
string equal with the -nocase argument compares the channel name with #chan2
botisop - returns 0 or 1 if the bot has channel operator status
pushmode - sends out a channel mode change, it's one of the methods with a slow queue
the ! (exclamation mark) in front of the [function] negates the result, basically turns the IF statement into an IF NOT |
Thanks for having given explanations.
You made a small error on botisop: it's on target channel that it must be tested, so on #chan2, not on $chan. _________________ https://www.eggdrop.fr - French speaking IRC network
Offer me a coffee |
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3690 Location: Mint Factory
|
Posted: Mon Jan 11, 2021 12:38 pm Post subject: |
|
|
Actually I didn't.
For argument sake let's say the following variables hold some values:
Code: |
$nick = John (bot's nick is Bot)
$chan = #something
|
We break this code:
Code: |
if {[isbotnick $nick] || ![string equal -nocase $chan "#chan2"] || ![botisop $chan]} return
|
into 3 separate if statements so it's easier to follow:
Code: |
if {[isbotnick $nick]} return
if {![string equal -nocase $chan "#chan2"]} return
if {![botisop $chan]} return
|
1st - since $nick holds a value "John" and bot's nick is "Bot" the result will be false and continues to 2nd statement (or second part of the initial statement, doesn't mater from a compiler point of view)
2nd - since the $chan is #something and the two strings aren't equal the statement will return false but since it's an IF NOT will make the result a true and thus will enter it's THEN part and dose a return
Now let's make a change to $chan making it be equal with #cHaN2 (notice the mixed case) for example.
1st step will continue as above
2nd step compares the "#cHaN2" with #chan2 in a case in-sensitive matter, meaning the two are identical thus the statement returns true. the IF NOT makes the true into a false thus continues to 3rd step
3rd step - at this point the $nick = John and $chan = #cHaN2 (from the botisop perspective it's identical with #chan2) since it passed the 2nd step. So, no, $chan is correct there since excluded other names at 2nd step. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
Back to top |
|
 |
CrazyCat Owner

Joined: 13 Jan 2002 Posts: 673 Location: France
|
Posted: Tue Jan 12, 2021 7:15 pm Post subject: |
|
|
I disagree:
Reading the .mrc code, the script voices john on #chan2 if John joins #chan1. So the eggdrop must be op on #chan2 to give the voice. Doesn't matter if it'd op in #chan1 (so $chan), it doesn't make any action in it.
I think you made an initial confusion: John joins #chan1 ($chan) and must be voiced in #chan2.
Your script is: John joins any channl (but not #chan2) where the eggdrop is op, John is voiced. Not what I read in the .mrc. _________________ https://www.eggdrop.fr - French speaking IRC network
Offer me a coffee |
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3690 Location: Mint Factory
|
Posted: Wed Jan 13, 2021 1:49 am Post subject: |
|
|
Ah, i missed the #chan1 part in the initial post (to be honest didnd't even look at it). Yeah, you are right, my bad. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
Back to top |
|
 |
|