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.

DCC chat window

Old posts that have not been replied to for several years.
Locked
s
spyda
Halfop
Posts: 64
Joined: Mon Aug 12, 2002 2:22 am
Location: Australia

DCC chat window

Post by spyda »

Hey peoples...

I am writing a command window.. Little like /dcc chat $botnick. But this goes to port that I have set and a TCL runs in the dcc chat.. (bit like a fserver)

Now what I was wanting to know if there is a possable way to make relay goto the chan.. like pulog, but I am wanting them to goto that window when it is open and to normal putlog when the window is not open. If not just to the window!

Hope someone can help me with this, if anymore info is needed to help plz ask!

Thanx in Advance
------------
ThePope
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Erm, I didn't totally understand what you meant, but...

if {$window_is_open} {
putdcc $window_idx blah
} else {
putlog blah
}

All you have to do is keep track of when the window is open.

Lol ok, I looked at what you said again and I just have no idea what you mean. What is "relay" and what "chan" are you talking about and what does putlog have to do with it?
s
spyda
Halfop
Posts: 64
Joined: Mon Aug 12, 2002 2:22 am
Location: Australia

Sorry

Post by spyda »

Didn't think I explaned it right..

Ok what I am trying to do is relay putlog commands or make up a tcl that will change putlog to do other stuff or make a tcl for a whole new command (that looks the best).

To make the eggdrop msg DCC partyroom and a DCC chat window. but my problem is how does the bot know what the window is. I put putlog "/(idx/) $idx" in the script and it said this:
(6:57pm) <Asustek> (idx) 12
(6:57pm) <Asustek> Dcc chat connection to 12 was completed
So how does the bot know WHO it is talking to if it is a number and how can I use that in a script to make a relay goto that window.

Sorry about the misslead in my infomation, Hope that helps you with my problem!

------------
ThePope
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

1. To change putlog to do other stuff, look up the 'rename' command. You can rename the current putlog as old_putlog, then write your own putlog command to do other stuff, and then call old_putlog to do the old stuff.

2. The bot does not know WHO it is talking to. You said you created the chat with your own script (I think). Therefore it is up to your script to keep track of who it is talking to.

3. To make a relay go to that window, use putdcc 12 "blah blah blah"
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

The bot doesn't know who it is talking too.

If you are using your own style DCC interface, then you are the one doing the authentication.

Too eggdrop, the incoming connection is a host and port, nothing more. It doesn't get information like irc nicknames because it feels like.
s
spyda
Halfop
Posts: 64
Joined: Mon Aug 12, 2002 2:22 am
Location: Australia

Idea!!

Post by spyda »

Ok.. Just been thinking about what you guys have said about the dcc window. Now I have looked over the TCL files I have and come down to working like this.

So this the proc that takes care of it!

Code: Select all

proc asus_window {who what} {
 if {$asus_open} {
  putlog "$what"
  putdcc $who "$what"
  } else {!$asus_open} {
  putlog "$what"
 }
}

Now for the window opening I have the coding!

Code: Select all

bind MSG - $asus(cmd) asus_pub_menu

proc asus_pub_menu {nick uhost hand vasus} {
 global asus
 set asus_pass [lindex $vasus 0]
 set asus_noth [string tolower [split lrange $vasus] 1 end] 
 if {![passwdok $nick $asus_pass]} {
  return 0
  }
 if {![file exists $asus(setupfile)/setup.db]} {
  set asus_file [open $asus(setupfile)/setup.db w]
  puts $asus_file "0"
  close $asus_file
 }
 set asus_open 1
 putserv "PRIVMSG $nick :\001DCC CHAT chat [myip] $asus(port)\001"  
}
So when the code sets asus_open 1 then the other proc will pick up the window is open.. Now all I have to do is change all my putlog commands to asus_window $idx ""

Now will that work and will it work safely so no one can see it is there!!

Thanx in Advance
------------
ThePope
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

