egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Mrc to TCL !!! Plissssssssss !!!!

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
ORATEGOD
Voice


Joined: 08 Jun 2020
Posts: 14

PostPosted: Sun Jan 10, 2021 10:28 pm    Post subject: Mrc to TCL !!! Plissssssssss !!!! Reply with quote

Code:
on *:join:#CHAN1:{ mode #CHAN2 +v $nick }


thanks a lot for the help friends
Back to top
View user's profile Send private message AIM Address
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 673
Location: France

PostPosted: Mon Jan 11, 2021 6:57 am    Post subject: Reply with quote

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 {![botisop "#chan2"} { return }
   if {![onchan $nick "#chan2"} { return }
   pushmode "#chan2" +v $nick
}

_________________
https://www.eggdrop.fr - French speaking IRC network
Offer me a coffee
Back to top
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3690
Location: Mint Factory

PostPosted: Mon Jan 11, 2021 7:15 am    Post subject: Reply with quote

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
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1117

PostPosted: Mon Jan 11, 2021 10:07 am    Post subject: Re: Mrc to TCL !!! Plissssssssss !!!! Reply with quote

Agreeing with the above.

Here are some links to bookmark and use.

http://suninet.the-demon.de/

https://docs.eggheads.org/mainDocs/tcl-commands.html

http://www.tcl.tk/man/tcl8.6/TclCmd/contents.htm

It's fun stuff. Try it. Smile Get started.
_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Back to top
View user's profile Send private message
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 673
Location: France

PostPosted: Mon Jan 11, 2021 10:18 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3690
Location: Mint Factory

PostPosted: Mon Jan 11, 2021 12:38 pm    Post subject: Reply with quote

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
View user's profile Send private message
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 673
Location: France

PostPosted: Tue Jan 12, 2021 7:15 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3690
Location: Mint Factory

PostPosted: Wed Jan 13, 2021 1:49 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber