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.

Welcome TCL for users

Help for those learning Tcl or writing their own scripts.
Post Reply
a
alphax
Voice
Posts: 4
Joined: Sat May 27, 2017 4:19 pm

Welcome TCL for users

Post by alphax »

Hey there,

i have trouble with that code. That code notification for all. But i want to notification for just users not ops.

So when op joins help channel no notification. i want to notification for just users. and dont notification for oper and admins.

i need a little help. Ty.

Code: Select all

bind join - * channel:welcome
proc kanal:welcome {nick uhost handle chan} {
global botnick
if {$nick == $botnick} { return 0 }
if {[string match -nocase "#helpchannel" $chan]} {
putquick "PRIVMSG #opchannel :# $nick wait in#helpchannel"
putquick "PRIVMSG $nick :Please wait you will be get help soon."

}
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Re: Welcome TCL for users

Post by willyw »

First :

Code: Select all

bind join - * channel:welcome
proc kanal:welcome {nick uhost handle chan} { 
...
The proc called by the bind join is not the proc shown here.
Perhaps it is just some sort of typo... ?

Next:
I'm thinking that you might want to cut this line:

Code: Select all

putquick "PRIVMSG $nick :Please wait you will be get help soon." 
and put it in a separate proc.

Then, you can call that proc, after a delay - using utimer .
This idea is to give time for Chanserv to op.

Then, in this proc, check to see if the user is op'd.
If op'd, just quit. If not, then do the announcement.

Go here:
http://docs.eggheads.org/mainDocs/tcl-commands.html
and text search for
utimer
and
isop
and read about them, and how to use them.

I hope this helps.

Perhaps someone else will be along with a different idea, too.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
a
alphax
Voice
Posts: 4
Joined: Sat May 27, 2017 4:19 pm

Post by alphax »

Hey there,

First of all thank you for your answer. Everything is okay now. But there is a one little problem. it see other channel to i want it just for help channel. Can you help me to solve that? By the way i tried .chanset command but there is no solution. Thank you.

Code: Select all

bind join -|- * new_join 
setudef flag join 

set receiver "#Op" 
set exemptchan "#Help" 

proc new_join {nick uhost handle chan} { 
 global receiver exemptchan 
if {![channel get $chan join] && ![botisop $chan]} {return 0}
 utimer 1 [list check:after $nick $chan ] 
} 

proc check:after {nick chan} { 
 global receiver exemptchan 
 if {![isop $nick $chan] && ![string equal -nocase $exemptchan $chan]} { 
   putserv "PRIVMSG @$receiver :WARNING: $nick waits for help." 
  } 
 } 
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

See that
setudef
command and then in the proc, see the
channel get
command? It is looking at the value of that User defined channel flag created by the setudef command.

In partyline, do:
.chaninfo #channelname
and see the section: User defined channel flags:
You should see one named: join
If it is -join , then this line in the script:

Code: Select all

if {![channel get $chan join] && ![botisop $chan]} {return 0}
will cause it to quit right there.

If you want it to be "on" in some channel, then you do:
.chanset #channelname +join
to change its value.
Simply check it again, with another .chaninfo #channelname to be sure.

Then test your script again.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
a
alphax
Voice
Posts: 4
Joined: Sat May 27, 2017 4:19 pm

Post by alphax »

Thank you for your reply. I tried what you said to me. But it does not work.

I look with .chaninfo command it is -join but it still give notification. i changed several times for be sure. it is the same

.chanset #channel -join does not work.

<X-Bot> -noidle -antividle -antididle -join

I ask your help one more time :)
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

alphax wrote:
...
I look with .chaninfo command it is -join but it still give notification.

...
See this line:

Code: Select all

if {![channel get $chan join] && ![botisop $chan]} {return 0} 
and experiment with and without the ! for botisop command.
I don't know which way you really want it.

I tested it, and it works for me.
I hope this helps.


Edit:
This line:

Code: Select all

 putserv "PRIVMSG @$receiver :WARNING: $nick waits for help." 
has an @ in it. I did remove that when I tested.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
a
alphax
Voice
Posts: 4
Joined: Sat May 27, 2017 4:19 pm

Post by alphax »

yes sir you are right it works but it notification other channels too. i want notification just for help channel. Bot is in another channels and i do not want to notification from another channels. and when i tried for other channels .chanset #channel -join it keep notification to op channel too
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

alphax wrote:yes sir you are right it works but it notification other channels too. i want notification just for help channel. Bot is in another channels and i do not want to notification from another channels. and when i tried for other channels .chanset #channel -join it keep notification to op channel too

See this line:

Code: Select all

bind join -|- * new_join 
Then see this for reference:
http://www.eggheads.org/support/egghtml ... mands.html
and text search it to find : bind join

Part of what can be learned there is:
The mask in the bind is matched against "#channel nick!user@host" and can contain wildcards.
So if you want to limit this to just one channel, you could edit that bind line so that it only triggers on one channel. However, using .chanset with the User defined channel flag should do it too.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

namespace eval welcome {

	set setup(help) "#helpchannel"
	set setup(op) "#opchannel"

	bind join - * [namespace current]::joined
	
	proc joined {nick uhost handle chan} {
		global setup
		if {[isbotnick $nick]} return
		if {![string equal -nocase $chan $setup(help)]} return
		utimer 3 [list [namespace current]::welcome $chan $nick]
	}
	
	proc welcome {chan nick} {
		global setup
		if {[isop $nick $chan]} return
		puthelp "PRIVMSG $setup(op) :$nick wait in $setup(help)"
		puthelp "PRIVMSG $nick :Please wait you will be get help soon."		
	}
}
Haven't tested.

Edit: Corrected lil typo.
Last edited by caesar on Mon May 29, 2017 11:46 am, edited 1 time in total.
Once the game is over, the king and the pawn go back in the same box.
s
simo
Revered One
Posts: 1078
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

the : namepsace eval welcome {


should probably be :

namespace eval welcome {
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Heh. Lil typo. Thanks simo. :P
Once the game is over, the king and the pawn go back in the same box.
Post Reply