That's a good start ThePope, just a few tcl errors in what you have. Check the syntax for "else". You probalby need "global" for asus_open.
s
spyda
Halfop
Posts: 64
Joined: Mon Aug 12, 2002 2:22 am
Location: Australia

:(

Post by spyda »

And that was the reason the script was not working. BUT it took me about 2 hours to find and then about 1 min after that I cheaked the forum.
Now that will teach me!

Still got bugs with script but I have worked it out. but working with strings I am still now getting! and I have read all the help files I can get my hands on. If anyone can help me out with anymore infomation for working with strings, it will be good..... :D

Thanx all
------------
ThePope
d
darko``
Op
Posts: 121
Joined: Sun Sep 08, 2002 5:33 pm
Location: Malta

Post by darko`` »

Sure! But... What would you like to know about strings?
Also, check doc/tcl-commands.doc for 2 commands: hand2idx and idx2hand. You might find them usefull.
Ignorant and lazy people will save 30 minutes by chosing simple config file. Smart ones will save 3000 minutes of *everyone's* time by opting for complete config file.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Strings are simple to understand.

They are any line of text, numbers or code. Even lists are strings (though strings are not lists).

It's lists that confuse people.

They are, in a way, a array of strings.

They can be converted to and from each other, using lindex (on lists), split (on strings) and join (on lists). There is lrange as well, but this does different things (on lists) depending on the arguments.

Eggdrop uses strings, on items where only one thing is returned every time.

IE, in binds, the arguments are passed as strings.

For items that return multiple items, lists are used.

IE [channels] returns a list of the channels eggdrop is on
[chanlist] returns each nickname in a certain channel, in a list.

If there is any specific area of lists, that you don't understand, ask about it. Mosts tutorials on the internet are static, and use a language, that is broad, that tries to convey itself to all audiences. Whereas we, can give the personal touch, and give proper examples (to proper questions).
s
spyda
Halfop
Posts: 64
Joined: Mon Aug 12, 2002 2:22 am
Location: Australia

Thanx guys!

Post by spyda »

Worked with idx2hand and hand2idx for a while and worked out a nice little tcl. Still a little confused about strings and lists, but i think i will get there soon!

I have come to another problem with using files. I know how to read a file and write to a file. But i am not sure on how to make my script right to a file in a certen line.

eg (a info file on a $nick) Now i have worked out how to right that to a file and how to read the lines. What i am after doing is making a tcl in dcc CHAT to pull a single line and check it, if changed then change it in the file in the same place.

Just say i wanted to change Australia, Melbourne to USA, New York. This is the coding that i have so far.. but from there i have NO IDEA.. i have tested some ways.. but got no where.

Code: Select all

proc asus_menu_catch {idx asus_dcc} {
 global asus botnick 
 if {[string tolower [lindex $asus_dcc 0]] == $asus(dcctrig)help} {
  putdcc $idx "$asus(logo) Asustek Services v$asus(version) $asus(logo)"
  putdcc $idx "-------------------------------------"
  putdcc $idx "\002 Help Main \002"
  putdcc $idx "$asus(non)"
  putdcc $idx " All help files are listed in directors below"
  putdcc $idx " Format: \002.help <topic>\002"
  }
 if {[string tolower [lindex $asus_dcc 0]] == $asus(dcctrig)set} {
  if {[string tolower [lindex $asus_dcc 1]] == "info"} {
   set asus_info_who [string tolower [lindex asus_dcc 3]]
   if {$asus_info_who == ""} {
    putdcc $idx "$asus(logo) Syntax: No nick entered for infomation.
    } 
   set asus_file_info [open $asus(setupfile)/$asus_info_who.db r] 
   gets $asus_file_info asus_ircnick 
   gets $asus_file_info asus_name 
   close $asus_file_info   
   if {[string tolower [lindex $asus_dcc 2]] == "name"} {
I can do it with alot of coding for the first 3 lines, but after that what if the file has 100 info lines.

Thanx in Advance
------------
ThePope
Locked