egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

update global command

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
jeroen_005
Voice


Joined: 22 Jun 2008
Posts: 19

PostPosted: Sun Jul 05, 2009 2:50 pm    Post subject: update global command Reply with quote

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
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sun Jul 05, 2009 4:26 pm    Post subject: Re: update global command Reply with quote

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:
Code:
global person
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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber