| View previous topic :: View next topic |
| Author |
Message |
ORATEGOD Voice
Joined: 08 Jun 2020 Posts: 32
|
Posted: Mon Dec 28, 2020 10:45 pm Post subject: change mrc to tcl (please help) |
|
|
I already appreciate the help for this * .mrc (change it to * .tcl)
| Code: |
; ---------------------------------------------
; AGREGA NUEVOS PACKS A UN TXT (lastpacks.txt).
; ADD NEW PACKS TO A TXT (lastpacks.txt).
; ---------------------------------------------
on *:TEXT:!add packs*:#Channel1:{
if ($nick isop $chan) {
if (!$3) { .notice $nick 04[02 LastBot 04][02 syntax error04:02 !add packs 04(02Release Title04) 04] | halt }
while ($lines(lastpacks.txt) >= 50) { write -dl1 lastpacks.txt }
write lastpacks.txt $3- 12(02 $+ $date $+ 12)
msg #Channel1 04[02 Latest Packs Added04:02 $3- 04(02 $+ $date $+ 04) 04]
}
}
; ------------------------------------------------
; MUESTRA LOS ULTIMOS 50 PACKS SUBIDOS A LOS BOTS.
; SHOW THE LAST 50 PACKS UPLOADED TO THE BOTS.
; Triggers: !last - !latest - !l
; ------------------------------------------------
on *:TEXT:!last:#Channel2:{
var %i 50
var %c 1
.notice $nick 04[02 LastBot 04][02 Latest Releases04. 04]
while (%i > 0) {
.notice $nick 04[02 Release $chr(35) $+ %c $+ 04:02 $gettok($read(lastpacks.txt,%i),1,32) 04][02 Added04:02 $gettok($read(lastpacks.txt,%i),2-,32) $+ 04. 04]
dec %i
inc %c
}
}
}
}
|
Note ... this mrc I could test it and it works in a good way ... it is only for moderators (@) of a channel. |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Tue Dec 29, 2020 6:31 am Post subject: |
|
|
You can probably begin to learn tcl, especially when you have basics mrc remotes.
on *:TEXT is a bind pub (or pubm if text begins with *)
| Code: | set packlist "lastpacks.txt"
set maxentry 50
set packchan "#channel1"
set modchan "#channel2"
bind pub - !add newpack
proc newpack {nick uhost handle chan text} {
if {![string match -nocase $::packchan $chan]} { return }
set args [split $text]
if {![string match -nocase "packs" [lindex $args 0]]} { return }
if {[llength $args]<2} {
putserv "NOTICE $nick :Syntax error: !add packs \00302release title\003"
return
}
set now [strftime "%d/%m/%Y (%Hh%M)"]
set fi [open $::packlist "a"]
puts $fi "[join [lrange $args 1 end] $now"
close $fi
}
bind pub - !last lastpack
bind pub - !lastest lastpack
bind pub - !l lastpack
proc lastpack {nick uhost handle chan text} {
if {![string match -nocase $::modchan $chan]} { return }
set fo [open $::packlist "w"]
set packs [lrange [split [read -nonewline $fo] "\n"] end-50 end]
close $fo
foreach pack $packs {
putserv "PRIVMSG $nick :$pack"
}
} |
Not tested, but may work _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
|
| Back to top |
|
 |
ORATEGOD Voice
Joined: 08 Jun 2020 Posts: 32
|
Posted: Tue Dec 29, 2020 11:35 am Post subject: |
|
|
Greetings ... It does not add the lines to txt, and it does not show the results of the triggers.
NOTE: Thanks for the help you always give me in the forums.
[11:28] <~ORATEGOD> !add packs Six.Days.ebooks.pdf
[11:28] <~ORATEGOD> !l
[11:29] <~ORATEGOD> !last
[11:29] <~ORATEGOD> !lastest |
|
| Back to top |
|
 |
