| View previous topic :: View next topic |
| Author |
Message |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Sat Apr 11, 2015 3:41 am Post subject: Verification Option Are you sure Y/N? |
|
|
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 |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sat Apr 11, 2015 11:43 am Post subject: |
|
|
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 |
|
 |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Sat Apr 11, 2015 1:52 pm Post subject: |
|
|
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
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 |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sat Apr 11, 2015 3:21 pm Post subject: |
|
|
| 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 |
|
 |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Sat Apr 11, 2015 5:23 pm Post subject: |
|
|
Pefect! Thanks  |
|
| 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
|
|