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 

Trying to go from mIRC to tcl

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


Joined: 01 Apr 2018
Posts: 30

PostPosted: Fri Apr 06, 2018 2:44 am    Post subject: Trying to go from mIRC to tcl Reply with quote

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:
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?
Back to top
View user's profile Send private message
willyw
Owner


Joined: 15 Jan 2009
Posts: 957

PostPosted: Fri Apr 06, 2018 9:44 am    Post subject: Re: Trying to go from mIRC to tcl Reply with quote

Draknon wrote:

...
Code:
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:


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. Smile
_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !


Last edited by willyw on Fri Apr 06, 2018 9:54 am; edited 1 time in total
Back to top
View user's profile Send private message
willyw
Owner


Joined: 15 Jan 2009
Posts: 957

PostPosted: Fri Apr 06, 2018 9:48 am    Post subject: Re: Trying to go from mIRC to tcl Reply with quote

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 !
Back to top
View user's profile Send private message
willyw
Owner


Joined: 15 Jan 2009
Posts: 957

PostPosted: Fri Apr 06, 2018 9:54 am    Post subject: Re: Trying to go from mIRC to tcl Reply with quote

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. Smile
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 !
Back to top
View user's profile Send private message
willyw
Owner


Joined: 15 Jan 2009
Posts: 957

PostPosted: Fri Apr 06, 2018 9:58 am    Post subject: Re: Trying to go from mIRC to tcl Reply with quote

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 !
Back to top
View user's profile Send private message
Draknon
Voice


Joined: 01 Apr 2018
Posts: 30

PostPosted: Fri Apr 06, 2018 11:47 am    Post subject: Reply with quote

willyw, you are awesome, thank you very much for the translate and for the links.
Back to top
View user's profile Send private message
Draknon
Voice


Joined: 01 Apr 2018
Posts: 30

PostPosted: Fri Apr 06, 2018 6:17 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
Draknon
Voice


Joined: 01 Apr 2018
Posts: 30

PostPosted: Sat Apr 07, 2018 12:16 am    Post subject: Reply with quote

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


Answered from another post.

Quote:
putnow "privmsg $chan :\001ACTION goes ..yadda yadda ...


is the fix

Quote:
2: can it be linked to a single person? how?


I still need this answer
Back to top
View user's profile Send private message
willyw
Owner


Joined: 15 Jan 2009
Posts: 957

PostPosted: Sat Apr 07, 2018 12:21 pm    Post subject: Reply with quote

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 !
Back to top
View user's profile Send private message
Draknon
Voice


Joined: 01 Apr 2018
Posts: 30

PostPosted: Sun Apr 08, 2018 2:31 am    Post subject: Reply with quote

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:
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:
on lvl:text:!cocoa:#: /describe $chan what you want it to say here
Back to top
View user's profile Send private message
willyw
Owner


Joined: 15 Jan 2009
Posts: 957

PostPosted: Sun Apr 08, 2018 9:02 am    Post subject: Reply with quote

Draknon wrote:



Code:
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:

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. "

}


Quote:

if it were a mirc script it would be...
Code:
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 !
Back to top
View user's profile Send private message
willyw
Owner


Joined: 15 Jan 2009
Posts: 957

PostPosted: Sun Apr 08, 2018 9:04 am    Post subject: Reply with quote

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 !
Back to top
View user's profile Send private message
Draknon
Voice


Joined: 01 Apr 2018
Posts: 30

PostPosted: Mon Apr 09, 2018 1:55 am    Post subject: Reply with quote

willyw is awesome this is all set...
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