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.

slap nick

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
User avatar
Arnold_X-P
Master
Posts: 257
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

slap nick

Post by Arnold_X-P »

I put together this TCL and it works fine, the issue is that the !slap nick (default) gets mixed up with the !slap nick phrase.

Code: Select all

set xphrases {
"\001ACTION full of slaps to <nicks> :-)"
"\001ACTION slaping :< and spitting in the face of <nicks> slapppppppppppp\001"
}

bind pub - !slap slapsnick
bind pub - ¡slap slapsnick
bind pub - .slap slapsnick

proc slapsnick {nick uhost hand chan arg} {
 global xphrases
 set target "[lindex [split $arg] 0]" ; set reason "[join [lrange [split $arg] 1 end]]"
 if {$arg == ""} { putserv "PRIVMSG $chan :\002The right thing\002 is \002!slap nick\002 example \002!slap sedition\002" ; return 0 }
 if {![onchan $target $chan]} { putserv "PRIVMSG $chan :$arg is not in $chan" -next ; return }
set slapsxp [lindex $xphrases [rand [llength $xphrases]]]
 regsub -all -- {<nicks>} $slapsxp $nick slapsxp
putserv "PRIVMSG $chan :$slapsxp $target $reason" -next
 } 
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
networks: DALnet #tcls ChatZona #tcl Libera.Chat #tcls
User avatar
CrazyCat
Revered One
Posts: 1374
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: slap nick

Post by CrazyCat »

Not sure to understand what you mean.
Can you give an example of the result of !slap nick and what you expected to have ?
User avatar
Arnold_X-P
Master
Posts: 257
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Re: slap nick

Post by Arnold_X-P »

that the first command works well :

Code: Select all

[11:31] <nicolassss> !slap sedition
[11:31] * @Kantuta full of slaps to nicolassss :-) sedition 
It's in the second option slap, for example, !slap nickname phrase.
the right thing would be:

Code: Select all

[11:31] * @Kantuta full of slaps to sedition  :-) 
That's the detail; it blends in with the first slap.
[11:31] <nicolassss> !slap sedition wake up

Code: Select all

[11:31] * @Kantuta  slaping :< and spitting in the face of nicolassss slapppppppppppp sedition wake up
the right thing would be:

Code: Select all

[11:31] * @Kantuta  sedition wake up
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
networks: DALnet #tcls ChatZona #tcl Libera.Chat #tcls
User avatar
Arnold_X-P
Master
Posts: 257
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Re: slap nick

Post by Arnold_X-P »

.slap nickname (works fine -- launches default phrases in set xphrases)
.slap nickname phrases ( bad --- It works, but it throws predefined phrases from xphrases and also throws custom phrases.)
In this last option, it should only launch the custom phrase
example :

Code: Select all

[11:31] <nicolassss> !slap sedition You're distracted
[11:31] * @Kantuta  sedition You're distracted
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
networks: DALnet #tcls ChatZona #tcl Libera.Chat #tcls
User avatar
CrazyCat
Revered One
Posts: 1374
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: slap nick

Post by CrazyCat »

Ok, so the trouble is that you don't check if $reason is set or not.
Here is a modified version of your script:
set xphrases {
   "\001ACTION full of slaps to <nicks> :-)"
   "\001ACTION slaping :< and spitting in the face of <nicks> slapppppppppppp\001"
}

bind pub - !slap slapsnick
bind pub - ¡slap slapsnick
bind pub - .slap slapsnick

proc slapsnick {nick uhost hand chan args} {
   global xphrases
   if {[llength $args] == 0} {
      putserv "PRIVMSG $chan :\002The right thing\002 is \002!slap nick\002 example \002!slap sedition\002"
      return
   }
   set target [join [lindex $args 0]]
   if {![onchan $target $chan]} {
      putserv "PRIVMSG $chan :$target is not in $chan"
      return
   }
   if {[llength $args] > 1} {
      set reason [join [lrange [split $args] 1 end]]
      putserv "PRIVMSG $chan :$target $reason"
   } else {
      set slapsxp [lindex $xphrases [rand [llength $xphrases]]]
      regsub -all -- {<nicks>} $slapsxp $nick slapsxp
      putserv "PRIVMSG $chan :$slapsxp"
   }
}
It also contains some little optimisations / arrangements to avoid warnings and errors
User avatar
Arnold_X-P
Master
Posts: 257
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Re: slap nick

Post by Arnold_X-P »

I checked the code and it's fine, just as I requested.
But it's not working properly.

Code: Select all

<nicolassss> .slap
<@Kantuta >  is not in #curmmer
That's where I should launch this

Code: Select all

<nicolassss> .slap
@Kantuta The right thing is !slap nick example !slap sedition
and in this part of .slap nickname

Code: Select all

<nicolassss> .slap sedinne
* @Kantuta  slaping :< and spitting in the face of sedinne slapppppppppppp sedinne
It should only launch like this (default phrase from set xphrases)
it would be like this:

Code: Select all

* @Kantuta  slaping :< and spitting in the face of sedinne slapppppppppppp 
With the .slap nickname phrase option, this detail was observed: it indicates that the nickname is not in the channel.

Code: Select all

<nicolassss> .slap nicolassss don't sleep
<@Kantuta> nicolassss don't sleep is not in #curmmer
I don't know why the code is failing; it looks better organized and should work fine.
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
networks: DALnet #tcls ChatZona #tcl Libera.Chat #tcls
User avatar
CrazyCat
Revered One
Posts: 1374
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: slap nick

Post by CrazyCat »

I've corrected the last putserv (based on yours, so I didn't removed a $target which wasn't needed).
For others troubles... did you restart your eggdrop ?

And please, if you have errors, just write:
real wrote:

Code: Select all

<nicolassss> .slap
<@Kantuta >  is not in #curmmer
expected wrote:

Code: Select all

<nicolassss> .slap
<@Kantuta > The right thing is !slap nick example !slap sedition
User avatar
CrazyCat
Revered One
Posts: 1374
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: slap nick

Post by CrazyCat »

Ok, the trouble is that $args has a count of 1 event if there is no arg (contains {})

So the first check must be:
   if {[string trim [join $args]] eq ""} {
      putserv "PRIVMSG $chan :\002The right thing\002 is \002!slap nick\002 example \002!slap sedition\002"
      return
   }
When the argument is just a nick, I understand what you want and it works.

But explain me what you expect to have when there is a reason.
Post Reply