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 

Verification Option Are you sure Y/N?

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


Joined: 15 Mar 2015
Posts: 317

PostPosted: Sat Apr 11, 2015 3:41 am    Post subject: Verification Option Are you sure Y/N? Reply with quote

Is it possible in TCL, generates an option to warn the user if it is sure to perform a task?

If the user types 'Y', the task is performed.
If the user types 'N', will not perform the task.
While the user does not enter 'Y' or 'N',the process stops, waiting for an option.

This we have achieved in mSL, but Tcl I understand very little, a few days I started learn this language.
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Sat Apr 11, 2015 11:43 am    Post subject: Reply with quote

Yes it is possible, BogusTrivia uses this exact concept in its /msg bot .add command for adding questions to the database.
Code:
6. Add Questions to Create the Database:

    Using the /msg command, message your bot with one of the .add commands.
    .add is sufficient if you're adding the included question file or files
    with *triv* in the filename(s). Follow the message window as the script may
    ask for user input. It may have you verify by sending you 3 examples from
    the file you're adding.
    You will need to answer yes or no  {or: y or n}.

    Note: If you are adding multiple question files and you're sure they ALL
          follow the same format, you may answer using "yes all"  {or:  y a}.
          The script provides error correction and creates a file called t2.badqes,
          these are broken Q&A and may later be edited or discarded as you wish.

I did this by making two processes, NOT by "the process stops, waiting for an option".

The first proc accepts the initial command, and sets a few global variables, to save the users nick and any needed info from his command.
1st proc also must make binds for 'Y' and 'N' to the second proc.
You may also wish to set a timer or bind time to remove the variables/binds if user doesn't finish the command (may require a 3rd proc).

The second proc just waits for one of the bound answers to call it.
When called, it confirms the nick, and does as the user has answered, then removes the associated binds/variables.
Make sure if you timer called a 3rd cleanup proc earlier, that it does not error out trying to remove things the 2nd proc already did:)
_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Sat Apr 11, 2015 1:52 pm    Post subject: Reply with quote

Thanks Spike^^ for your help.

I find it too much work, perhaps for the upload files function is justified, but I just wanted to warn the user when deleting a list.

In mSL can be done easily with a few lines of code Smile

The other thing I find difficult is the issue of flags for permits (bind), when executing a command.

In mSL which has a higher level can do everything that you can make someone of lower level, in Tcl I have encountered difficulties.

For example: I have three user levels that identify with the flags: +v local and global +o and +a (besides owner +n).

If I have this:
Quote:
bind pub o|v !command pub:process
bind pub o|v !command2 pub:process2

Means that only users with channel flag +v and global +o can do it?

How I can do so that they can execute this command, at least 3 levels at once?
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Sat Apr 11, 2015 3:21 pm    Post subject: Reply with quote

Quote:
If I have this:

Quote:
bind pub o|v !command pub:process
bind pub o|v !command2 pub:process2

Means that only users with channel flag +v and global +o can do it?
Yes.

Quote:
How I can do so that they can execute this command, at least 3 levels at once?
Maybe try something like this?
Code:
bind pub oan|v !command2 pub:process2

_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Sat Apr 11, 2015 5:23 pm    Post subject: Reply with quote

Pefect! Thanks Smile
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