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.

trigger script help

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
shikashinigami
Voice
Posts: 11
Joined: Fri May 26, 2006 2:15 pm
Location: bah

trigger script help

Post by shikashinigami »

I'm currently running this script on my eggdrop for triggers (public commands):

Code: Select all

#Edit this to who you want to activate the triggers (The default is set to 
#public, which means everyone can activate them)

set trigbind -|- 

#Set the channels to where you want the triggers available


set channelone    "#mychannel"
set channeltwo    ""
set channelthree  ""

#Edit these to what ever you want the trigger names to be (IE !rules or ^Help)

set trigger1 "!rules"
set trigger2 ""
set trigger3 ""
set trigger4 ""
set trigger5 ""

#Edit these to what ever you want to be displayed in the channel after the trigger the
#has been used, (IE if trigger1 was set to !rules then change text1 to...
#These are the rules ect ect).

set text1 "These are the rules for channel shika, they are law... | Rule #1: Don't be a jerk. We're here to have fun, act like it | Rule #2: Don't ask to be an op. If you have to ask, chances are you don't deserve it | Rule #3: Have fun | Rule #4: Don't bother the bot, he isn't merciful like the other ops."
set text2 ""
set text3 ""
set text4 ""
set text5 ""

#Just comment out the "die" line with a #
#I put it here as a small reminder to edit this script.
#die "* [file tail [info script]]: Forgot to edit this script didn't you?"


bind pub $trigbind $trigger1 text-1
bind pub $trigbind $trigger2 text-2
bind pub $trigbind $trigger3 text-3
bind pub $trigbind $trigger4 text-4
bind pub $trigbind $trigger5 text-5

proc text-1 {n u h c a }  {
global channelone
global channeltwo
global channelthree
global text1
if {$c == $channelone || $c == $channeltwo || $c == $channelthree} {
puthelp "PRIVMSG $c :$text1"
}
return 0
}

proc text-2 {n u h c a}  {
global channelone
global channeltwo
global channelthree
global text2
if {$c == $channelone || $c == $channeltwo || $c == $channelthree} {
puthelp "PRIVMSG $c :$text2"
}
return 0
}

proc text-3 {n u h c a}  {
global channelone
global channeltwo
global channelthree
global text3
if {$c == $channelone || $c == $channeltwo || $c == $channelthree} {
puthelp "PRIVMSG $c :$text3"
}
return 0
}

proc text-4 {n u h c a}  {
global channelone
global channeltwo
global channelthree
global text4
if {$c == $channelone || $c == $channeltwo || $c == $channelthree} {
puthelp "PRIVMSG $c :$text4"
}
return 0
}

proc text-5 {n u h c a}  {
global channelone
global channeltwo
global channelthree
global text5
if {$c == $channelone || $c == $channeltwo || $c == $channelthree} {
puthelp "PRIVMSG $c :$text5"
}
return 0
}

#putlog "* [file tail [info script]] by Dalanx loaded."
I want to do two things with this:
1) I'd like for the text response of the bot to be in seperate lines. Instead of a giant clump like a have. >.<
ex:
<user> !rules
<bot> These are the rules...
<bot> Rule #1:....
<bot> etc
and 2) I'd like for the messages from the bot (which are public now) to be sent in a private message without forcing a new window open ( notice?)

Since I'm just starting to figure this stuff out, I have no idea what I'm doing, :oops:

Thanks!!!
Muahaha! Ding I say, ding!
N
NTHosts
Op
Posts: 100
Joined: Mon Oct 10, 2005 9:57 pm
Location: UK
Contact:

:)

Post by NTHosts »

Hey shikashinigami,

1) I'd like for the text response of the bot to be in seperate lines. Instead of a giant clump like a have. >.<

Just type \n where ever you want the line to end and start fresh.

2) I'd like for the messages from the bot (which are public now) to be sent in a private message without forcing a new window open ( notice?)

Change where it says 'PRIVMSG' to notice.

