This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Trying to go from mIRC to tcl

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
D
Draknon
Voice
Posts: 30
Joined: Sun Apr 01, 2018 8:24 am

Trying to go from mIRC to tcl

Post by Draknon »

I am trying to learn tcl but I am just not getting it, so, I'll try it they way I learned mirc.. adapting from what others did.. if someone could change the following code from mIRC to tcl, it would help me understand at least how a cpl things work.

Code: Select all

on 1:TEXT:!cocoa:#:/describe # goes tho the TARDIS and mixes up a nice hot mug of cocoa with mini marshmallows and comes out and takes it to $nick and sits it on the table by $nick $+ .
what that does is this as an action...

~The_Doctor goes tho the TARDIS and mixes up a nice hot mug of cocoa with mini marshmallows and comes out and takes it to Draknon and sits it on the table by Draknon.

~The_Doctor is the mIRC bot. I am wanting this to be on an eggdrop bot along with some other similar commands.. so question #2 would be could I put multiple commands on 1 tcl script?
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Re: Trying to go from mIRC to tcl

Post by willyw »

Draknon wrote: ...

Code: Select all

on 1:TEXT:!cocoa:#:/describe # goes tho the TARDIS and mixes up a nice hot mug of cocoa with mini marshmallows and comes out and takes it to $nick and sits it on the table by $nick $+ .
...
I'm very rusty at mIRC scripting. But I think what that does, is creates a public command in a channel. Such that if nick types:
!cocoa
then the bot responds in the channel with some text.

If so, then what you need is a
bind pub


I suggest you bookmark this, and whenever you are playing with tcl for eggdrop, just keep it open in a tab for quick reference :
http://docs.eggheads.org/mainDocs/tcl-commands.html

Go there now, and text search and find:
bind pub
and read about that bind.
It is not complicated, but you'll need to get used to the way things are written in tcl-commands.doc (you also already have everything shown on that web page, in a file, under your bot's dir, in a sub-dir named doc/
and the filename is tcl-commands.doc . You can use whichever suits you, for reference. )

That's showing you how to compose a bind / proc matching pair.

Thus:

Code: Select all


bind pub - "!cocoa" foo

proc foo {nick uhost handle chan text} {

     putserv "privmsg $chan :Whatever you want to have bot say to $nick goes here. "

}
I named the proc that is called by the bind - "foo".
You can name it whatever you wish, just so long as it is a unique name.

A bind pub (see tcl-commands.doc for every bind) passes 5 variables, in a pre-defined order, into the called proc. You can name the variables almost anything you want, and use them, within THIS proc.

I hope this helps.

I suggest that if you are trying to learn tcl basics like this, that you create a temporary channel, just for testing. Put your bot in it. That way, with only yourself and your bot there, you can hack away at it, filling that channel with garbage, without bothering anyone else, and without them bothering you. :)
Last edited by willyw on Fri Apr 06, 2018 9:54 am, edited 1 time in total.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Re: Trying to go from mIRC to tcl

Post by willyw »

Draknon wrote: ...
so question #2 would be could I put multiple commands on 1 tcl script?
Yes.

Not sure yet, just what you mean. I can think of a couple things you might have meant, and the answer is Yes to all of them.

If you meant: Can you put multiple bind / proc pairs in one text file .tcl script?

Yes.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Re: Trying to go from mIRC to tcl

Post by willyw »

Draknon wrote:I am trying to learn tcl but I am just not getting it, so, I'll try it they way I learned mirc.. adapting from what others did..
Nothing wrong with that, although you might progress faster if you also have some good reference material to use at the same time.

I suggest you bookmark these, and keep them open in tabs, whenever you are experimenting and learning with tcl for eggdrop:

This is the Eggdrop specific commands:
http://docs.eggheads.org/mainDocs/tcl-commands.html

This is the rest of TCL itself:
http://www.tcl.tk/man/tcl8.6/TclCmd/contents.htm

