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.

text to specific names

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
Fire-Fox
Master
Posts: 299
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

text to specific names

Post by Fire-Fox »

hey

how can i rewrite this so ONLY some ppl on that liste can access the giving command

lets say fiddo is one on the list..
then i need to type name in a string.

hope all understand....

Code: Select all

########################
###     only for some ppl     ###
######################
set chans "#chan"
set nynewtext2 "some text"
proc pub_staff {nick uhost hand chan text} {
global mynewtext2
	if {[isop $nick $chan]} {
	 	putserv "PRIVMSG $chan : $nick $mynewtext2"
	} else { putnoobuser  $chan $nick }
}
########################
###       End       ###
######################
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Create a list. ;)

See this post for inspiration: http://forum.egghelp.org/viewtopic.php? ... ight=lists
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
Fire-Fox
Master
Posts: 299
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Post by Fire-Fox »

Alchera wrote:Create a list. ;)

See this post for inspiration: http://forum.egghelp.org/viewtopic.php? ... ight=lists
Thanks for the help. But now im noob to tcl how whot i implement it :)
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Re: text to specific names

Post by Sir_Fz »

Fire-Fox wrote:hey

how can i rewrite this so ONLY some ppl on that liste can access the giving command

lets say fiddo is one on the list..
then i need to type name in a string.

hope all understand....

Code: Select all

########################
###     only for some ppl     ###
######################
set chans "#chan"
set nynewtext2 "some text"
proc pub_staff {nick uhost hand chan text} {
global mynewtext2
	if {[isop $nick $chan]} {
	 	putserv "PRIVMSG $chan : $nick $mynewtext2"
	} else { putnoobuser  $chan $nick }
}
########################
###       End       ###
######################
You have to be more clear about your request.
Online
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: text to specific names

Post by CrazyCat »

I guess you want to have a fixed list of allowed pple and match independantly of their status on the chan:

Code: Select all

set chans "#chan"
set authppl {"fido" "noob"}
set nynewtext2 "some text"
proc pub_staff {nick uhost hand chan text} {
global mynewtext2
	if {[lsearch $::authppl [string tolower $nick]]} {
	 	putserv "PRIVMSG $chan :$nick $mynewtext2"
	} else { putserv "PRIVMSG  $chan :$nick is not authorized to use this" }
}
User avatar
Fire-Fox
Master
Posts: 299
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Re: text to specific names

Post by Fire-Fox »

CrazyCat wrote:I guess you want to have a fixed list of allowed pple and match independantly of their status on the chan:

Code: Select all

set chans "#chan"
set authppl {"fido" "noob"}
set nynewtext2 "some text"
proc pub_staff {nick uhost hand chan text} {
global mynewtext2
	if {[lsearch $::authppl [string tolower $nick]]} {
	 	putserv "PRIVMSG $chan :$nick $mynewtext2"
	} else { putserv "PRIVMSG  $chan :$nick is not authorized to use this" }
}
Thanks i'll try it :)
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
User avatar
Fire-Fox
Master
Posts: 299
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Re: text to specific names

Post by Fire-Fox »

Fire-Fox wrote:
CrazyCat wrote:I guess you want to have a fixed list of allowed pple and match independantly of their status on the chan:

Code: Select all

set chans "#chan"
set authppl {"fido" "noob"}
set nynewtext2 "some text"
proc pub_staff {nick uhost hand chan text} {
global mynewtext2
	if {[lsearch $::authppl [string tolower $nick]]} {
	 	putserv "PRIVMSG $chan :$nick $mynewtext2"
	} else { putserv "PRIVMSG  $chan :$nick is not authorized to use this" }
}
Thanks i'll try it :)
set authppl {"name"}
set mynewtext6 "access"

proc pub_admin {nick uhost and chan text} {
global mynewtext6
if {[lsearch [string tolower $::authppl] [string tolower $nick]]} {
putserv "PRIVMSG $chan :$nick $mynewtext6"
} else {
putserv "PRIVMSG $chan :$nick is not authorized to use this"
}
}
This does not work all can access the command... even with the set authppl is filled
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

if {[lsearch $::authppl [string tolower $nick]]} {

is not the same as

{[lsearch [string tolower $::authppl] [string tolower $nick]]}


because you converted a LIST into a STRING and lsearch only works with lists.
User avatar
Fire-Fox
Master
Posts: 299
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Post by Fire-Fox »

rosc2112 wrote:if {[lsearch $::authppl [string tolower $nick]]} {

is not the same as

{[lsearch [string tolower $::authppl] [string tolower $nick]]}


because you converted a LIST into a STRING and lsearch only works with lists.
How can i make it right ... :)
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Online
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Just put lowercase entries in you list: YOU manage it, so YOU can choose if it muste be lowercase or case sensitive.
User avatar
Fire-Fox
Master
Posts: 299
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Post by Fire-Fox »

CrazyCat wrote:Just put lowercase entries in you list: YOU manage it, so YOU can choose if it muste be lowercase or case sensitive.
Im n00b to the tcl world so please help to write the script
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Fire-Fox wrote:
CrazyCat wrote:Just put lowercase entries in you list: YOU manage it, so YOU can choose if it muste be lowercase or case sensitive.
Im n00b to the tcl world so please help to write the script
Then become "un-n00b" and at least make some effort on your own behalf; these forums are full of hints/tips (apart from what you have been told already). ;)
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Seriously, you've been here over a year. I learned tcl in 2 months. It's really not that hard.
Online
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Fire-Fox wrote:Im n00b to the tcl world so please help to write the script
Just use the code I gave you and fill authppl with lowercase nicks.
It's not a tcl problem, it's simply logical.
User avatar
Fire-Fox
Master
Posts: 299
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Post by Fire-Fox »

CrazyCat wrote:
Fire-Fox wrote:Im n00b to the tcl world so please help to write the script
Just use the code I gave you and fill authppl with lowercase nicks.
It's not a tcl problem, it's simply logical.
Hey okay i'll try

Lowercase = text with no big chars ?
Uppercase = LIKE THIS
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Post Reply