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.

My First Script

Old posts that have not been replied to for several years.
User avatar
NoFear
Halfop
Posts: 46
Joined: Wed Sep 10, 2003 8:36 am
Location: cW

My First Script

Post by NoFear »

Hi!
This is my first script, but it doesn't work.. i youst don't know what the problem is.

Code: Select all

###############################
#      .:[H-Town Team]:.      #
#   .:[JoinGreet Script]:.    #
#                             #
###############################
#
# Vpiši pozdravni text.
set text "Text"
set text2 "Text2"
# Nastavi kanale na katerih bo deloval greet. ( "" Za vse kanale ali #Kanal1, #kanal2)
set chans "#Kanal1 #Kanal2"
# Od tu naprej ne spreminjaj nic!

bind join - pozdrav

proc pozdrav {nick args chan} {
    global chans botnick
    if {![validchan $chans] && ![botonchan $chans]} {
        putserv "NOTICE $nick : $Text"
        putserv "NOTICE $nick : $Text2"
    }
  return 0
}
 
putlog "H-Town Team JoinGreet Script Loaded"
Please help me ;) thanks
Way Away From Here..
User avatar
Dedan
Master
Posts: 260
Joined: Wed Jul 09, 2003 10:50 pm
Location: Memphis

Post by Dedan »

maybe this will work

Code: Select all

set text1 "Text" 
set text2 "Text2"

set poz_chans "#Kanal1 #Kanal2" 


bind join -|- * pozdrav

proc pozdrav {nick uhost handle channel} { 
  global botnick poz text1 text2
  set chan [string tolower $channel]
  if {![info exists poz($chan)]} {return 0}
  if {![botisop $chan]} {return 0}
  putserv "NOTICE $nick : $text1 " 
  putserv "NOTICE $nick : $text2 "
  return 0 
} 
if {$poz_chans != ""} {
  foreach chan [string tolower $poz_chans] {
    set poz([string tolower $chan]) 1
  }
}

I once was an intelligent young man, now i am old and i can not remember who i was.
User avatar
Dedan
Master
Posts: 260
Joined: Wed Jul 09, 2003 10:50 pm
Location: Memphis

Post by Dedan »

i just edited
"putserv "NOTICE $nick : $Text1 "
to "putserv "NOTICE $nick : $text1 "

btw, I would be nice if you changed your avatar.
I once was an intelligent young man, now i am old and i can not remember who i was.
User avatar
NoFear
Halfop
Posts: 46
Joined: Wed Sep 10, 2003 8:36 am
Location: cW

Post by NoFear »

Ok i changed my avatar to nothing ;) hm.. nope doesn't works :/
Way Away From Here..
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

or simpler would be:

Code: Select all

set text1 "Text" 
set text2 "Text2" 

set poz_chans "#Kanal1 #Kanal2" 

bind join - * pozdrav 

proc pozdrav {nick uhost hand chan} { 
global poz_chans text text2
 if {[lsearch -exact $poz_chans $chan] == -1} {return 0}
   putserv "NOTICE $nick :$Text1" 
   putserv "NOTICE $nick :$Text2" 
}
if you want the bot to greet only if its oped then add || ![botisop $chan] in the if statement.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

the:

Code: Select all

if {[lsearch -exact $poz_chans $chan] == -1} {return 0} 
should be:

Code: Select all

if {[lsearch -exact [strlwr $poz_chans] [strlwr $chan]] == -1} {return 0} 
just due the lower and upper names of the channels. Observere:
(caesar) .tcl set text "moo bla oink" ; lsearch -exact $text "BLA"
(moo) Tcl: -1
(caesar) .tcl set text "moo bla oink" ; lsearch -exact $text "bla"
(moo) Tcl: 1
Once the game is over, the king and the pawn go back in the same box.
User avatar
Dedan
Master
Posts: 260
Joined: Wed Jul 09, 2003 10:50 pm
Location: Memphis

Post by Dedan »

CaSe SeNsTiVe?
I once was an intelligent young man, now i am old and i can not remember who i was.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

ExAcTlY! :)
Once the game is over, the king and the pawn go back in the same box.
User avatar
Dedan
Master
Posts: 260
Joined: Wed Jul 09, 2003 10:50 pm
Location: Memphis

Post by Dedan »

NoFear, was your bot an OP when you tried my code?
I once was an intelligent young man, now i am old and i can not remember who i was.
User avatar
NoFear
Halfop
Posts: 46
Joined: Wed Sep 10, 2003 8:36 am
Location: cW

Post by NoFear »

yes he had op. no this don't work.. :/
Way Away From Here..
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

they should work. do you .rehash or .restart when you load the script ?
User avatar
NoFear
Halfop
Posts: 46
Joined: Wed Sep 10, 2003 8:36 am
Location: cW

Post by NoFear »

yes i do but there is some error "there is no such variable text1" something like that. :roll:
Way Away From Here..
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Umm.. yes.. the:

Code: Select all

   putserv "NOTICE $nick :$Text1"
   putserv "NOTICE $nick :$Text2" 
lines.. change them to something that suits your needs.
Once the game is over, the king and the pawn go back in the same box.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Re: My First Script

Post by Sir_Fz »

NoFear wrote:Hi!
This is my first script, but it doesn't work.. i youst don't know what the problem is.

Code: Select all

###############################
#      .:[H-Town Team]:.      #
#   .:[JoinGreet Script]:.    #
#                             #
###############################
#
# Vpiši pozdravni text.
set text "Text"
set text2 "Text2"
[snip]
[snip]
you forgot to change text to text1 as we did in our codes.
User avatar
NoFear
Halfop
Posts: 46
Joined: Wed Sep 10, 2003 8:36 am
Location: cW

Post by NoFear »

no i have changed it :)
Way Away From Here..
Locked