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.

Dont know what DCC command im looking for from public trig

Help for those learning Tcl or writing their own scripts.
Post Reply
L
LoKii
Voice
Posts: 34
Joined: Wed Oct 21, 2009 3:59 am

Dont know what DCC command im looking for from public trig

Post by LoKii »

Hello everyone.

Been trying to find out how to execute a command in the DCC when triggered by a public proc.

What i would like to do is, to call a public command like !import and then in the proc tell the bot to execute in the party line .ap:import #oldchan #newchan (this command in the party line would import the protection settings from Opposing's script Allprotection).

I have tried several commands, like 'putdcc, channel set, channel bla' and I can not figure it out. Atleast in the putdcc command, it says putdcc <idx> <text> whereas I cannot find out what IDX actually is.

Is there away to do this?

What I have so far is:

Code: Select all

set home "#test"
#
bind pub n|n .import proc_secuon
#
proc proc_secuon {nick host handle channel text} {
    global home chanset
    putserv "NOTICE $nick :Importing Defualt Global Security Settings for channel $channel."
#    putdcc $idx "ap:import $home $channel"
#    channel set ".ap:import $home $channel"
# NO IDEA WHAT TO PUT HERE :(
    return 1
}
Since .ap:import or any of the other ap:*'s are not a part of the eggdrops core, but come from a script, how would I got about executing these dcc commands from a proc?

Any hints would be appreciated.

Cheers.
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

Try this code. I only tested to see if it works as command i don`t have All Flood Protection loaded so i didnt have what to import but you can do this part. Ive taken the original AFP code and make it public.

Code: Select all

bind pub - !import import

proc import {nick uhost hand chan arg} {

	if {[scan $arg "%s %s" oc ncs] != 2} {
		putserv "PRIVMSG $chan :\002AP\002: SYNTAX: !import <oldchan> <newchan>" ; return 0
	}
	foreach nc [string map [list * [channels]] $ncs] {
		if {[validchan $oc] && [validchan $nc]} {
			foreach ci [channel info $oc] {
				if {[string match ap:* [lindex $ci 0]]} {channel set $nc [lindex $ci 0] [lindex $ci 1]}
			}
			putserv "PRIVMSG $chan :\002AP\002: Imported all AllProtection settings from $oc to $nc."
		} else {
			putserv "PRIVMSG $chan :\002AP\002: Failed! Make sure that $oc and $nc are valid channels."
		}
	}
}
L
LoKii
Voice
Posts: 34
Joined: Wed Oct 21, 2009 3:59 am

Post by LoKii »

Thank you for your reply madelin, unfortunately, your code is not what i was looking for.

To make it a bit clear, you have used in your code: channel set which in my case is not working, cause the dcc commands I need to execute are not chanset #channel +/- bla, but directly: .ap:import bla bla bla.

So what I am looking for is a replacement for the channel set with something that will allow me to execute whatever command i want (not core commands, custom ones).

Is there a way from public to just send RAW text to the dcc?

Maybe i am also not making sense in describing what i want, hope its sort of clear now.

Cheers.
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

I made a script for .import (the dcc command) to be public. Meaning .ap:import is now public (you can use it from your channel)

You cannot use (as far as i know) a public command to trigger a dcc command. You can only make a public command act just like a dcc command (meaning it will set/edit/modify just like the original dcc command)
w
willyw
Revered One
Posts: 1209
Joined: Thu Jan 15, 2009 12:55 am

Re: Dont know what DCC command im looking for from public tr

Post by willyw »

LoKii wrote: ...
Since .ap:import or any of the other ap:*'s are not a part of the eggdrops core, but come from a script, how would I got about executing these dcc commands from a proc?

Any hints would be appreciated.

Examine AP, to figure out just what the scripter has done, to create this
.ap:import
command.
Or, perhaps easier, do: .binds *import* all
in the partyline.

Note that the bind calls a procedure :
::AllProtection::cmd import

So now you are hunting for a proc named
cmd
in the script.
And you find this:
proc cmd {cmd hand idx arg} {
In it, you are looking for
import
And it looks like it wants just two parameters... the old channel and the new channel.

All you need is to call this procedure and give it what it wants.
To get the job done, you really don't need to try to do anything with dcc.


Roughing this out, we get:

Code: Select all


bind pub n "!import" do_import_cmd

proc do_import_cmd {nick uhost handle chan text} {

   ::AllProtection::cmd import $handle -1 $text

 }


This is untested. But you said you just wanted some hints. :)

I think you can use -1, when there is no idx. Perhaps someone else can comment on that.

I hope this helps.
L
LoKii
Voice
Posts: 34
Joined: Wed Oct 21, 2009 3:59 am

Post by LoKii »

Code: Select all

::AllProtection::cmd import $handle -1 $text

This is the approach i was hoping for. I will try to take it from there now and figure out how to make it happen.

Many thanks :)
w
willyw
Revered One
Posts: 1209
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Let us know what you discover.
L
LoKii
Voice
Posts: 34
Joined: Wed Oct 21, 2009 3:59 am

Post by LoKii »

willyw wrote:Let us know what you discover.
Well, i discovered that the '-1' option does not work for disabling the IDX, and I still have no luck yet in getting this to work the way i would like.

I will post back here once/if i find a solution. Otherwise, i guess I will just have to continue setting the commands in the partyline.

My only problem is that i do not allow partyline access on that specific bot, but i would like to let channel masters be able to trigger some of the basic AP functions.

The only thing i do not understand at all is, why can i not just issue a dcc command from a public trigger?

Another function that I have also been trying is for example to trigger in public: .match lokii and have the bot spit out the results.

Yea yea, i know i could use other commands to get a similar response, but why not just .match directly?

My point is not orientated towards the .match command, but in general to be able to write something in the tcl script that will do said functions in the bot.

Cheers.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Try '0' as the IDX
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Post Reply