| View previous topic :: View next topic |
| Author |
Message |
loulou7593 Voice
Joined: 08 Apr 2008 Posts: 12
|
Posted: Tue Jan 31, 2012 3:18 pm Post subject: Problem nick list html |
|
|
Hello all
I would like a tcl to create a nick list in a file HTML
here what I have
| Code: | ###################################
########### nick list ###########
###################################
set canal "#accueil"
set fsource "/home/loulou/liste.tpl"
set fichier "/home/loulou/public_html/liste.html"
bind join - "$canal *" list:join
bind part - "$canal *" list:part
bind sign - "$canal *" list:quit
proc list:join {nick uhost handle chan} { list:log; }
proc list:part {nick uhost handle chan text} {
if {$nick != $::botnick} { list:log; }
}
proc list:quit {nick uhost handle chan text} {
if {$nick != $::botnick} { list:log; }
}
proc list:log {} {
set ::u(op) {}
set ::u(hop) {}
set ::u(vop) {}
set ::u(nop) {}
set ::count 0
foreach cnick [chanlist $::canal] {
if { $cnick == $::botnick } { continue; }
incr ::count
if { [isop $cnick $::canal] == 1 } {
lappend ::u(op) $cnick
} elseif { [ishalfop $cnick $::canal] == 1 } {
lappend ::u(hop) $cnick
} elseif { [isvoice $cnick $::canal] == 1 } {
lappend ::u(vop) $cnick
} else {
lappend ::v(op) $cnick
}
}
save:log
}
proc save:log {} {
set fp [open $::fichier w]
set fi [open $::fsource r]
set tpl [read $fi -nonewline $fi]
close $fi
$ulist = ""
foreach nick $::u(op) {
append $ulist "<tr><td style='color:red;'>@$nick</td></tr>\n"
}
foreach nick $::u(hop) {
append $ulist "<tr><td style='color:blue;'>%$nick</td></tr>\n"
}
foreach nick $::u(vop) {
append $ulist "<tr><td style='color:yellow;'>+$nick</td></tr>\n"
}
foreach nick $::u(nop) {
append $ulist "<tr><td style='color:green;'>$nick</td></tr>\n"
}
regsub -all %count $tpl $::count tpl
regsub -all %channel $tpl $::canal tpl
regsub -all %list $tpl $ulist tpl
fputs $fp $tpl
close $fp
}
|
and the file template to be put in /home/loulou/liste.tpl
| Code: | <html>
<head>
<title>Les %count connectés sur %channel</title>
<style>body { background-color: black; }</style>
</head>
<body>
<table>
<tr><th>Il y a %count personnes sur %channel</th></tr>
%list
</table>
</body>
</html> |
that should create me a file HTML with the names of the members color with a bottom of black screen
but I have this error in partyline
| Code: | | Tcl error [list:join]: wrong # args: should be "read channelId ?numChars?" or "read ?-nonewline? channelId" |
somebody can help me please ?? |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Jan 31, 2012 3:22 pm Post subject: |
|
|
You've got an extra argument on the third line in save:log:
| Code: | | set tpl [read $fi -nonewline $fi] |
I'm not sure if you need the -nonewline option, in any case the line should be one of the below (depending on whether you do need the -nonewline option)
or
| Code: | | set tpl [read -nonewline $fi] |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
loulou7593 Voice
Joined: 08 Apr 2008 Posts: 12
|
Posted: Tue Jan 31, 2012 3:39 pm Post subject: |
|
|
I thus tested with the two codes
and
| Code: | | set tpl [read -nonewline $fi] |
and I have this error in partyline now
| Code: | | Tcl error [list:join]: can't read "ulist": no such variable |
|
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Jan 31, 2012 3:49 pm Post subject: |
|
|
That would be this line (in save:log):
That is not the proper syntax for setting variables in tcl; the proper way is like follows:
Checking further, there are several other, similar issues, such as this one:
| Code: | | append $ulist "<tr><td style='color:red;'>@$nick</td></tr>\n" |
You don't want to do a variable substitution on ulist here, so don't prefix the variable name with $:
| Code: | | append ulist "<tr><td style='color:red;'>@$nick</td></tr>\n" |
The same applies to other similar lines.
Further, comparing nicknames with ::botnick is not the best way to check if it's the bot itself or not, as it's a case-sensitive match. Instead, use the isbotnick command.
| Code: | | if {$nick != $::botnick} {... |
Would be
| Code: | | if {![isbotnick $nick]} {... |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
loulou7593 Voice
Joined: 08 Apr 2008 Posts: 12
|
Posted: Tue Jan 31, 2012 4:42 pm Post subject: |
|
|
thank you nml375
it is impeccable
I would like to know if it is possible to integrate a table around the pseudos ?
but the problem is that basic one does not know the number of pseudos connected. Thus how to define a table? |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Jan 31, 2012 5:13 pm Post subject: |
|
|
I'm sorry, but I have no idea whatsoever what you are talking about with "psuedos". As for table, if you are talking 'bout a html-table, your current code should already be creating a table with nicknames. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
loulou7593 Voice
Joined: 08 Apr 2008 Posts: 12
|
Posted: Tue Jan 31, 2012 5:29 pm Post subject: |
|
|
afflicted I am French and my English is not very good lol
pseudo = nick
look at this page, it is currently what the code of front gives me http://loulou.hosting-free.be/liste.html
I would like to know if it is possible to have the people who are connected in a table? |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Jan 31, 2012 5:36 pm Post subject: |
|
|
I just checked the source, and all the nicknames are in a table, one table row for each nick. If you are looking for some table borders, I suggest you setup the proper CSS for it. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
loulou7593 Voice
Joined: 08 Apr 2008 Posts: 12
|
Posted: Tue Jan 31, 2012 5:49 pm Post subject: |
|
|
here what I would like to do
[/img] |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Jan 31, 2012 7:13 pm Post subject: |
|
|
As I said, add the proper CSS to your html document.
http://www.w3schools.com/css/css_table.asp might be a good start. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
loulou7593 Voice
Joined: 08 Apr 2008 Posts: 12
|
Posted: Tue Jan 31, 2012 7:18 pm Post subject: |
|
|
| ah ok sorry I had not included/understood. I will look at page Internet |
|
| Back to top |
|
 |
loulou7593 Voice
Joined: 08 Apr 2008 Posts: 12
|
Posted: Wed Feb 01, 2012 7:07 am Post subject: |
|
|
Hello,
I think that there are minor problems because when a person join Channel that immediately does not write the name of the person in the file, on the other hand the meter works well.
Example:
on Chanel there are already the following people.
Niubot40
Ludo
the page indicates 2 people on the channel, but she writes that only one person on the page.
then if Cindy75 join the channel, the page indicates 3 people on the channel, but there is always that the name of only one person written on the page.
and only if another person join the channel, there the page indicates 4 people on the channel and she writes the name of 2 people. The name of the 2 first people who were already on the channel.
I think that the meter of people functions, but that there is a problem for the writing of the names of the people when it join, part or quit the channel. |
|
| Back to top |
|
 |
Papillon Owner

Joined: 15 Feb 2002 Posts: 724 Location: *.no
|
Posted: Wed Feb 01, 2012 1:49 pm Post subject: |
|
|
Your problem lies in the list:log proc
| Code: | else {
lappend ::v(op) $cnick
} |
probably just a typo, but I am guessing it should be:
| Code: | else {
lappend ::u(nop) $cnick
} |
you were in fact putting all the people not voice, halfop or op into a list which were never used. _________________ Elen sila lúmenn' omentielvo |
|
| Back to top |
|
 |
loulou7593 Voice
Joined: 08 Apr 2008 Posts: 12
|
Posted: Fri Feb 03, 2012 12:15 pm Post subject: |
|
|
Hello
I would have liked to know if somebody could help me to make the same thing but for two channels?
There that functions well for the channel #accueil, but I would like that makes me also a list for the channel #game
As that I could have the list of the two channels on the same page |
|
| Back to top |
|
 |
|