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 

Passing on a variable outside a proc

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


Joined: 05 Oct 2007
Posts: 2
Location: a secret bunker

PostPosted: Sat Oct 06, 2007 12:16 am    Post subject: Passing on a variable outside a proc Reply with quote

I just started learning tcl and came across a couple things I just couldn't find any answers to.
Here goes:

Code:
bind pub - !test lineread
proc lineread {nick host handle chan text} {
  global prech homech
  if {$chan == $homech} {
  putserv "PRIVMSG $prech :$text" }


My first question is, is it possible to pass a variable from one procedure onto another procedure (without using a file) and how qould that work
In this case the content of $text, since I want to use it in my second procedure.

-
My second procedure will read a specific line, which starts with [
My first thought was to use the \[*
Code:
bind pubm - "$prech \[*" reread

which obviously doesn't work since the [ is in bold
after that I also tried /002\[ to no avail
Code:
bind pubm - "$prech /002\[*" reread


My question is, is there a way to get this to work in the bind pubm line.

Thanks in advance
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Oct 06, 2007 7:24 am    Post subject: Reply with quote

1: Check out the global command.
Obviously you are already using it, probably just need to read alittle to figure out how to use it.

2: Use \ooo or \xhh to create any character, not /ooo or /xhh (ooo being the octal value, such as 002, xhh being hexadecimal value, such as x02).
Thus, this should do the trick:
Code:
bind pubm - "$prech \002\[*" reread

_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Mr B
Voice


Joined: 05 Oct 2007
Posts: 2
Location: a secret bunker

PostPosted: Sat Oct 06, 2007 1:56 pm    Post subject: Reply with quote

Ok it took me a bit cause I made some mistakes at first but I finally saw the light
passing on using the global command works now Smile

Thanks for pushing me in the right direction nml375 and for the explantion on the second problem, that also works like a charm now
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Oct 06, 2007 3:01 pm    Post subject: Reply with quote

That's why we're here Smile
_________________
NML_375, idling at #eggdrop@IrcNET
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