egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Hadace messaging problem
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
neilpkemp
Voice


Joined: 13 Nov 2005
Posts: 21

PostPosted: Sun Nov 13, 2005 10:56 am    Post subject: Hadace messaging problem Reply with quote

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:
#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]
Back to top
View user's profile Send private message Send e-mail
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Sun Nov 13, 2005 7:15 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
mrhex
Voice


Joined: 13 Nov 2005
Posts: 12

PostPosted: Sun Nov 13, 2005 10:05 pm    Post subject: Reply with quote

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:
[ 03:01:12 ]  [ @Herjulf ] !msg janbanan Whipe them shoes before you come in!

Error!
Code:
[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.
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Mon Nov 14, 2005 6:36 am    Post subject: Reply with quote

Create the path "data/h_message.dat" so that the file exists (although it should've been done in the coding).
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
mrhex
Voice


Joined: 13 Nov 2005
Posts: 12

PostPosted: Mon Nov 14, 2005 1:00 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
neilpkemp
Voice


Joined: 13 Nov 2005
Posts: 21

PostPosted: Mon Nov 14, 2005 1:19 pm    Post subject: Reply with quote

same ere i get nothing either :S
Back to top
View user's profile Send private message Send e-mail
mrhex
Voice


Joined: 13 Nov 2005
Posts: 12

PostPosted: Mon Nov 14, 2005 1:37 pm    Post subject: Reply with quote

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 .
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Mon Nov 14, 2005 8:05 pm    Post subject: Reply with quote

... 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
Back to top
View user's profile Send private message Visit poster's website
mrhex
Voice


Joined: 13 Nov 2005
Posts: 12

PostPosted: Tue Nov 15, 2005 2:52 am    Post subject: Reply with quote

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:
   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.

Quote:

w
Open the file for writing only. Truncate it if it exists. If it doesn't exist, create a new file.
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Tue Nov 15, 2005 8:23 am    Post subject: Reply with quote

Code:
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
Back to top
View user's profile Send private message Visit poster's website
mrhex
Voice


Joined: 13 Nov 2005
Posts: 12

PostPosted: Tue Nov 15, 2005 4:44 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
mrhex
Voice


Joined: 13 Nov 2005
Posts: 12

PostPosted: Wed Nov 16, 2005 2:52 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
hadace
Voice


Joined: 16 Nov 2005
Posts: 1

PostPosted: Wed Nov 16, 2005 8:16 am    Post subject: messaging Reply with quote

hiez

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

about the location and access of the database file:

Quote:
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
Back to top
View user's profile Send private message
mrhex
Voice


Joined: 13 Nov 2005
Posts: 12

PostPosted: Wed Nov 16, 2005 11:15 am    Post subject: Reply with quote

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:

##### 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:

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:
Quote:

[ tehbot (~tehbot@xxx.xx.xxxx.net) ] [ Recepients list ]

But it has no file to read from. so it wont go on.
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Wed Nov 16, 2005 8:43 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber