| View previous topic :: View next topic |
| Author |
Message |
Landslyde Halfop
Joined: 01 May 2014 Posts: 46
|
Posted: Sat Apr 22, 2017 12:52 am Post subject: [RESOLVED] How to call a proc within a proc |
|
|
I have three procs.
| Code: | proc one {nick uhost handle channel args} {
some code
}
proc two {} {
some code
one
}
proc three {nick uhost handle channel args} {
some code
one
} |
I want to recall proc one after proc two and proc three run their course. The way I have it (without the inner code of the procs shown here) is not working. What's the right way to do this?
Last edited by Landslyde on Mon Apr 24, 2017 11:18 pm; edited 1 time in total |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sat Apr 22, 2017 3:11 am Post subject: |
|
|
First off avoid using args as it has a special meaning.
If the functions (proc) aren't binded or called anywhere outside another function (proc) I don't see how this would work.
Basically add one at the end of the code you got to call it when the tcl file is executed (read). _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sat Apr 22, 2017 3:29 am Post subject: Re: How to call a proc within a proc |
|
|
"is not working"
It would help if you would show us the error message that you are seeing in the partyline.
In the meantime, I suspect that it will have to do with the wrong number or arguments.
Think of the proc that you have named "one" as that you have created a new tcl command, named "one". You can call it and use it. However, by the design of it, "one" wants to be passed five command line arguments.
In proc two, you will have to re-think that - so that you have something to pass to "one" when you call it.
You can hard code it, if that will fit your needs.
In proc three, it looks like the usage would be:
one $nick $uhost $handle $chan $text
(I agree with caesar. args is special. I don't even use "arg", even though that is not special.... it just looks close to the human eye. )
Big note ! :
With the very limited sample code we are working with here - aren't we creating an infinite loop? Have another look, and think about it.
I hope I have not misled you - I just woke up and am not firing on all cylinders yet. _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
Landslyde Halfop
Joined: 01 May 2014 Posts: 46
|
Posted: Sat Apr 22, 2017 5:25 am Post subject: |
|
|
caesar and willyw:
This is an issue i'm having with a prior post: http://forum.egghelp.org/viewtopic.php?t=20324
This is a game script. The user calls the game with !word
If no one guess the puzzle, the game ends.
If the puzzle is guessed, the game also ends.
I have the code in that post. I want to be able to automatically call the proc pub_word after either of the above two events happen, rather than have the user continuously keep starting a game by using the !word. That's what they all want. But I cant make ti happen at all.
Any help wld be greatly appreciated. |
|
| Back to top |
|
 |
|