| View previous topic :: View next topic |
| Author |
Message |
LoKii Voice
Joined: 21 Oct 2009 Posts: 34
|
Posted: Thu Feb 28, 2013 5:07 am Post subject: Dont know what DCC command im looking for from public trig |
|
|
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: |
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. |
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Thu Feb 28, 2013 7:38 am Post subject: |
|
|
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: |
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."
}
}
}
|
_________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
LoKii Voice
Joined: 21 Oct 2009 Posts: 34
|
Posted: Thu Feb 28, 2013 7:47 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Thu Feb 28, 2013 7:49 am Post subject: |
|
|
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) _________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Thu Feb 28, 2013 4:54 pm Post subject: Re: Dont know what DCC command im looking for from public tr |
|
|
| 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: |
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. |
|
| Back to top |
|
 |
LoKii Voice
Joined: 21 Oct 2009 Posts: 34
|
Posted: Fri Mar 01, 2013 3:08 am Post subject: |
|
|
| Quote: | | Code: | | ::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  |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Fri Mar 01, 2013 8:53 am Post subject: |
|
|
| Let us know what you discover. |
|
| Back to top |
|
 |
LoKii Voice
Joined: 21 Oct 2009 Posts: 34
|
Posted: Sat Mar 02, 2013 3:15 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sat Mar 02, 2013 12:19 pm Post subject: |
|
|
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
. |
|
| Back to top |
|
 |
|