Done :)
www.NT-Hosts.Net - More than just a host
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Re: :)

Post by DragnLord »

NTHosts wrote:2) I'd like for the messages from the bot (which are public now) to be sent in a private message without forcing a new window open ( notice?)
Change where it says 'PRIVMSG' to notice.

Done :)
The above will send the notice to the channel, not only to the individual.

change

Code: Select all

puthelp "PRIVMSG $c :$text5"
to

Code: Select all

puthelp "NOTICE $n :$text5"
to send to only the requester
N
NTHosts
Op
Posts: 100
Joined: Mon Oct 10, 2005 9:57 pm
Location: UK
Contact:

oops

Post by NTHosts »

Sorry i screwed up, the second bit wont work, im gonna make a few changes to the script and i'll post it back here for ya.. sowwie :P

EDIT: Ok seems i dont have to, thanks DragnLord :P
www.NT-Hosts.Net - More than just a host
User avatar
shikashinigami
Voice
Posts: 11
Joined: Fri May 26, 2006 2:15 pm
Location: bah

Post by shikashinigami »

ok, the NOTICE instead of channel notice works like a charm. But if I put \n between the lines only the first line comes up. I'm not sure why it isn't working. I have the text all on one line (line 1456)
ex:

Code: Select all

set text1 "These are the rules for channel shika, they are law... \nRule #1: Don't be a jerk. We're here to have fun, act like it \nRule #2: Don't ask to be an op. If you have to ask, chances are you don't deserve it \nule #3: Have fun \nRule #4: Don't bother the bot, he isn't merciful like the other ops."
thanks!!!
Muahaha! Ding I say, ding!
N
NTHosts
Op
Posts: 100
Joined: Mon Oct 10, 2005 9:57 pm
Location: UK
Contact:

erm

Post by NTHosts »

Can you post me the whole script to have a look at please :)

EDIT: Can i also request to a mod that this script is moved to the correct forum, thanks :P
www.NT-Hosts.Net - More than just a host
User avatar
shikashinigami
Voice
Posts: 11
Joined: Fri May 26, 2006 2:15 pm
Location: bah

Post by shikashinigami »

I'm sorry >.< I thought it would be okay in this forum cause it's technically a script request... eheh... anyway. Here's my whole eggdrop script additional components and all:

Code: Select all

#! /path/to/executable/eggdrop

set username "ph34rb0t_shika"
set admin "shika <email: aybara_cauthon@hotmail.com>"
set network "irc.rizon.net"
set timezone "EST"
set offset "5"
#set env(TZ) "$timezone $offset"
#set my-hostname ""
set my-ip "66.252.10.152"
#addlang "english"


##### LOG FILES #####

set max-logs 10
set max-logsize 550
set quick-logs 0
set raw-log 0
logfile mcoj * "logs/eggdrop.log"
logfile jpk #shika "logs/lamest.log"
set log-time 1
set keep-all-logs 1
set logfile-suffix ".%d%b%Y"
set switch-logfiles-at 300
set quiet-save 1


##### CONSOLE #####

set console "mkcobxs"


##### FILES AND DIRECTORIES #####
set userfile "ph34rb0t.user"
set pidfile "pid.ph34rb0t"
set sort-users 0
set help-path "help/"
set text-path "text/"
set temp-path "/tmp"
set motd "text/motd"
set telnet-banner "text/banner"
set userfile-perm 0400


##### BOTNET/DCC/TELNET #####

#set botnet-nick "LlamaBot"
listen 50931 all
set remote-boots 2
set share-unlinks 1
set protect-telnet 0
set dcc-sanitycheck 1
set ident-timeout 5
set require-p 0
set open-telnets 0
set stealth-telnets 1
set use-telnet-banner 0
set connect-timeout 15
set dcc-flood-thr 10
set telnet-flood 10:60
set paranoid-telnet-flood 1
set resolve-timeout 30


##### MORE ADVANCED SETTINGS #####

