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.

Me, again. I need again a little script

Old posts that have not been replied to for several years.
User avatar
duofruo
Halfop
Posts: 94
Joined: Thu Oct 23, 2003 3:17 pm
Location: Ploiesti@.ro
Contact:

Me, again. I need again a little script

Post by duofruo »

I need a script, that will have a public command like this :
!greet ( Here the text )

When i use this command the bot will make a greet text, that will greet al people who join the chan in notice.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

bind pub m|m !greet greet:msg
bind join - * greet:user

proc greet:msg {nick uhost hand chan arg} {
global greetmsg
set greetmsg "[split $arg]"
}

proc greet:user {nick uhost hand chan} {
global greetmsg
puthelp "NOTICE $nick :$greetmsg"
}
this will let you be able to set the greet message using !greet <greetmsg> which will be sent to every user who joins.
User avatar
duofruo
Halfop
Posts: 94
Joined: Thu Oct 23, 2003 3:17 pm
Location: Ploiesti@.ro
Contact:

Post by duofruo »

Thx a lot, but can u say me from where did u learn so much? And if exist a manuals in other languages ?
User avatar
duofruo
Halfop
Posts: 94
Joined: Thu Oct 23, 2003 3:17 pm
Location: Ploiesti@.ro
Contact:

Post by duofruo »

It seems to be a problem, when i user !greet <greet msg> the script put a greet on all channels, i wana be set on the specific channel where i use the public command.


THX again ...
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

you mean like show on only one channel or that it is only executable on one channel i mean so you can use the trigger on one chan ?
XplaiN but think of me as stupid
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

if you want it to be displayed on only 1 channel, then add

Code: Select all

foreach channel [channels] { 
 if {[string match -nocase "#yourchannel" $channel]} {
  puthelp "NOTICE.....
 }
}
into the greet:user proc

if you want to be able to set a different greet message for each channel and make it greet each message for each channel, then it would need more work.. try to find out yourself.
duofruo wrote:Thx a lot, but can u say me from where did u learn so much? And if exist a manuals in other languages ?
I mostly learn from this forum.. and by looking at other scripts, and sometimes manuals.
User avatar
duofruo
Halfop
Posts: 94
Joined: Thu Oct 23, 2003 3:17 pm
Location: Ploiesti@.ro
Contact:

Post by duofruo »

No, i mean that i would like to set greets in diferent channel. I want to set in diferent channels, diferent script :).

ie : #chan1 : !greet bla
#chan2 : !greet bla bla
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Then either use arrays or save to a file.
Once the game is over, the king and the pawn go back in the same box.
User avatar
duofruo
Halfop
Posts: 94
Joined: Thu Oct 23, 2003 3:17 pm
Location: Ploiesti@.ro
Contact:

Post by duofruo »

As i said i am new in tcl world, i only know bind , putserv if . bla bla.
I don`t know what that is :( .
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Consult the manual then.
Once the game is over, the king and the pawn go back in the same box.
User avatar
duofruo
Halfop
Posts: 94
Joined: Thu Oct 23, 2003 3:17 pm
Location: Ploiesti@.ro
Contact:

Post by duofruo »

Caesar thanx. I get the ideea :) . Of course it take more then 2 hours but i
succesfully made the script...
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Oh realy, proove it! :D
Once the game is over, the king and the pawn go back in the same box.
User avatar
GodOfSuicide
Master
Posts: 463
Joined: Mon Jun 17, 2002 8:00 pm
Location: Austria

Post by GodOfSuicide »

duofruo wrote:Caesar thanx. I get the ideea :) . Of course it take more then 2 hours but i
succesfully made the script...
are you sure you didnt just wait 2h for user to show up ?
User avatar
duofruo
Halfop
Posts: 94
Joined: Thu Oct 23, 2003 3:17 pm
Location: Ploiesti@.ro
Contact:

Post by duofruo »

Nope, i am sure just ask him :P

I am noy kidding. It was me. But still has some bugs
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

A simple and efficient greet thing based on arrays:

Code: Select all

bind pub m|m !greet greet:msg 
bind pub m|m !ungreet ungreet:msg
bind join - * greet:user 

proc greet:msg {nick uhost hand chan text} { 
  global greet
  set greet([strlwr $chan]) [split $text]
  putserv "NOTICE $nick :Seted greet for $chan to \"[split $text]\""
}

proc ungreet:msg {nick uhost hand chan text} { 
  global greet
  foreach arr_greet [array names greet] {
    if {[string match [strlwr $chan] $arr_greet]} {
      array unset greet [strlwr $chan]
      putserv "NOTICE $nick :Removed greet from $chan channel."
    }
  }
}

proc greet:user {nick uhost hand chan} { 
  global greet
  if {![info exists greet([strlwr $chan])]} {
    return
  }
  puthelp "NOTICE $nick :$greet([strlwr $chan])" 
}
Note that upon restarting or killing the eggdrop he will forget all arrays. So, if you want it to store them then read/write them in a file. :P
Once the game is over, the king and the pawn go back in the same box.
Locked