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.

some help :)

Old posts that have not been replied to for several years.
Locked
b
bobjuh
Master
Posts: 268
Joined: Wed Oct 03, 2001 8:00 pm
Location: Netherlands
Contact:

some help :)

Post by bobjuh »

Oke i'm sorta rebuilding my eggdrop config to make it easy to configure.
I now want to build something in that it there is no userfile he will make it itself withe the botadmin in it.

This is what i have added var with admin name en host.

set botadmin "BoBjUh"
set adminmail "bobjuh@linux-nl.org"
set addhosts {
*!*ident@host1.isp.tcl
*!*ident@host1.isp.tcl
}
With that var the idea is dat you can add as many host as possible.
Now the problem is to add this to the userfile.
if {![file exists ${username}.user]} then {
close [open ${username}.user w]
set io [open ${username}.user a]
puts $io "#4v: eggdrop v1.6.12 -- Eggdrop -- written Mon Jan 1 00:00:00 2003"
puts $io "$botadmin - jmnoptx "
puts $io "--PASS +password"
puts $io "--HOSTS *!*@host.isp.tld"
puts $io "--XTRA created 1047407821"
close $io
}
I want it to add the host set in the addhosts. With the addhosts setting the idea is that you can add as many host as you want.
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Re: some help :)

Post by user »

Replace the current line writing the host with:

Code: Select all

foreach host $addhosts {
  puts $io "--HOSTS $host"
}
b
bobjuh
Master
Posts: 268
Joined: Wed Oct 03, 2001 8:00 pm
Location: Netherlands
Contact:

Re: some help :)

Post by bobjuh »

Oke thats work.

next problem.
I need an if statement or something to see if a module is loaded
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Re: some help :)

Post by user »

bobjuh wrote:I need an if statement or something to see if a module is loaded
There's at least two ways to do this.
1) check the list of modules returned by 'modules'.
2) check for the existence of a command provided by that module ('info commands cmdname')
b
bobjuh
Master
Posts: 268
Joined: Wed Oct 03, 2001 8:00 pm
Location: Netherlands
Contact:

Re: some help :)

Post by bobjuh »

user wrote:
bobjuh wrote:I need an if statement or something to see if a module is loaded
There's at least two ways to do this.
1) check the list of modules returned by 'modules'.
2) check for the existence of a command provided by that module ('info commands cmdname')
how do i do this ?
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Re: some help :)

Post by user »

bobjuh wrote:how do i do this ?
loop through the list returned by 'modules' or use 'info commands <command name>'
b
bobjuh
Master
Posts: 268
Joined: Wed Oct 03, 2001 8:00 pm
Location: Netherlands
Contact:

Re: some help :)

Post by bobjuh »

user wrote:
bobjuh wrote:how do i do this ?
loop through the list returned by 'modules' or use 'info commands <command name>'
Can you give me a clue how to code this ?
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Re: some help :)

Post by user »

bobjuh wrote:Can you give me a clue how to code this ?
I'm tired of giving you clues. Here's some working code:

Code: Select all

proc ismodule {name} {
	foreach m [modules] {
		if {[string eq $name [lindex $m 0]]} {return 1}
	}
	return 0
}
b
bobjuh
Master
Posts: 268
Joined: Wed Oct 03, 2001 8:00 pm
Location: Netherlands
Contact:

Post by bobjuh »

Oke this is what i got so far
proc dcc:test {hand idx arg} {
putidx $idx " \002Owner\002 "
foreach i [userlist +n] {
putidx $idx " $i [getuser $i XTRA IRL] [getuser $i XTRA EMAIL] [getuser $i XTRA LASTON]"
}
putidx $idx " "
putidx $idx " \002Masters\002 "
foreach i [userlist +m-n] {
putidx $idx " $i [getuser $i XTRA IRL] [getuser $i XTRA EMAIL] [getuser $i XTRA LASTON]"
}
}
Now the problem is that because the handle (also the irl fields) aren't al the same lenght the you get this.

Owner
test mail@my-isp.com mailadres@isp.tld
BoBjUh Ronald bobjuh@name.isp

How can i fix this.
i searched i think it has something to to with string and lenght but i don't know how to do this.
Last edited by bobjuh on Fri Aug 08, 2003 3:03 am, edited 1 time in total.
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Code: Select all

format "%9s %.3s %-4s %s" a bbbb c d
returns '        a bbb c    d'
Read http://tcl.tk/man/tcl8.3/TclCmd/format.htm for details.
b
bobjuh
Master
Posts: 268
Joined: Wed Oct 03, 2001 8:00 pm
Location: Netherlands
Contact:

Post by bobjuh »

user wrote:

Code: Select all

format "%9s %.3s %-4s %s" a bbbb c d
returns '        a bbb c    d'
Read http://tcl.tk/man/tcl8.3/TclCmd/format.htm for details.
hmz yes :/
i was thinking a mutch harder solution silly me :)
b
bobjuh
Master
Posts: 268
Joined: Wed Oct 03, 2001 8:00 pm
Location: Netherlands
Contact:

Post by bobjuh »

script
putidx $idx " \002 Botcrew : \002"
putidx $idx " "
putidx $idx " \002Owner\002"
foreach i [userlist +n] {
putidx $idx " $i [format "%15s %45s " [getuser $i XTRA IRL] [getuser $i XTRA EMAIL]]"
}
putidx $idx " "
putidx $idx " \002Masters\002 "
foreach i [userlist +m-n] {
putidx $idx " $i [format "%15s %45s " [getuser $i XTRA IRL] [getuser $i XTRA EMAIL]]"
}
}

output you can see @
http://bobjuh.daro.info/files/script.txt

problem is still the formating.
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

bobjuh wrote:problem is still the formating.
The problem is your fixed spacing of the nick.
b
bobjuh
Master
Posts: 268
Joined: Wed Oct 03, 2001 8:00 pm
Location: Netherlands
Contact:

Post by bobjuh »

Oke tnx again
Locked