#set firewall "!sun-barr.ebay:3666"
#set nat-ip "127.0.0.1"
#set reserved-portrange 2010:2020
set ignore-time 15
set hourly-updates 27
set owner "shikashinigami"
set notify-newusers "$owner"
set default-flags "hpg"
set whois-fields "url birthday"
set die-on-sighup 0
set die-on-sigterm 1
#unbind dcc n tcl *dcc:tcl
#unbind dcc n set *dcc:set
set must-be-owner 1
#unbind dcc n simul *dcc:simul
set max-dcc 50
set allow-dk-cmds 1
set dupwait-timeout 5


##### MODULES #####

set mod-path "modules/"


#### DNS MODULE ####

loadmodule dns


#### CHANNELS MODULE ####

loadmodule channels
set chanfile "shika.chan"
set force-expire 0
set share-greet 0
set use-info 1

set global-flood-chan 10:60
set global-flood-deop 3:10
set global-flood-kick 3:10
set global-flood-join 5:60
set global-flood-ctcp 3:60
set global-flood-nick 5:60
set global-aop-delay 5:30
set global-idle-kick 0
set global-chanmode "mnpt"
set global-stopnethack-mode 0
set global-revenge-mode 0
set global-ban-time 120
set global-exempt-time 60
set global-invite-time 60

set global-chanset {
        -autoop         +autovoice
        -bitch          -cycle
        +dontkickops    -dynamicbans
        +dynamicexempts -dynamicinvites
        -enforcebans    -greet
        -inactive       -nodesynch
        -protectfriends +protectops
        -revenge        +revengebot
        -secret         -seen
        -shared         +statuslog
        +userbans       +userexempts
        +userinvites    +protecthalfops
        -autohalfop
}


    channel add #shika {
      chanmode "+mnpt"
      idle-kick 0
      stopnethack-mode 0
      revenge-mode 0
      ban-time 120
      exempt-time 60
      invite-time 60
      aop-delay 5:30
      need-op { putserv "PRIVMSG dear god, please op me!" }
      need-invite { putserv "PRIVMSG let me in!" }
      need-key { putserv "PRIVMSG let me in!" }
      need-unban { putserv "PRIVMSG let me in!" }
      need-limit { putserv "PRIVMSG let me in!" }
      flood-chan 10:60
      flood-deop 3:10
      flood-kick 3:10
      flood-join 5:60
      flood-ctcp 3:60
      flood-nick 5:60
    }

   channel set #shika +revengebot +dontkickops +autovoice -autoop -autohalfop



#### SERVER MODULE ####

loadmodule server
set net-type 1
set nick "ph34rb0t_shika"
set altnick "shikab0t"
set realname "/msg ph34rb0t_shika hello"
bind evnt - init-server evnt:init_server

proc evnt:init_server {type} {
  global botnick
  putquick "MODE $botnick +i-ws"
}
set default-port 6664
set servers {
  irc.rizon.net:6664
  irc.rizon.net:7000
}

set keep-nick 1
set strict-host 0
set quiet-reject 1
set lowercase-ctcp 1
set answer-ctcp 3
set flood-msg 5:60
set flood-ctcp 10:60
set never-give-up 1
set server-cycle-wait 60
set server-timeout 60
set servlimit 0
set check-stoned 1
set serverror-quit 1
set max-queue-msg 300
set trigger-on-ignore 0
set double-mode 1
set double-server 1
set double-help 1
set optimize-kicks 1
set stack-limit 4

### SERVER MODULE - OTHER NETWORKS (net-type 5) ###

set check-mode-r 0
set nick-len 20

#### CTCP MODULE ####

loadmodule ctcp
set ctcp-mode 0

#### IRC MODULE ####

