More trigger in Script

Paste Your code(s) here, and state your problem.

More trigger in Script

Postby jonlar » Mon Dec 15, 2008 8:44 pm

Hello. I have a script here and would like to add one more trigger
After variable trigger "?rules"
smothing like
variable trigger "?help"
also with a path to a file like here variable filename "scripts/path/to/file" but for the trigger ?help
also a second variable if notice or privmsg
Hope u can help me. Thanks in advance

Code: Select all
namespace eval rules {
   namespace eval variable {

      variable trigger "?rules"
      variable channel "#chan"
      variable filename "scripts/path/to/file"
      variable method "notice"

      variable use "0"

      if {![info exists timer]} {
          variable timer ""
      } elseif {$timer != ""} {
          catch {killutimer $timer}
         variable timer ""
      }

      variable timeout "5"; # in seconds

   }

   bind PUBM - "$::rules::variable::channel $::rules::variable::trigger*" [namespace current]::public

   proc public {nickname hostname handle channel arg} {
      if {$rules::variable::use} {
        # putserv "$rules::variable::method $nickname :Spamschutz. 20 Sekunden aktiv."
      } else {
         set rules::variable::use "1"
         set rules::variable::timer [utimer $rules::variable::timeout [list set rules::variable::use "0"]]
         set file [open $rules::variable::filename r]
         set data [read -nonewline $file]
         close $file
         if {[llength $data] < 1} {
            putserv "$rules::variable::method $nickname :Keine Regeln verfügbar."
         } else {
            foreach line [split $data \n] {
               if {$line == ""} { continue }
               putserv "$rules::variable::method $nickname :$line"
            }
         }
      }
   }
}
jonlar
 

Re: More trigger in Script

Postby Cristian » Tue Dec 16, 2008 5:10 am

wouldn't it be easier to make another namespace, to separate the two scripts.

Then you just have to copy/paste the script, and change rules to help.
Cristian
proof of advance
proof of advance
 
Posts: 282
Joined: Sun Nov 04, 2007 3:02 pm
Location: Denmark
Authnick: Sumsar

Re: More trigger in Script

Postby jonlar » Tue Dec 16, 2008 12:02 pm

Ya easier and tons of scripts in eggdrop
jonlar
 

Re: More trigger in Script

Postby Lukemob » Wed Dec 31, 2008 3:42 pm

jonlar wrote:Hello. I have a script here and would like to add one more trigger
After variable trigger "?rules"
smothing like
variable trigger "?help"
also with a path to a file like here variable filename "scripts/path/to/file" but for the trigger ?help
also a second variable if notice or privmsg
Hope u can help me. Thanks in advance

Code: Select all
namespace eval rules {
   namespace eval variable {

      variable trigger "?rules"
      variable channel "#chan"
      variable filename "scripts/path/to/file"
      variable method "notice"

      variable use "0"

      if {![info exists timer]} {
          variable timer ""
      } elseif {$timer != ""} {
          catch {killutimer $timer}
         variable timer ""
      }

      variable timeout "5"; # in seconds

   }

   bind PUBM - "$::rules::variable::channel $::rules::variable::trigger*" [namespace current]::public

   proc public {nickname hostname handle channel arg} {
      if {$rules::variable::use} {
        # putserv "$rules::variable::method $nickname :Spamschutz. 20 Sekunden aktiv."
      } else {
         set rules::variable::use "1"
         set rules::variable::timer [utimer $rules::variable::timeout [list set rules::variable::use "0"]]
         set file [open $rules::variable::filename r]
         set data [read -nonewline $file]
         close $file
         if {[llength $data] < 1} {
            putserv "$rules::variable::method $nickname :Keine Regeln verfügbar."
         } else {
            foreach line [split $data \n] {
               if {$line == ""} { continue }
               putserv "$rules::variable::method $nickname :$line"
            }
         }
      }
   }
}


So, what is located in that file? And, making a more triggers, even if it's for notice/privmsg is easy. The thing is, I didn't get your request as I'd need to help you. Could you describe it more detailed?
Lukemob
 

Re: More trigger in Script

Postby jonlar » Tue Jan 06, 2009 12:46 pm

Hi Lukemob. I need a script that includes !trigger1 !trigger2 maybe !trigger3. These triggers are for giving a notice (some Text) to the one who used the trigger. The Text will be located in different txt Datafiles.
Also i need triggers for some Output for a user. For example. Someone joins a chan and ask for free Webspace. then i have the option for !no $nick (doesent meet requirements) !help $nick (Outputs a Text-file or URL - also located in a txt File) and mybe some more.Thx
jonlar
 


Return to TCL Scripting Help

Who is online

Users browsing this forum: No registered users and 0 guests

cron