| View previous topic :: View next topic |
| Author |
Message |
crazycooky77 Voice
Joined: 13 Oct 2010 Posts: 2
|
Posted: Wed Oct 13, 2010 12:03 pm Post subject: Detailed mIRC Script to TCL |
|
|
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: | 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! |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Wed Oct 13, 2010 12:22 pm Post subject: Re: Detailed mIRC Script to TCL |
|
|
| 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
| Quote: |
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.
| Quote: |
...
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/1.6.20/tcl-commands.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 ) |
|
| Back to top |
|
 |
Luminous Op
Joined: 12 Feb 2010 Posts: 146
|
Posted: Wed Oct 13, 2010 9:21 pm Post subject: |
|
|
Just wanted to comment on this code:
| Code: | 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: | | bind pubm * "% brb" brb |
The "%" represents one word: the channel, in this case.
As for this line:
| Code: | | 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: | | 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: | 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.  |
|
| Back to top |
|
 |
crazycooky77 Voice
Joined: 13 Oct 2010 Posts: 2
|
Posted: Thu Oct 14, 2010 4:22 am Post subject: |
|
|
Thanks for the great suggestions and links, I'll definitely check all those out today  |
|
| Back to top |
|
 |
|
|
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
|
|