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.

Dunno how i should solve this :S [Solved]

Help for those learning Tcl or writing their own scripts.
Post Reply
b
bootdisk
Voice
Posts: 12
Joined: Mon Jun 11, 2007 10:22 am

Dunno how i should solve this :S [Solved]

Post by bootdisk »

Ok, i have some problem with a request script that i found on this forum.

The script is basic request from metroid and "modified" by Tosser^^.

I have talked to both of them about this, mostly metroid.

I can post the part of the request script that Tosser^^ modified first and then say what my problem is.

Code: Select all


# Basic Request script


  # Request is accepted
  putquick "NOTICE $nickname :Your request is accepted. $bot will join $channel."
  putquick "PRIVMSG $request::homechan :Request from $nickname for $channel was accepted. The channel has [llength [chanlist $channel]] users."
  putbot "$bot :rjoin $channel $nickname *![getchanhost $nickname]"
  channel remove $channel
 }
}

proc request::version {} {
 putlog "Basic Request script version: $request::version by $request::author was loaded successfully."
}
   
request::version
Thats the script that is loaded on the main bot.

Here is the leaf script

Code: Select all

bind msg H| rjoin request:dojoin

proc request:dojoin { channel nickname hostname handle text } {
 set channel [lindex [split $text] 0]
 set nick [lindex [split $text] 1]
 set host [lindex [split $text] 2]
 if {![validuser [nick2hand $nick]]} {
   channel add $channel
   adduser $nick $host
   chattr $nick |+n $channel
  } else {
   chattr [nick2hand $nick] |+n $channel
 }
 putserv "NOTICE $nick :Hello $nick. Im your new bot. Your added to my userlist as '[nick2hand $nick]' with the hostname '$host'. Enjoy!"
}

So, my problem is that the leaf script. It wont join the channel.

And in the partyline on the leaf bot i get this

Code: Select all

Tcl error [request:dojoin]: no such channel
So im wondering if this leaf script can be rewriten so the main bot sends a command trough the botnet insteed of privmsg?

And if i use putbot on the mainbot to call the leaf-bot, how should i bind the the stuff in the leaf script?


Best Regards
bootdisk

PS. Dont know if im just guessing now, but maybe im on the right way? :S
Last edited by bootdisk on Mon Jun 11, 2007 1:17 pm, edited 1 time in total.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Your argument-list in request:dojoin is not in order.
doc/tcl-commands.doc wrote: (1) MSG
bind msg <flags> <command> <proc>
procname <nick> <user@host> <handle> <text>

Description: used for /msg commands. The first word of the user's
msg is the command, and everything else becomes the text argument.
Module: server
Hence the argumentlist should be something like "nickname uhost handle text".

As for sending messages through the botnet, you would use putbot to send the message, and create a binding of type "BOT" to recieve the message. Adopting your current script should be a mere matter of replacing the line sending the msg to leafbot, with putbot (message could be the same); and changing the binding and arguments for request:dojoin to use a BOT-binding rather than a MSG-binding.
doc/tcl-commands.doc wrote: putbot <bot-nick> <message>
Description: sends a message across the botnet to another bot. If no
script intercepts the message on the other end, the message is
ignored.
Returns: nothing
Module: core

...

(18) BOT
bind bot <flags> <command> <proc>
proc-name <from-bot> <command> <text>

Description: triggered by a message coming from another bot in
the botnet. The first word is the command and the rest becomes
the text argument; flags are ignored.
Module: core
NML_375
b
bootdisk
Voice
Posts: 12
Joined: Mon Jun 11, 2007 10:22 am

Post by bootdisk »

Uhm, sorry but i dont get it :/

First time im looking at TCL or code, but what i do know (or i guess) is that this script should be faster with botnet binds/procs rather then msg?

Maybe you can give me a hint on the that i should use in the main script?

Edit: Thanks for answer my post :)
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Ah well, we're all beginners at sometime.

Your current issue is that this:

Code: Select all

proc request:dojoin { channel nickname hostname handle text } {
does not match the list of parameters provided when the msg-binding triggers (being: "nickname user@host handle text"). What you need todo is modify the list of arguments (channel nickname hostname handle text) to match these. Names of the arguments does not matter (with the exception of "args"), however the number of parameters and arguments must match (one parameter per argument.

Change the above mentioned line into something like this:

Code: Select all

proc request:dojoin {nickname uhost handle text} {
NML_375
b
bootdisk
Voice
Posts: 12
Joined: Mon Jun 11, 2007 10:22 am

Post by bootdisk »

Thanks for the help mnl :)

The script is working now :)

Now i have to find some other script that i can use for fun :)

Thanks mate!
Post Reply