I found this counter with time and date but I can't get it to work correctly, I hope someone can help me or guide me how to correct it so that it can work
Thank you in advance as always for your help in the forum
# Script to greet new users and count their visits
# Path to the counter file
set contadorFile "scripts/Lobby.txt"
# Define a function to greet new users and count their visits
proc greetAndCount {nick chan} {
# Get the current date and time
set fecha [clock format [clock seconds] -format "%Y-%m-%d"]
set hora [clock format [clock seconds] -format "%H:%M:%S"]
# Increment the counter
set contador [expr {file exists $contadorFile ? [readfile $contadorFile] + 1 : 1}]
# Save the counter
writefile $contadorFile $contador
# Build the greeting message with colors and bold
set saludo "Hello, \002$nick\002! Welcome to channel \002$chan\002. The current date is: \002$fecha\002, and the current time is: \002$hora\002. This is visit number \002$contador\002 to the channel."
# Send the message to the channel
putquick "PRIVMSG $chan :$saludo"
}
# Function to read a file
proc readfile {filename} {
set file [open $filename]
set content [read $file]
close $file
return $content
}
# Function to write to a file
proc writefile {filename content} {
set file [open $filename w]
puts -nonewline $file $content
close $file
}
# Bind the join event to the greetAndCount function for the #Lobby channel
bind join - "chan #Lobby greetAndCount"
# Define the global variable `argv`
global argv
# Check for errors in the counter file
if {![file exists $contadorFile]} {
set contador 1
}
# Initialize the global variable `nick`
global nick
set nick ""
# Assign the value of the first element of the `argv` list to the `nick` variable
set nick [lindex $argv 1]
putlog "=== #Lobby @ Count ==="
can't read "argv": no such variable
while executing
"lindex $argv 1"
(file "scripts/welcome.tcl" line 56)
invoked from within
"source scripts/welcome.tcl"
The script isn't designed to be used with an eggdrop but to be run from shell.
$argv is the list of arguments sent to a script.
The bind is not complete (bind join - "#lobby *" greetAndCount) and the greetAndCount defintion is false (proc greetAndCount {nick uhost handle chan} { ... })
CrazyCat wrote:The script isn't designed to be used with an eggdrop but to be run from shell.
$argv is the list of arguments sent to a script.
The bind is not complete (bind join - "#lobby *" greetAndCount) and the greetAndCount defintion is false (proc greetAndCount {nick uhost handle chan} { ... })
Want some other errors ?
I understand... thank you very much for the clarification