loadmodule irc
set bounce-bans 1
set bounce-exempts 0
set bounce-invites 0
set bounce-modes 0
set max-bans 30
set max-exempts 20
set max-invites 20
set max-modes 30
#set use-exempts 0
#set use-invites 0
set kick-fun 0
set ban-fun 0
set learn-users 1
set wait-split 1500
set wait-info 180
set mode-buf-length 200
unbind msg - hello *msg:hello
bind msg - yo *msg:hello
#unbind msg - ident *msg:ident
#unbind msg - addhost *msg:addhost
set opchars "@"
set opchars "@&~"
set no-chanrec-info 0

### IRC MODULE - IRCnet SPECIFIC FEATURES (net-type 1) ###

# Attention: Use these settings *only* if you set 'net-type' to 1!

set prevent-mixing 1

### IRC MODULE - OTHER NETWORKS (net-type 5) ###

# Attention: Use these settings *only* if you set 'net-type' to 5!
#set kick-method 1
#set modes-per-line 3
#set include-lk 1
#set use-354 0
#set rfc-compliant 1


#### TRANSFER MODULE ####
#loadmodule transfer
set max-dloads 3
set dcc-block 0
set copy-to-tmp 1
set xfer-timeout 30


#### SHARE MODULE ####

#loadmodule share

# Settings in this section must be un-commented before setting.
#set allow-resync 0
#set resync-time 900
#set private-global 0
#set private-globals "mnot"
#set private-user 0
#set override-bots 0


#### COMPRESS MODULE ####

#loadmodule compress
set share-compressed 1
#set compress-level 9


#### FILESYSTEM MODULE ####

#loadmodule filesys
set files-path "/home/mydir/filesys"
set incoming-path "/home/mydir/filesys/incoming"
set upload-to-pwd 0
set filedb-path ""
set max-file-users 20
set max-filesize 1024


#### NOTES MODULE ####

loadmodule notes
set notefile "shika.notes"
set max-notes 50
set note-life 60
set allow-fwd 0
set notify-users 1
set notify-onjoin 1

#### CONSOLE MODULE ####

loadmodule console
set console-autosave 1
set force-channel 0
set info-party 0


#### WOOBIE MODULE ####

#loadmodule woobie


#### SEEN MODULE ####

#loadmodule seen


#### BLOWFISH MODULE ####

loadmodule blowfish


#### ASSOC MODULE ####

#loadmodule assoc


#### WIRE MODULE ####

#loadmodule wire

#### UPTIME MODULE ####

loadmodule uptime

##### SCRIPTS #####

#source scripts/script.tcl

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

source scripts/compat.tcl

source scripts/userinfo.tcl
loadhelp userinfo.help

###EasySpeak####

#Edit this to who you want to activate the triggers (The default is set to 
#public, which means everyone can activate them)

set trigbind -|- 

#Set the channels to where you want the triggers available
#I've set it up to allow you up to 3 channels, if you want more please
#e-mail me and let me know. :)

set channelone    "#shika"
set channeltwo    ""
set channelthree  ""

#Edit these to what ever you want the trigger names to be (IE !rules or ^Help)

set trigger1 "!rules"
set trigger2 ""
set trigger3 ""
set trigger4 ""
set trigger5 ""

#Edit these to what ever you want to be displayed in the channel after the trigger the
#has been used, (IE if trigger1 was set to !rules then change text1 to...
#These are the rules ect ect).

set text1 "These are the rules for channel shika, they are law... | Rule #1: Don't be a jerk. We're here to have fun, act like it | Rule #2: Don't ask to be an op. If you have to ask, chances are you don't deserve it | Rule #3: Have fun | Rule #4: Don't bother the bot, he isn't merciful like the other ops."
set text2 ""
set text3 ""
set text4 ""
set text5 ""

#Just comment out the "die" line with a #
#I put it here as a small reminder to edit this script.
#die "* [file tail [info script]]: Forgot to edit this script didn't you?"


bind pub $trigbind $trigger1 text-1
bind pub $trigbind $trigger2 text-2
bind pub $trigbind $trigger3 text-3
bind pub $trigbind $trigger4 text-4
bind pub $trigbind $trigger5 text-5

