Formatting of code : You can (and must) use [ tcl ] an [ /tcl ] tags (without spaces in tags) to format your TCL codes and have syntax coloration x


Bartender script (PHP)
#16
(17/05/2023, 20:03)Fire-Fox Wrote: Not quite jokes, it's a bartender script :)

I'm not exactly sure what the PHP is supposed to do. However, if its purpose is to create animations when we type IRC commands, the following link might be helpful for you: https://github.com/ZarTek-Creole/TCL-ClaraServ.
Retrouvez les dernières modifications de mes scripts TCL (versions Alpha/Bêta) ainsi que d'autres de mes réalisations sur ma page GitHub et les versions stables dans la section scripts de ce site  8-)
  Reply
#17
(21/05/2023, 16:49)Fire-Fox Wrote: Thanks, i'll give it a go :)

@CrazyCat - What do you mean by : Datas are saved per channel in eggdrop channel settings (in the .chan file)
Eggdrop saves the .chan file each 5 minutes, so the stats will be really saved in the same time. If your eggdrop crashes, you can loose 5 minutes of stats.


(21/05/2023, 16:49)Fire-Fox Wrote: I would like it to add nick to like:

Code:
      set replies(cola) [list "Serves icecold cola to %nick (%utoday/%utotal/%ctotal)" \
      "Serves cola that been laying in pile of shit ~45c (%utoday/%utotal/%ctotal)" \
      "Serves cola been standing close to box of dryice ~1,3c (%utoday/%utotal/%ctotal)" \
      "Serves cola that been standing next to comp for few hrs (%utoday/%utotal/%ctotal)"]
It dosn't take the line with %nick only the others without %nick
- and when I do !beer nick it replies with my nick
It works well with the %nick, test !bang command. And %nick is replaced with the nick of the user typing the command.
If it doesn't work for you after having change the line: did you reload the script or rehash the eggdrop after having made your changes ?

(21/05/2023, 16:49)Fire-Fox Wrote: Another observation when you do like !beer and !cola it counts stats to all of them?
the stats count any command, I didn't made a stat by command.
zeolia: tchat gratuit, sans inscription ni publicité
Merci de ne pas demander d'aide en MP
Away
  Reply
#18
CrazyCat Wrote:It works well with the %nick, test !bang command. And %nick is replaced with the nick of the user typing the command.

Ohh I see, what will I need to do if I would like it like:

Code:
!cola Burger
and it replies

Code:
gives Burger a COLD Cola
?

Would it be to much trouble to ask you to make it per user stats when a user uses the bar commands?
  Reply
#19
Adding a potential nick is quite easy.

What do you mean when saying "per user stats" ? Did you read the comments in the source ?
Quote: # - %nick : nick of the user
# - %utoday, %utotal : user count for today and total
# - %ctoday, %ctotal : channel count for today and total

I just don't do any difference between !coffee and !wine (or other), all commands increment stats.
zeolia: tchat gratuit, sans inscription ni publicité
Merci de ne pas demander d'aide en MP
Away
  Reply
#20
Think I have it covered now :)
  Reply
#21
Following some good ideas from caesar (on egghelp), I'd updated the source.

Modifications:
- replace regsubs with string map
- added a potential victim (!coffee <nick>)
- old bind are removed on rehash/source
zeolia: tchat gratuit, sans inscription ni publicité
Merci de ne pas demander d'aide en MP
Away
  Reply
#22
I just tried your updated script but I got and error

Code:
[14:52:52] <OldBoys> Currently:     while executing
[14:52:52] <OldBoys> Currently: "dict get $bar nicks $nick today"
[14:52:52] <OldBoys> Currently:     (procedure "::bartender::formatmsg" line 5)
[14:52:52] <OldBoys> Currently:     invoked from within
[14:52:52] <OldBoys> Currently: "::bartender::formatmsg $answer $cmd $chan $vict"
[14:52:52] <OldBoys> Currently:     (procedure "::bartender::process" line 24)
[14:52:52] <OldBoys> Currently:     invoked from within
[14:52:52] <OldBoys> Currently: "::bartender::process $_pub1 $_pub2 $_pub3 $_pub4 $_pub5"
Codes:

Code:
   # Running command
   proc process {nick uhost handle chan text} {
      if {![channel get $chan bar]} { return }
      set cmd [string range $::lastbind 1 end]
      if {![info exists ::bartender::wait($chan)] || $::bartender::wait($chan)<[clock seconds]} {
         set ::bartender::wait($chan) [expr [clock seconds]+3]
      } else {
         set since [expr $::bartender::wait($chan) - [clock seconds]]
         set answer [lindex $::bartender::spam [rand [llength $::bartender::spam]]]
         regsub -all -- %since $answer $since answer
         putquick "PRIVMSG $chan :$answer"
         return
      }
      if {![info exists ::bartender::replies($cmd)]} {
         ::bartender::help $nick $uhost $handle $chan $text
         return
      }
      set vict $nick
      set nick [string tolower $nick]
      if {$text ne "" && [onchan $chan [join [lindex [split $text] 0]]]} {
         set vict [join [lindex [split $text] 0]]
      }
      ::bartender::statadd $chan $nick $cmd
      set answer [lindex $::bartender::replies($cmd) [rand [llength $::bartender::replies($cmd)]]]
      putserv "PRIVMSG $chan :[::bartender::formatmsg $answer $cmd $chan $vict]"
   }
   
   # Simple replacement of variables with values
   proc formatmsg {msg cmd chan nick} {
      set bar [channel get $chan bardb]
      set ctoday [dict get $bar today]
      set ctotal [dict get $bar total]
      set utoday [dict get $bar nicks $nick today]
      set utotal [dict get $bar nicks $nick total]
      set msg [string map [list %nick $nick %chan $chan %ctoday $ctoday %ctotal $ctotal %utotal $utotal %utoday $utoday] $msg]
      return $msg
   }
  Reply
#23
Does it occure when you assign a target (!coffee someone) ?
I updated my source to correct that
zeolia: tchat gratuit, sans inscription ni publicité
Merci de ne pas demander d'aide en MP
Away
  Reply
#24
(03/06/2023, 15:05)CrazyCat Wrote: Does it occure when you assign a target (!coffee someone) ?
I updated my source to correct that

I my case I just did !max and no username
  Reply
#25
I guess you mean !mix rather than !max.

Code:
<CrazyCat> !mix
<Jarvis> grinding up some weed for a mix (1)
<CrazyCat> !mix Myrddin
<Jarvis> goes strain hunting in morocco for some good shit for your mix (2)
zeolia: tchat gratuit, sans inscription ni publicité
Merci de ne pas demander d'aide en MP
Away
  Reply
#26
true, but i have added some other lines then the standard :)
  Reply
#27
It doesn't matter. The formatmsg procedure works.
The error you get seems to be in set utoday [dict get $bar nicks $nick today] which doesn't reference the answer.

Try the latest update of the script before answering.
zeolia: tchat gratuit, sans inscription ni publicité
Merci de ne pas demander d'aide en MP
Away
  Reply
#28
(03/06/2023, 16:06)CrazyCat Wrote: It doesn't matter. The formatmsg procedure works.
The error you get seems to be in set utoday [dict get $bar nicks $nick today] which doesn't reference the answer.

Try the latest update of the script before answering.

Works now, I was only telling you what I did. and also I have added more triggers then the standard had when I posted the php version to be translated to tcl  Smile
  Reply
#29
Thanks you @CrazyCat ( it's free )
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)