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.

Help with Command

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
C
CyberWar
Voice
Posts: 36
Joined: Mon Feb 04, 2008 4:49 am

Post by CyberWar »

i want a channel command like this: .gline nick reason

metroid: we trust to our team ;)
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

CyberWar wrote:i want a channel command like this: .gline nick reason

metroid: we trust to our team ;)
If you trust your team, why not just oper them?
C
CyberWar
Voice
Posts: 36
Joined: Mon Feb 04, 2008 4:49 am

Post by CyberWar »

the normal user are our help team. we have 100% trust to all. and we have another things to make it finish.

I am also a chat operator from a big telecommunications company and he have in the abuse team also opers and normal users
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

the second script is used as "!gline nick time reason"
it can easily be modified to have a default time in case one is not given
as for "which one is good?"; neither is good, however, both work
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

DragnLord wrote:the second script is used as "!gline nick time reason"
it can easily be modified to have a default time in case one is not given
as for "which one is good?"; neither is good, however, both work
DragnLord, sorry to say this, but neither of your scripts work. See my previous posts for details on how they're broken.
NML_375
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

nml375 wrote:
DragnLord wrote:the second script is used as "!gline nick time reason"
it can easily be modified to have a default time in case one is not given
as for "which one is good?"; neither is good, however, both work
DragnLord, sorry to say this, but neither of your scripts work. See my previous posts for details on how they're broken.
both scripts worked on my ircds when tested, thank you very much
Unrealircd accepts nicknames OR hostname/ip as the target
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

the second script works even if only nick is provided (on Unrealircd)
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

the second script works even if only nick is provided (on Unrealircd)
the ircd then uses it's configured default time for the g:line with the requestor's handle as reason if none is given
although joining reason fixes the reason not being whole if there are spaces

(edit: I only tested script with single word reasons, that's why scripts should not be written before coffee....lol)
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

set gline_time "1440"
bind pub G !gline pub:gline
proc pub:gline {n u h c t} {
putserv "gline $t $gline_time :Requested by $n ($h)"
}
Fails, tcl error. gline_time is a global variable. Below is correct.

Code: Select all

putserv "gline $t $::gline_time :Requested by $n ($h)"

Code: Select all

bind pub G !gline pub:gline

proc pub:gline {n u h c t} {
set nick "[lindex $t 0]"
set time "[lindex $t 1]"
set reason "[lrange $t 2 end]"
putserv "gline $nick $time :$reason ($h)"
}
Sloppy, very very sloppy.. not a good way to teach beginners or those wishing to pick up habits from other tcl scripters. This is how you should do it..

Code: Select all

set nick "[lindex [split $t] 0]"
set time "[lindex [split $t] 1]"
set reason "[join [lrange [split $t] 2 end]]"
nml375 is only trying to help you, not ridicule you, neither am I. Just showing you that others will pick up your (bad) habit and unexpected consequences often arise with tcl special characters when treating strings as lists and vice versa.

@nml375 --v

Code: Select all

if {[llenght $data] <3} { 
llenght??! :wink:
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

As said by speechles, my intention of pointing out errors/flaws is to help people improve their coding. Just as I hope/expect ppl to point out errors I've made.
For some odd reason, it is (almost) always easier to see other peoples errors than one's own..
NML_375
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

splitting $t a second time is quite unneeded as it is already separated by spaces, no need to use split here (TCL already defaults to using the spaces as separators)
it's more of a "bad habit" to do unneeded things, at least in my opinion

thank you for pointing out the global variable error, my ircd configuration uses 1440 as default, so I didn't catch that one
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

DragnLord wrote:splitting $t a second time is quite unneeded as it is already separated by spaces, no need to use split here (TCL already defaults to using the spaces as separators)
it's more of a "bad habit" to do unneeded things, at least in my opinion

thank you for pointing out the global variable error, my ircd configuration uses 1440 as default, so I didn't catch that one
Your forgetting your using unsanitized user input . I can use {[]} (nicknames allow these, don't they?) in my input and I've just broken your script (splitting would've kept this from happening).... these are the unexpected consequences that I mentioned happening with tcl special characters.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Splitting a second time?
I think you are abit confused 'bout splitting...
Split converts a string to a list, $t is a string since it originates from the binding. Hence it should (must) be splitted prior being used with any commands expecting a list as a parameter. Using your code with a "reason" such as "evil user typing {" would illustrate how your script was broken, and how split is necessary.

A bad habit, in my opinion, is not bothering to keep track whether the content of a variable is a string or a list (always considder user input to be a string, never a list).
NML_375
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

speechles wrote:Your forgetting your using unsanitized user input . I can use {[]} (nicknames allow these, don't they?) in my input and I've just broken your script (splitting would've kept this from happening).... these are the unexpected consequences that I mentioed happening with tcl special characters.
true enough, special characters may present issues, although on my tests with nicknames that included braces it still worked
as I said earlier, coding before coffee is baaaad
C
CyberWar
Voice
Posts: 36
Joined: Mon Feb 04, 2008 4:49 am

Post by CyberWar »

My problem at the moment is not yet resolved?
this scripts does not work?
Post Reply