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 

[RESOLVED] How to call a proc within a proc

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


Joined: 01 May 2014
Posts: 43

PostPosted: Sat Apr 22, 2017 12:52 am    Post subject: [RESOLVED] How to call a proc within a proc Reply with quote

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
View user's profile Send private message
caesar
Ass Kicker


Joined: 14 Oct 2001
Posts: 3403
Location: Area 51

PostPosted: Sat Apr 22, 2017 3:11 am    Post subject: Reply with quote

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).
_________________
You may say anything about me, but don't misspell my name.
Back to top
View user's profile Send private message
willyw
Owner


Joined: 15 Jan 2009
Posts: 925

PostPosted: Sat Apr 22, 2017 3:29 am    Post subject: Re: How to call a proc within a proc Reply with quote

"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
View user's profile Send private message
Landslyde
Halfop


Joined: 01 May 2014
Posts: 43

PostPosted: Sat Apr 22, 2017 5:25 am    Post subject: Reply with quote

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
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