| View previous topic :: View next topic |
| Author |
Message |
daigo Voice
Joined: 27 Jun 2014 Posts: 37
|
Posted: Sat Jul 26, 2014 6:35 pm Post subject: When do I put "return 0"? |
|
|
For example:
| Code: | proc give {nick host hand chan arg} {
global givechan
if {$chan eq $::givechan} {
puthelp "PRIVMSG $givechan :Here is $arg for you"
}
return 0
} |
VS.
| Code: | proc give {nick host hand chan arg} {
global givechan
if {$chan eq $::givechan} {
puthelp "PRIVMSG $givechan :Here is $arg for you"
return 0
}
} |
VS.
| Code: | proc give {nick host hand chan arg} {
global givechan
if {$chan eq $::givechan} {
puthelp "PRIVMSG $givechan :Here is $arg for you"
return 0
}
return 0
} |
etc.
Where is/are the proper place(s) to put a "return 0"? |
|
| Back to top |
|
 |
Get_A_Fix Master

Joined: 07 May 2005 Posts: 206 Location: New Zealand
|
Posted: Sat Jul 26, 2014 7:18 pm Post subject: |
|
|
Firstly, you have to understand that by declaring the global variable within the procedure, you do not then need to use the global variable in the manner you're calling it.
For example
| Code: |
global givechan
if {$chan eq $::givechan} {
|
You had already declared global givechan. This means that you just have to do
| Code: |
if {$chan eq $givechan} {
|
If you do NOT declare the 'global variable' in the proc, then you would use the $::method
Secondly, for return, check this out. It can be a bit confusing, but a lot of the time it's best to just test it yourself, being on partyline with debug. If you add debugging code, it makes it even better so you can see everything that's going on when triggered. _________________ We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals. |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sun Jul 27, 2014 9:03 am Post subject: Re: When do I put "return 0"? |
|
|
| daigo wrote: |
...
Where is/are the proper place(s) to put a "return 0"?
|
That could depend on what you want to happen.
You'll get a better feel for it, if as Get_A_Fix suggested, you experiment with it.
In addition the the page that he gave you to read, here's some more good info on the subject, found here:
http://www.eggheads.org/support/egghtml/1.6.21/tcl-commands.html#bindb
I hope this helps. |
|
| Back to top |
|
 |
|
|
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
|
|