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.

Hadace messaging problem

Support & discussion of released scripts, and announcements of new releases.
n
neilpkemp
Voice
Posts: 21
Joined: Sun Nov 13, 2005 10:52 am

Hadace messaging problem

Post by neilpkemp »

im new to eggdrop's but as far as i know ive set this up as it says , it loads up ok on the bot but i get nothing when i try to use it

Code: Select all

#Hadace messaging (uzeno.tcl v.1.3 2005.nov.02) (based on HAL9000's learn.tcl)
# hadace@dpg.hu http://hadace.homelinux.org
#
# Installing:
#
# Put your uzeno.tcl file in your eggdrop scripts dir
# In your bots config file add
# source scripts/uzeno.tcl
#
# DESCRIPTION:
#
# Leave a message for a nick with "!msg <nick> <message>" when the nick isn't on the channel, or is away.
# After the nick join or spoke something on any channel the Bot delivers the messages.
#
# Leave a message: !msg <nick> <message>
bind pub v|o "!msg" mess_do
#list of the recepients: !messages
bind pub o|o "!messages" mess_lista
bind pubm - * mess_join
bind time - "20 * * * *" mess_sort

set message_db "h_message.dat"
set message_whodid ""

proc mess_sort {a c d e f} {
	global message_db
	set t_count [clock clicks -milliseconds]
	set filemuvelet [open $message_db r]
	set osszesuzenet ""
	while {![eof $filemuvelet]} {
		set konkretuzenet [gets $filemuvelet]
		if {[info exists konkretuzenet]&&$konkretuzenet!=""} {
			lappend osszesuzenet [split $konkretuzenet " "]
		}
	}
	close $filemuvelet
	set osszesuzenet [lsort -index 1 $osszesuzenet]
	set filemuvelet [open $message_db w]
	foreach konkretuzenet $osszesuzenet {
		puts $filemuvelet [join $konkretuzenet " "]
	}
	close $filemuvelet
	putlog "!message Done with sorting of data on the database ($message_db)->[expr double([clock clicks -milliseconds]-$t_count)/1000]s"
}

proc mess_do {nick host hand chan args} {
	set args [lindex $args 0]
	set args [split $args " "]
	if {[lindex $args 1] == ""} {
		puthelp "NOTICE $nick :igy te alma: !msg <nick> <uzenet>"
	} else {
		mess_write $nick [lindex $args 0] [lrange $args 1 end]
		puthelp "NOTICE $nick :[lindex $args 0] szamara uzenet eltarolva"
	}
}

proc mess_write { nick cimzett uzenet } {
	global message_db
	set cimzett [string tolower $cimzett]
	if {![file exists $message_db]} {
		file mkdir [lindex [split $message_db /] 0]
		set filemuvelet [open $message_db w+]
		puts $filemuvelet "Hadace messaging adatbazisfile letrehozva"
	} else {
		set filemuvelet [open $message_db a]
	}
	set systemTime [clock seconds]
	set ido [clock format $systemTime -format {%Y.%m.%d. %H.%M:}]
	puts $filemuvelet "$nick $cimzett $ido [join $uzenet] "
	close $filemuvelet
}