This is an old website, but still very good for getting someone like yourself - someone that wants to learn tcl for eggdrop - started. It is a little course of instruction. It starts from nothing... you don't need to know anything to get started.
If you do it from start to finish, stopping from time to time to write little scripts of your own, to practice what you just learned - when you are done with it, you will be on your way. :)
It doesn't take long, either.
http://suninet.the-demon.de/

There are other nice tutorials and references out there too. Perhaps somebody else will post their recommendations for you, too.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Re: Trying to go from mIRC to tcl

Post by willyw »

Draknon wrote:I am trying to learn tcl but I am just not getting it, so,
...
Bookmark this too:

http://paste.tclhelp.net/


You'll need it someday, to be able to post your code so others can help you with it.

But also, that particular pastebin tries to help you. You can use the
Preview (Syntax check)
button, and if it finds errors in your code, it will point them out to you.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
D
Draknon
Voice
Posts: 30
Joined: Sun Apr 01, 2018 8:24 am

Post by Draknon »

willyw, you are awesome, thank you very much for the translate and for the links.
D
Draknon
Voice
Posts: 30
Joined: Sun Apr 01, 2018 8:24 am

Post by Draknon »

ok, so 2 questions.

1: is there a way to make that an action like using a /me?

2 can it be linked to a single person? how?
D
Draknon
Voice
Posts: 30
Joined: Sun Apr 01, 2018 8:24 am

Post by Draknon »

1: is there a way to make that an action like using a /me?
Answered from another post.
putnow "privmsg $chan :\001ACTION goes ..yadda yadda ...
is the fix
2: can it be linked to a single person? how?
I still need this answer
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Draknon wrote: ...
2 can it be linked to a single person? how?
Probably. But I don't understand what you mean, yet.

Explain more.
Or, show an example.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
D
Draknon
Voice
Posts: 30
Joined: Sun Apr 01, 2018 8:24 am

Post by Draknon »

willyw wrote:
Draknon wrote: ...
2 can it be linked to a single person? how?
Probably. But I don't understand what you mean, yet.

Explain more.
Or, show an example.

Code: Select all

bind pub - "!cocoa" cocoa 

proc cocoa {nick uhost handle chan text} { 

     putserv "privmsg $chan :\001ACTION Whatever you want to have bot say to $nick goes here. " 

} 
I want a specific person to be able to use that command. lets just say the nick is {tester}t so I only want {tester}t to be able to use the command !cocoa.

if it were a mirc script it would be...

Code: Select all

on lvl:text:!cocoa:#: /describe $chan what you want it to say here
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Draknon wrote:

Code: Select all

bind pub - "!cocoa" cocoa 

proc cocoa {nick uhost handle chan text} { 

     putserv "privmsg $chan :\001ACTION Whatever you want to have bot say to $nick goes here. " 

} 
I want a specific person to be able to use that command. lets just say the nick is {tester}t so I only want {tester}t to be able to use the command !cocoa.
Experiment with this:

Code: Select all

bind pub - "!cocoa" cocoa 

proc cocoa {nick uhost handle chan text} { 

   if {$nick ne "{tester}t"} {
        return 0
   }


     putserv "privmsg $chan :\001ACTION Whatever you want to have bot say to $nick goes here. " 

}
if it were a mirc script it would be...

Code: Select all

on lvl:text:!cocoa:#: /describe $chan what you want it to say here
I'm very rusty at mIRC scripting, but where in that line does it limit it to only {tester}t ?
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Since you are trying to learn, and perhaps I used a command that you've never looked up... so you can understand how it works... here are some references:

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

http://www.tcl.tk/man/tcl8.6/TclCmd/mathop.htm#M17

http://www.tcl.tk/man/tcl8.6/TclCmd/return.htm
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
D
Draknon
Voice
Posts: 30
Joined: Sun Apr 01, 2018 8:24 am

Post by Draknon »

willyw is awesome this is all set...
Post Reply