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.

Detailed mIRC Script to TCL

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
c
crazycooky77
Voice
Posts: 2
Joined: Wed Oct 13, 2010 11:49 am

Detailed mIRC Script to TCL

Post by crazycooky77 »

Hey!

I doubt I'll find someone with enough patience and time for this, but it never hurts to ask.

I worked on an mIRC bot for about 3 years and it took me quite a while to learn it all, especially the counting script. Now I would like to "convert" my mIRC script so that I could use it in an eggdrop but I'm having quite a bit of trouble with it.


My bot generally just writes something whenever someone in the channel types a key word (e.g. you write "brb", the bot will say "see you in a sec!").


For that, I wrote this in TCL:

Code: Select all

bind pub -|- "brb" brb 
proc brb { nick host hand chan text } { 
putserv "msg $nick/$chan :See you in a sec $nick" 
} 

I have absolutely no idea if that's correct and I couldn't find anything on Google where I could test it for free (i.e. without an eggdrop, I only want to buy it when I actually have the script). Any suggestions would be great.


Now it gets a bit harder... when someone joins or leaves a channel, the bot says something again (e.g. on join -> Hello $nick!). It gets a bit more complicated, when the bot has some restrictions. For example, my mIRC script says "Hello $nick" if the ($nick != BotNick) and ($chan != #CertainChannel).


That's most of what my bot does or rather what the eggdrop should do. I do have 2 very complicated scripts, however. That would be the "counting script".

Whenever someone types "!cookie", the bot will say "X gave cookie to Y" and will add the variable 1 to Y. The variable will always increase, depending on how many cookies Y received and when you type "?cookie Y", the bot would tell you how many cookies Y has -> "Y has X $variable" (e.g. "Y has 10 cookies"). Again with many if's and else (Y has 1 cookie, Y has 0 cookieS, Y has 10 cookieS, etc). All variables are bound to the nicknames that were given cookies to and are saved by the bot.

The bot also "steals" cookies, where the variable will be decreased from X by 1 and added to Y by 1. E.g. "!cookiesteal X" -> "Y stole a cookie from X" -> Y has now +1 $variable (cookie) and X has minus 1.


One last thing I have is a timer with quit and rejoin. The bot leaves the channel with a certain text when you write the trigger word, comes back after X seconds and writes another sentence.


Other than that, the only thing that changes is that sometimes the text the bot writes is written via query, sometimes directly in the channel and sometimes via notice.


I've tried to learn this, but I'll tell you straight away, I'm a "noob". I would like any help you can give me - no matter if it's rewriting my script for me (though I know that is a bit much to ask) or giving me examples of how to write the certain codes I want or just general tips and tricks.

Looking forward to your replies!
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Re: Detailed mIRC Script to TCL

Post by willyw »

crazycooky77 wrote: ... (i.e. without an eggdrop, I only want to buy it when I actually have the script).
Eggdrop is free.
http://www.eggheads.org/downloads/

So is Windrop.
http://windrop.sourceforge.net/downloads.html
Any suggestions would be great.
Go for it! :)
Get a shell, and install eggdrop.
http://www.egghelp.org/ and see the left side.
This site has lots... LOTS... of info.

Alternate idea:
(assuming you have a Windows machine handy) - Install Windrop on your local machine. With the exception of some scripts that use some linux specific commands, it is a great way to experiment with writing your own TCL scripts. I keep a Windrop, just for that purpose.
...
I've tried to learn this, but I'll tell you straight away, I'm a "noob". I would like any help you can give me ... giving me examples of how to write the certain codes I want or just general tips and tricks.
When you install bot, one of the created sub dirs is doc/ . In it, find a file named tcl-commands.doc .
It is essential for script writing, as it contains syntax and explanation of eggdrop specific TCL commands.
Else, view it here:
http://www.eggheads.org/support/egghtml ... mands.html

Next:
http://suninet.the-demon.de/
A VERY nice tutorial. Starts with the basics, for newcomers.
Be sure to bookmark that site.

Next:
http://www.tcl.tk/man/tcl8.5/TclCmd/contents.htm
That's the rest - the non-Eggdrop specific TCL commands - , explained.

With those three things, and a Windrop to experiment on locally, you can write TCL scripts, and test.

I hope this helps.


p.s. If you can write mIRC scripts, then as soon as you look at tcl-commands.doc , it will click. ( Tip: Be sure to find and understand the bind command )
L
Luminous
Op
Posts: 146
Joined: Fri Feb 12, 2010 1:00 pm

Post by Luminous »

Just wanted to comment on this code:

Code: Select all

bind pub -|- "brb" brb
proc brb { nick host hand chan text } {
putserv "msg $nick/$chan :See you in a sec $nick"
} 
I suppose you could use a pub bind... but I'd use pubm, which uses the same args, like so:

Code: Select all

bind pubm * "% brb" brb

The "%" represents one word: the channel, in this case.

As for this line:

Code: Select all

putserv "msg $nick/$chan :See you in a sec $nick"
Its almost right, except you need "privmsg" rather than "msg" and you can't combine $nick and $chan together in that manner. You can do this, however:

Code: Select all

putserv "PRIVMSG $chan,$nick :See you in a sec $nick"
Or, you can write two individual lines, one that sends to $nick, and the other $chan. You can queue those with "puthelp" instead of "putserv" too, to make it a bit easier on your bot.

You could make a single proc to process several of those types of triggers, using string equal/match/regexp, with if/elseifs. You'd have to change the pubm bind like so in that case:

Code: Select all

bind pubm * * brb
proc brb {nick host hand chan text} {

# and then process each line to see if it matches what you want:

 if {[string equal -nocase "brb" $text]} {
   putserv "PRIVMSG $chan,$nick :See you in a sec $nick"
 } elseif { ... } 
} 
Hope that helped, you seem to be off to a pretty good start so far. :)
c
crazycooky77
Voice
Posts: 2
Joined: Wed Oct 13, 2010 11:49 am

Post by crazycooky77 »

Thanks for the great suggestions and links, I'll definitely check all those out today :D
Post Reply