#####################
proc mess_join { nick uhost hand chan args } {
	#puthelp "NOTICE HeyBaby : $nick $uhost $hand $chan $args"
	global message_db message_whodid
	if {![info exists message_whodid]} {
		set message_whodid ""
	}
	set explain [string tolower $nick]
	set nick [string tolower $nick]
	set filemuvelet [open $message_db r]
	set osszesuzenet ""
	while {![eof $filemuvelet]} {
		gets $filemuvelet konkretuzenet
		set konkretuzenet [split $konkretuzenet " "]
		if {[string equal -nocase [lindex $konkretuzenet 1] $explain]} {
			lappend osszesuzenet [join $konkretuzenet " "]
		}
	}
	close $filemuvelet
	set count 0
	if {[llength $osszesuzenet]==1} {
		#puthelp "PRIVMSG $chan :${explain}: [join [lrange [split [lindex $osszesuzenet 0] " "] 2 end]]"
		set uzente [split [lindex $osszesuzenet 0] " "]
		puthelp "PRIVMSG $explain :[lindex $uzente 0] uzente [join [lrange [split [lindex $osszesuzenet 0] " "] 2 end]]"
		#puthelp "NOTICE HeyBaby : [lindex $osszesuzenet 0] uzente: [join [lrange [split [lindex $osszesuzenet 0] " "] 2 end]]"
		incr count
	} else {
		foreach konkretuzenet $osszesuzenet {
			incr count
			#puthelp "PRIVMSG $chan :\002\037${explain}\[\037\002${count}\002\037]:\037 \002[join [lrange [split $konkretuzenet " "] 2 end]]"
			puthelp "PRIVMSG $explain :[lindex $konkretuzenet 0]\[${count}] uzenete [join [lrange [split $konkretuzenet " "] 2 end]]"
			#puthelp "NOTICE HeyBaby :${explain} [lindex $konkretuzenet 0]\[${count}]: [join [lrange [split $konkretuzenet " "] 2 end]]"
		} 
	}
	if {$count == 0} { 
		#putlog "uzeno.tcl: nincs uzenet $nick szamara"
	} else {
		lappend message_whodid [list $explain [string tolower $chan]]
		set explain [message_filterstr $explain]	;# Don't allow code to be executed
		set chan [message_filterstr $chan]	;# ensure []s are properly handled...
		#utimer 60 "message_flood \"$explain\" \"$chan\""
		mess_delete $nick
		#putlog "uzeno.tcl: uzenet atadva $nick szamara"
	}
}
###############################################x
proc message_filterstr { data } {
	regsub -all -- \\\\ $data \\\\\\\\ data
	regsub -all -- \\\[ $data \\\\\[ data	
	regsub -all -- \\\] $data \\\\\] data
	regsub -all -- \\\} $data \\\\\} data
	regsub -all -- \\\{ $data \\\\\{ data
	regsub -all -- \\\" $data \\\\\" data
	return $data
}

proc mess_delete { cimzett {remnum "all"}} {
	global message_db
	set cimzett [string tolower $cimzett]
	set filemuvelet [open $message_db r]
	set osszesuzenet ""
	set count 1
	if {$remnum == "all"} {
		while {![eof $filemuvelet]} {
			gets $filemuvelet konkretuzenet
			if {![string equal -nocase [lindex [split $konkretuzenet] 1] $cimzett]} {
				lappend osszesuzenet $konkretuzenet
			}
		}
	} else {
		while {![eof $filemuvelet]} {
			gets $filemuvelet konkretuzenet
			if {![string equal -nocase [lindex [split $konkretuzenet] 1] $cimzett] || ($count != $remnum && $remnum != -2)} {
				if {[info exists konkretuzenet]&&$konkretuzenet!=""} {
					lappend osszesuzenet $konkretuzenet
				}
				if {[string equal -nocase [lindex [split $konkretuzenet] 1] $cimzett]} {
				incr count
				}
			} else {
				incr count
			}
		}
	}
	close $filemuvelet
	set filemuvelet [open $message_db w]
	foreach konkretuzenet $osszesuzenet {
		puts $filemuvelet $konkretuzenet
	}
	close $filemuvelet
}

proc mess_lista {nick host hand chan args} { 
	global message_db
	putserv "NOTICE $nick :\[ uzenetek cimzettjeinek listaja \]"
	set lista ""
	set filemuvelet [open $message_db r]
	while {![eof $filemuvelet]} {
		lappend lista [lindex [split [gets $filemuvelet] " "] 1]
	}
	close $filemuvelet
	foreach {a b c d e f g} [lsort -unique $lista] {
		putserv "NOTICE $nick :cimzettek: $a $b $c $d $e $f $g"
	}
	putserv "NOTICE $nick :\[ lista vege \]" 
}
putlog "Hadace messaging (uzeno.tcl v.1.3 2005.nov.02) for #mfc.cs @ quakenet loaded"
any ideas why it wont work?

thxs[/code]
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

neilpkemp wrote:any ideas why it wont work?
That says nothing! Check logs and post any error(s).

Ideally, contact the script's author.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
m
mrhex
Voice
Posts: 12
Joined: Sun Nov 13, 2005 9:57 pm

Post by mrhex »

Apparently the scripts needs a database file that it stores the messages etc in.

I started this script, and only got this error msg in partyline, when triggering it.
Trig!

Code: Select all

[ 03:01:12 ]  [ @Herjulf ] !msg janbanan Whipe them shoes before you come in!
Error!

Code: Select all

[03:03] Tcl error [mess_join]: couldn't open "data/h_message.dat": no such file or directory
Checked some, the data/ folder wont be created and the h_message.dat file wont ofc either. and it doesnt seem to be a rights issue.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Create the path "data/h_message.dat" so that the file exists (although it should've been done in the coding).
m
mrhex
Voice
Posts: 12
Joined: Sun Nov 13, 2005 9:57 pm

Post by mrhex »

I made a folder+file with botdir/ relative as root folder.

mkdir data
touch data/h_message.dat

I do no longer get the error message as above however no data is written to the file in question by the script.
n
neilpkemp
Voice
Posts: 21
Joined: Sun Nov 13, 2005 10:52 am

Post by neilpkemp »

same ere i get nothing either :S
m
mrhex
Voice
Posts: 12
Joined: Sun Nov 13, 2005 9:57 pm

Post by mrhex »

I tried some other scripts that does about the same as that one like, bseen and !learn they do indeed create a database file.

Trying to compare the different scripts to understand how the folder data and file h_message.dat is created.
It dont help me that the script is full of hungarian :d .
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

... and we downloaded a script in a language we do not understand for?

If it's a fast "seen" function that is needed then Google for "gseen".
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
m
mrhex
Voice
Posts: 12
Joined: Sun Nov 13, 2005 9:57 pm

Post by mrhex »

Alchera wrote: If it's a fast "seen" function that is needed then Google for "gseen".
Its not a seen script.
Its a message script, a kind of "delivering" service, that delivers a message to a person that is offline or away.
As soon as the person is active by posting or joining channel he gets the message.
and as far as i know there are none other doing what it does. But if there are feel free to point me to it.

And when i get it working i can translate the public output hungarian->english there are online translators that work pretty ok.

With similarities to bseen and !learn i mean the fact that they store their "knowledge" in database files.

I mailed the author, and pointed him to these board and this thread.
I get a feeling that the script have dependencies almost, as the error message dissapears when the file exist, but it is unable to write to the file.

Code: Select all

   close $filemuvelet 
   set osszesuzenet [lsort -index 1 $osszesuzenet] 
   set filemuvelet [open $message_db w] 
   foreach konkretuzenet $osszesuzenet { 
      puts $filemuvelet [join $konkretuzenet " "] 
Is the snippet i reckon is responsible for file creation.
I read up on the open command, it opens $message_db which is data/h_message.dat with the "w" flag. If that part of the script is ran, the file SHOULD be created, but i guess it isnt run.
w
Open the file for writing only. Truncate it if it exists. If it doesn't exist, create a new file.
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Code: Select all

set message_db "h_message.dat"
I have not read the code.

The code you have should check for the existence of the db file and if not already there, create it. From that point it's usual to open for appending
(a) and closed once additions have been made.

As for online language translators, you might be in for some hard work mainly because much simply does not translate; especially English.

I'd suggest contacting the script author for assistance in that regard.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
m
mrhex
Voice
Posts: 12
Joined: Sun Nov 13, 2005 9:57 pm

Post by mrhex »

I have kind of given up on the script.
Tried to work around it by rewriting some procedures.
I can simply not get it to work.

I like the idea of it, its a cool idea.


Would have been even cooler if it had worked. I mailed the Author 2 days ago about it. Pointing him/her to this thread.
Hopefully he pops by and drops a line or two.

Im to bad at tcl to do one meself.

The script is aviable for download both on egghelp and tclscripts, could be good to either fix or remove it from downloads.
m
mrhex
Voice
Posts: 12
Joined: Sun Nov 13, 2005 9:57 pm

Post by mrhex »

funny [censored], i removed the start line in the .conf file, rehashed the bot and still get. this message spammed in partyline whenever someone talks in a channel the bot is in.

Tcl error [mess_join]: couldn't open "h_message.dat": no such file or directory
h
hadace
Voice
Posts: 1
Joined: Wed Nov 16, 2005 7:46 am

messaging

Post by hadace »

hiez

the uzeno.tcl (messaging) is avaiable in english here

about the location and access of the database file:
set message_db "data/h_message.dat"
also in the directory where your eggdrop.conf is should be the "data" dir.

my test channel: #hadace @ quakenet
m
mrhex
Voice
Posts: 12
Joined: Sun Nov 13, 2005 9:57 pm

Post by mrhex »

I joined your channel waiting for you to pop in, left you a !msg on your drop.

I shure hope we can solve this odd bug. The creation of data/h_message.dat is never performed.

I did EXACTLY as told in the TCL.

1. put the uzeno-eng.tcl in /scripts dir
2. added source scripts/uzeno-eng.tcl (put it at the end incase of dependencies)

Ill list the scripts i am running as there isnt anything special running its just a utility bot, doing nothing in particular.

snip from the .conf

Code: Select all

##### SCRIPTS #####

# This is a good place to load scripts to use with your bot.

# This line loads script.tcl from the scripts directory inside your Eggdrop's
# directory. All scripts should be put there, although you can place them where
# you like as long as you can supply a fully qualified path to them.
#                 
# source scripts/script.tcl

source scripts/alltools.tcl
source scripts/action.fix.tcl
source scripts/egghttp.tcl
source scripts/imdb.tcl

source scripts/bseen1.4.2.tcl
source scripts/weather3.5.7.tcl
source scripts/googler1.0.tcl
source scripts/bash.org-1.4.7.tcl
source scripts/duke.tcl  
source scripts/uzeno-eng.tcl
# Use this script for Tcl and Eggdrop downwards compatibility.     
# NOTE: This can also cause problems with some newer scripts.       
source scripts/compat.tcl

# This script provides many useful informational functions, like setting
# users' URLs, e-mail address, ICQ numbers, etc. You can modify it to add
# extra entries.
source scripts/userinfo.tcl
loadhelp userinfo.help
bseen is able to write/create its database:

Code: Select all

bs_data.chan
And it is writing to the file.

Would be appreciated if we could solve this, since i aparently isnt the only one having problems.

The script triggers on the script commands also, did a !messages and got:
[ tehbot (~tehbot@xxx.xx.xxxx.net) ] [ Recepients list ]
But it has no file to read from. so it wont go on.
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Did you create a folder in the bot folder named "data"?

I have never used bseen, but does it actually create a new folder for its' database or just a file?
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Post Reply