ORATEGOD Voice
Joined: 08 Jun 2020 Posts: 32
|
Posted: Tue Dec 29, 2020 11:36 am Post subject: |
|
|
| Cheers... Thanks for those references ... I'll study them. |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Wed Dec 30, 2020 5:30 am Post subject: |
|
|
| ORATEGOD wrote: | Greetings ... It does not add the lines to txt, and it does not show the results of the triggers.
NOTE: Thanks for the help you always give me in the forums.
[11:28] <~ORATEGOD> !add packs Six.Days.ebooks.pdf
[11:28] <~ORATEGOD> !l
[11:29] <~ORATEGOD> !last
[11:29] <~ORATEGOD> !lastest |
Did you well set packchan and modchan ?
And I made 2 small errors:
@line 17, a ] is missing:
| Code: | | puts $fi "[join [lrange $args 1 end]] $now" |
@line 26, bad opening of the file:
| Code: | | set fo [open $::packlist "r"] |
If you used party-line and console mode +d, you'll get the error. _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
ORATEGOD Voice
Joined: 08 Jun 2020 Posts: 32
|
Posted: Wed Dec 30, 2020 11:49 pm Post subject: |
|
|
I work with these lines...
| Code: | # ==============================================================================================================================================================================
# Add !latest
set packlist "lastpacks.db"
set maxentry 50
# Donde se anuncian los packs
set packchan "#Chan01"
# Donde se muestra los 50 últimos packs
set modchan "#Chan02"
bind pub - !add newpack
proc newpack {nick uhost handle chan text} {
if {![string match -nocase $::packchan $chan]} { return }
set args [split $text]
if {![string match -nocase "packs" [lindex $args 0]]} { return }
if {[llength $args]<2} {
putserv "NOTICE $nick :Syntax error: !add packs \00302release title\003"
return
}
set now [strftime "%d/%m/%Y (%Hh%M)"]
set fi [open $::packlist "a"]
puts $fi "[join [lrange $args 1 end] $now]"
close $fi
}
bind pub - !latest lastpack
bind pub - !l lastpack
proc lastpack {nick uhost handle chan text} {
if {![string match -nocase $::modchan $chan]} { return }
set fo [open $::packlist "r"]
set packs [lrange [split [read -nonewline $fo] "\n"] end-50 end]
close $fo
putserv "NOTICE $nick : "
putserv "NOTICE $nick :\00309,01 ========================================\[ !Latest - 50 Packs \]======================================== \003"
foreach pack $packs {
putserv "NOTICE $nick :\00309,01 $pack \003"
}
putserv "NOTICE $nick :\00309,01 ======================================================================================================= \003"
putserv "NOTICE $nick : "
} |
I complement it with this *.mrc // which I don't know how to write in TCL
| Code: | ;# ----------[ AutoAddLatest ]----------
on *:TEXT:*:#Chan01:{
tokenize 32 $strip($1-)
if ( [LWT]- isin $nick || [TF]- isin $nick || ORATEGOD isin $nick ) {
if ( $1 == New && Release isin $2 ) {
scon -a if ($network == NETWORK.IRC) msg #Chan01 !add packs $3
}
}
} |
|
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Thu Dec 31, 2020 6:31 am Post subject: |
|
|
| ORATEGOD wrote: | I complement it with this *.mrc // which I don't know how to write in TCL
| Code: | ;# ----------[ AutoAddLatest ]----------
on *:TEXT:*:#Chan01:{
tokenize 32 $strip($1-)
if ( [LWT]- isin $nick || [TF]- isin $nick || ORATEGOD isin $nick ) {
if ( $1 == New && Release isin $2 ) {
scon -a if ($network == NETWORK.IRC) msg #Chan01 !add packs $3
}
}
} |
|
This part of script will simply convert a line beginning by "New Release" on #chan01 on network.irc to a "!add packs" on #chan01, if user is [LWT], [TF] or ORATEGOD.
So it could be a short procedure:
| Code: | set autonick {\[LWT\] \[TF\] ORATEGOD}
bind pub - "new" addauto
proc addauto {nick uhost handle chan text} {
if {![string match -nocase $::packchan $chan]} { return }
set args [split $text]
if {![string match -nocase "release" [lindex $args 0]]} { return }
if {[lsearch -nocase $::autonick $nick]==-1} { return }
newpack $nick $uhost $handle $chan "newpack [join [lrange $args 1 end]]"
} |
_________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
ORATEGOD Voice
Joined: 08 Jun 2020 Posts: 32
|
Posted: Sun Jan 03, 2021 4:24 pm Post subject: |
|
|
| CrazyCat wrote: | | ORATEGOD wrote: | I complement it with this *.mrc // which I don't know how to write in TCL
| Code: | ;# ----------[ AutoAddLatest ]----------
on *:TEXT:*:#Chan01:{
tokenize 32 $strip($1-)
if ( [LWT]- isin $nick || [TF]- isin $nick || ORATEGOD isin $nick ) {
if ( $1 == New && Release isin $2 ) {
scon -a if ($network == NETWORK.IRC) msg #Chan01 !add packs $3
}
}
} |
|
This part of script will simply convert a line beginning by "New Release" on #chan01 on network.irc to a "!add packs" on #chan01, if user is [LWT], [TF] or ORATEGOD.
So it could be a short procedure:
| Code: | set autonick {\[LWT\] \[TF\] ORATEGOD}
bind pub - "new" addauto
proc addauto {nick uhost handle chan text} {
if {![string match -nocase $::packchan $chan]} { return }
set args [split $text]
if {![string match -nocase "release" [lindex $args 0]]} { return }
if {[lsearch -nocase $::autonick $nick]==-1} { return }
newpack $nick $uhost $handle $chan "newpack [join [lrange $args 1 end]]"
} |
|
HAPPY YEAR FRIENDS !!
nowhere in that code it does "!add packs thepackname"
!add packs
| Code: | scon -a if ($network == NETWORK.IRC) msg #Chan01 !add packs $3
| How can it be corrected?
|
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Sun Jan 03, 2021 6:59 pm Post subject: |
|
|
Ok, so I explain: the piece of code I add must be added to the previous code.
And as eggdrop is mono-server, it's useless to verify on which server it is connected.
So, here is the full code (based on mine):
| Code: | set packlist "lastpacks.txt"
set maxentry 50
set packchan "#channel1"
set modchan "#channel2"
set autonick {\[LWT\] \[TF\] ORATEGOD}
# triggers "!add packs" command
bind pub - !add newpack
proc newpack {nick uhost handle chan text} {
if {![string match -nocase $::packchan $chan]} { return }
set args [split $text]
if {![string match -nocase "packs" [lindex $args 0]]} { return }
if {[llength $args]<2} {
putserv "NOTICE $nick :Syntax error: !add packs \00302release title\003"
return
}
set now [strftime "%d/%m/%Y (%Hh%M)"]
set fi [open $::packlist "a"]
puts $fi "[join [lrange $args 1 end]] $now"
close $fi
}
# triggers "!last", "!latest" and "!l" commands
bind pub - !last lastpack
bind pub - !lastest lastpack
bind pub - !l lastpack
proc lastpack {nick uhost handle chan text} {
if {![string match -nocase $::modchan $chan]} { return }
set fo [open $::packlist "r"]
set packs [lrange [split [read -nonewline $fo] "\n"] end-50 end]
close $fo
foreach pack $packs {
putserv "PRIVMSG $nick :$pack"
}
}
# triggers when someone in $autonick list
# type "new release ....."
bind pub - "new" addauto
proc addauto {nick uhost handle chan text} {
if {![string match -nocase $::packchan $chan]} { return }
set args [split $text]
if {![string match -nocase "release" [lindex $args 0]]} { return }
if {[lsearch -nocase $::autonick $nick]==-1} { return }
newpack $nick $uhost $handle $chan "newpack [join [lrange $args 1 end]]"
} |
_________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
|