egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Dont know what DCC command im looking for from public trig

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
LoKii
Voice


Joined: 21 Oct 2009
Posts: 34

PostPosted: Thu Feb 28, 2013 5:07 am    Post subject: Dont know what DCC command im looking for from public trig Reply with quote

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
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Thu Feb 28, 2013 7:38 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
LoKii
Voice


Joined: 21 Oct 2009
Posts: 34

PostPosted: Thu Feb 28, 2013 7:47 am    Post subject: Reply with quote

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
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Thu Feb 28, 2013 7:49 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Thu Feb 28, 2013 4:54 pm    Post subject: Re: Dont know what DCC command im looking for from public tr Reply with quote

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. Smile

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
View user's profile Send private message
LoKii
Voice


Joined: 21 Oct 2009
Posts: 34

PostPosted: Fri Mar 01, 2013 3:08 am    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Fri Mar 01, 2013 8:53 am    Post subject: Reply with quote

Let us know what you discover.
Back to top
View user's profile Send private message
LoKii
Voice


Joined: 21 Oct 2009
Posts: 34

PostPosted: Sat Mar 02, 2013 3:15 am    Post subject: Reply with quote

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
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Sat Mar 02, 2013 12:19 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
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


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber