| View previous topic :: View next topic |
| Author |
Message |
jeroen_005 Voice
Joined: 22 Jun 2008 Posts: 19
|
Posted: Sun Jul 05, 2009 2:50 pm Post subject: update global command |
|
|
Currently I have following global script
| 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\00301 \] $text"
puthelp "PRIVMSG #tworSTAFF :\002GLOBAL:\002 \[ \00307$nick\00301 \] $text"
puthelp "PRIVMSG #tworPA :\002GLOBAL:\002 \[ \00307$nick\00301 \] $text"
putloglev p "#twor" "<TWOR_LOG> \002GLOBAL:\002 \[ \00307$nick\00301 \] $text"
return 1
}
}
} |
But i would like to change it so $nick can be specified.
Something like this:
!setperson My Name
!pglobal Tekst
GLOBAL: [ My Name ] Tekst
| Code: | bind pub -|- "!setperson" PubPerson
setudef flag staff
proc PubPerson {nick host hand chan text} {
if {[channel get $chan staff]} {
if {$text == ""} {
puthelp "PRIVMSG $chan :\002FOUT:\002 Gelieve een naam op te geven."
} else {
puthelp "PRIVMSG $chan :\002NEW PERSON:\002 $text"
set person $text
return 1
}
}
}
bind pub -|- "!pglobal" PubpGlobal
setudef flag staff
proc PubpGlobal {nick host hand chan text} {
if {[channel get $chan staff]} {
if {$text == ""} {
puthelp "PRIVMSG $chan :\002FOUT:\002 Gelieve een p-global op te geven."
} else {
puthelp "PRIVMSG #tworSTAFF :\002GLOBAL:\002 \[ \00307$person\00301 \] $text"
putloglev p "#twor" "<TWOR_LOG> \002GLOBAL:\002 \[ \00307$person\00301 \] $text"
return 1
}
}
} |
Currently I got this but this doesn't work, any suggestions? |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Sun Jul 05, 2009 4:26 pm Post subject: Re: update global command |
|
|
| jeroen_005 wrote: | | Currently I got this but this doesn't work, any suggestions? |
Ironically, you've forgotten to global variables in your global message script. Add this line:As the very first line below both your procedures. This will allow the local-space variable "person" to carry across into global space. Otherwise the contents of this local-space variable will be destroyed at the end of the procedure. This allows two procedures to share the same variable/contents without having to be passed during invocation. _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
|