proc text-1 {n u h c a }  {
global channelone
global channeltwo
global channelthree
global text1
if {$c == $channelone || $c == $channeltwo || $c == $channelthree} {
puthelp "NOTICE $n :$text1"
}
return 0
}

proc text-2 {n u h c a}  {
global channelone
global channeltwo
global channelthree
global text2
if {$c == $channelone || $c == $channeltwo || $c == $channelthree} {
puthelp "PRIVMSG $c :$text2"
}
return 0
}

proc text-3 {n u h c a}  {
global channelone
global channeltwo
global channelthree
global text3
if {$c == $channelone || $c == $channeltwo || $c == $channelthree} {
puthelp "PRIVMSG $c :$text3"
}
return 0
}

proc text-4 {n u h c a}  {
global channelone
global channeltwo
global channelthree
global text4
if {$c == $channelone || $c == $channeltwo || $c == $channelthree} {
puthelp "PRIVMSG $c :$text4"
}
return 0
}

proc text-5 {n u h c a}  {
global channelone
global channeltwo
global channelthree
global text5
if {$c == $channelone || $c == $channeltwo || $c == $channelthree} {
puthelp "PRIVMSG $c :$text5"
}
return 0
}

#putlog "* [file tail [info script]] by Dalanx loaded."

####Autovoice script######
###################################################
bind join - "#shika *" av:join 
bind part - "#shika *" av:part 

proc av:join {nick host hand chan} { 
   global dontvoice 
   if ![info exists dontvoice($chan)] { set dontvoice($chan) [list] } 
   if {[botisop $chan]&&[lsearch -exact $dontvoice($chan) $host]=="-1"} { 
      utimer 2 [list pushmode $chan +v $nick] 
   } 
} 

proc av:part {nick host hand chan {msg ""}} { 
   global dontvoice 
   if ![info exists dontvoice($chan)] { set dontvoice($chan) [list] } 
   if {![isbotnick $nick]&&![isvoice $nick $chan]&&![isop $nick $chan]&&[lsearch -exact $dontvoice($chan) $host]=="-1"} { 
      lappend dontvoice($chan) $host 
      timer 5 [list set dontvoice($chan) [lreplace $dontvoice($chan) [set foo [lsearch -exact $dontvoice($chan) $host]] $foo]] 
   } 
} 

bind mode - "#shika +v" av:mode 

proc av:mode {nick host hand chan mode {target ""}} { 
   global dontvoice 
   if ![info exists dontvoice($chan)] return 
   if {[set foo [lsearch -exact $dontvoice($chan) [getchanhost $target $chan]]]!="-1"} { 
      set dontvoice($chan) [lreplace $dontvoice($chan) $foo $foo] 
   } 
}

#########Rehash Code################
##############################################
bind pub n|- .rehash pub:rehash 

proc pub:rehash {nick host hand chan text} { 
  rehash 
  putserv "PRIVMSG $chan :Bot has been rehashed." 
}
Muahaha! Ding I say, ding!
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

You can't use \n with puthelp/putserv/putquick or anything else.
So don't bother and just use seperate lines. (i think demond already told you that in a different topic)
User avatar
shikashinigami
Voice
Posts: 11
Joined: Fri May 26, 2006 2:15 pm
Location: bah

Post by shikashinigami »

nope no one told me that before. And being a new used of tcl, I had no idea. Thanks!
Muahaha! Ding I say, ding!
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

This is nothing about TCL, but about IRC. IRC uses \n as command seperator. So meaning something like:
"PRIVMSG $chan :hello my new\nworld out there"
would be interpreted as channel message to $chan "hello my new" and an error saying "world: no such command". You could probably use
"PRIVMSG $chan :hellow my new\nPRIVMSG $chan :world out there"
but I dont know how the bot will thread such a line, if it splits it automatically into 2 or if it would try to send them at once. First one you could make 2 lines anyway, later one of course would negate the use of the server queue ^-^.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Post Reply