| View previous topic :: View next topic |
| Author |
Message |
jeroen_005 Voice
Joined: 22 Jun 2008 Posts: 19
|
Posted: Sun Nov 02, 2008 6:07 am Post subject: !global command |
|
|
Do someone know whats there wrong with this script:
| Code: | setudef flag staff
proc global { nick uhost hand channel text } {
if {[lsearch -exact [channel info $chan] +staff] == -1} { }
if {$text == ""} {
putserv "privmsg $chan :\002FOUT:\002 Gelieve een global op te geven."
}
if {$text != ""} {
putserv "PRIVMSG #twor :\002GLOBAL:\002 [ \00307$nick\00307 ] $text"
putserv "PRIVMSG #tworSTAFF :\002GLOBAL:\002 [ \00307$nick\00307 ] $text"
putserv "PRIVMSG #tworPA :\002GLOBAL:\002 [ \00307$nick\00307 ] $text"
}
} |
|
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Nov 02, 2008 11:20 am Post subject: |
|
|
If you could describe the error in nature, that would certainly help diagnosing the problem. At a quick glance however, it would seem you've forgotten to "escape" some brackets ([]) to prevent command substitution.
Other than that, there are a few code structures that could be a bit "cleaner", but nevertheless they should not hamper the operation of the script... _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
jeroen_005 Voice
Joined: 22 Jun 2008 Posts: 19
|
Posted: Sun Nov 02, 2008 3:57 pm Post subject: |
|
|
| It's my first script :d But there are no error's showing up when loading or running :s |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Nov 02, 2008 7:06 pm Post subject: |
|
|
Did you remember to create a "binding" to trigger the code?
ie:
bind pub myword myproc
Also, "global" is a native tcl command, it would usually be a very bad idea to replace this with your own proc. Most likely you'll break lots of other stuffs. Please consider a different name for your proc (function).
Edit: There also seems to be a variable name mixup regarding the channel argument. _________________ NML_375, idling at #eggdrop@IrcNET
Last edited by nml375 on Mon Nov 24, 2008 10:27 am; edited 1 time in total |
|
| Back to top |
|
 |
Djoezy Voice
Joined: 30 Mar 2008 Posts: 6
|
Posted: Mon Nov 24, 2008 4:04 am Post subject: |
|
|
Maybe this will help ..
| Code: |
setudef flag staff
bind pub - "!global" global
proc global { nick uhost hand channel text } {
if {[lsearch -exact [channel info $chan] +staff] == -1} { }
if {$text == ""} {
putserv "privmsg $chan :\002FOUT:\002 Gelieve een global op te geven."
}
if {$text != ""} {
putserv "PRIVMSG #twor :\002GLOBAL:\002 [ \00307$nick\00307 ] $text"
putserv "PRIVMSG #tworSTAFF :\002GLOBAL:\002 [ \00307$nick\00307 ] $text"
putserv "PRIVMSG #tworPA :\002GLOBAL:\002 [ \00307$nick\00307 ] $text"
}
} |
Voor hulp kun je me altijd bereiken op #djoezy (Quakenet) _________________ Do you know what reallife means ? And where i can download it ? |
|
| Back to top |
|
 |
TCL_no_TK Owner

Joined: 25 Aug 2006 Posts: 509 Location: England, Yorkshire
|
Posted: Mon Nov 24, 2008 10:15 am Post subject: |
|
|
| Code: | proc global { nick uhost hand channel text } {
if {(![channel get $channel staff])} {
return 0
}
if {$text == ""} {
putserv "privmsg $chan :\002FOUT:\002 Gelieve een global op te geven."
return 0
}
if {$text != ""} {
putserv "PRIVMSG #twor :\002GLOBAL:\002 [ \00307$nick\00307 ] $text"
putserv "PRIVMSG #tworSTAFF :\002GLOBAL:\002 [ \00307$nick\00307 ] $text"
putserv "PRIVMSG #tworPA :\002GLOBAL:\002 [ \00307$nick\00307 ] $text"
return 1
}
} |  _________________ TCL the misunderstood |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Mon Nov 24, 2008 10:24 am Post subject: |
|
|
Since everyone else is making a half-hearted attempt at posting slightly modified code, I might just as well post a proper piece of code...
Even so, I still recommend trying to fix the problems yourself based on the hints given, rather than just taking one of the suggested solutions and be done with it.
Oh yeah, at that first glance, I did miss a variable name mixup, which is also fixed...
| Code: | bind pub -|- "!global" PubGlobal
setudef flag staff
proc PubGlobal {nick host hand chan text} {
if {[channel get $chan staff]} {
if {$text == ""} {
puthelp "PRIVMSG $chan :\002FOUT:\002 Gelieve een global op te geven."
} else {
puthelp "PRIVMSG #twor :\002GLOBAL:\002 \[ \00307$nick\00307 \] $text"
puthelp "PRIVMSG #tworSTAFF :\002GLOBAL:\002 \[ \00307$nick\00307 \] $text"
puthelp "PRIVMSG #tworPA :\002GLOBAL:\002 \[ \00307$nick\00307 \] $text"
return 1
}
}
} |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
TCL_no_TK Owner

Joined: 25 Aug 2006 Posts: 509 Location: England, Yorkshire
|
|
| Back to top |
|
 |
jeroen_005 Voice
Joined: 22 Jun 2008 Posts: 19
|
Posted: Thu Nov 27, 2008 9:36 am Post subject: |
|
|
Thnxs for helping boy's Sorry for the late reply but i had exams Love you all  |
|
| Back to top |
|
 |
|