Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Problem whit mouse methods (http://www.alice.org/community/showthread.php?t=9379)

facup94 07-16-2012 08:38 AM

Problem whit mouse methods
 
1 Attachment(s)
I have a problem whit mouse events.
When i click multiple times, the method run multiple times too. But i want the method activates only when is not working at this time.
Sorry for my english.
I looking something like:
if (method is running = true)
do nothing
else
do something

But when i click multiple times this method continues running after i stop click (number of times i click).

zanaqua 07-16-2012 12:48 PM

1 Attachment(s)
I think this is what you are looking for

facup94 07-16-2012 01:50 PM

Thanks, but problem continue. I don't know if is my PC or what.
When i click a lot of times quickly, method repeats number of times i've clicked.
And i wanna exactly what you do, but alice don't do that. your world is perfect but no work. And repeat I don't know if the problem is on my PC or whatever.

drellem 07-16-2012 04:58 PM

1 Attachment(s)
Here it is.
I wait for the method to finish before allowing the method to execute with
Wait 0.5

ogromen 07-18-2012 08:00 AM

Go to Google and search for the topic on this forum and some others where the answer could be given.


...............................
[URL="http://similarmovies.org/"]Movies database[/URL]
[URL="http://deportedirecto.es/products.php?product=Lee-Cooper-Back-To-School-Wal-V-Ni%C3%B1o-%28037069%252d03706903%29"]http://deportedirecto.es/products.php?product=Lee-Cooper-Back-To-School-Wal-V-Ni%C3%B1o-%28037069%252d03706903%29[/URL]
[URL="http://freemlm.net/"]Start of a new MLM[/URL]
Homepage and search engine at the same time. This is Napred.BG. Check it out on [URL="http://napred.bg"]http://napred.bg[/URL]

djslater107 07-21-2012 08:19 AM

Reminder
 
Members of this forum are encouraged to not write code for other members, but rather provide pseudocode explanations of possible solutions. Those who continue to write and share solutions will have their posting privileges suspended.

Thank you.

GameKid 07-21-2012 12:31 PM

[QUOTE=djslater107;50532]Those who continue to write and share solutions will have their posting privileges suspended.

Thank you.[/QUOTE]

Will this still happen if it isn't school? I've helped tons of people with non-school projects. :(

aliceuser504 06-19-2020 02:49 PM

Same problem for me in all examples
 
You click the mouse 10 times you will be sitting there waiting for 10 animations to play. As far as I can tell there is no way to stop this. If shoot==false, the program simply registers 10 clicks and waits for shoot to be true to play the animation.

Ideally you would only have the animation play once even if the user spams the mouse 10 times, until the animation is over and the gun is ready to shoot again, but that's not how it works.

I think it's a glitch in alice, but maybe somebody has a solution.

djslater107 06-26-2020 10:34 AM

Multiple Mouse Click events
 
I assume that you are referring Alice 3...

In the header for the addMouseClickOnObject Listener event, there is an "add detail" menu. One of the menu items in that menu is "multipleEventPolicy" from which you can select IGNORE. When you click on the object 10 times while the handler is executing, the extra clicks will be ignored.

If you have any other questions, let us know. We can be contacted at [email]don@alice.org[/email]

alendrew11 10-12-2020 03:59 PM

[QUOTE=djslater107;58793]I assume that you are referring Alice 3.[URL="https://farmvillefreak.com/mass-effect-andromeda-mods/"].[/URL].

In the header for the addMouseClickOnObject Listener event[URL="https://techrotten.com/"],[/URL] there is an "add detail" menu. One of the menu items in that menu is "multipleEventPolicy" from which you can select IGNORE. When you click on the object 10 times while the handler is executing[URL="https://farmvillefreak.com/alternatives-to-rabbit/"],[/URL] the extra clicks will be ignored.

If you have any other questions[URL="https://farmvillefreak.com/games-like-the-sims/"],[/URL] let us know. We can be contacted at [email]don@alice.org[/email][/QUOTE]

Thank you so much for sharing such a useful in formation. I am very glad to reach here I was founding the solution to this problem and finally I got it..[URL="https://iriveramerica.com/best-nfl-streaming-sites/"].[/URL].

djslater107 10-13-2020 07:37 AM

Use while mouse is clicked on something
 
1 Attachment(s)
You have set this up well, actually, but another response pointed out that Alice 2 puts every event into a queue and will process them one after another no matter how long the wait is. (This is an issue that we have fixed in Alice 3, where you are able to use a setting to ignore multiple mouse-clicks)

Try this in Alice 2.
1) Right click on the "When mouse is clicked on... " tile
2) Select "Change to..."
3) Select "While mouse the mouse is pressed on something"
4) The tile will change so that you now have a Begin, a During, and End option.
5) Put your method call in either Begin or End, not During.

Begin and End execute the method one time either when you start to press the mouse or when you release the mouse. During will execute the method continuously as long as the mouse button is held.

This should work for you. I have attached a sample project as an illustration. Let m know if you have any other questions.

Don Slater
Alice Project



[QUOTE=facup94;50487]I have a problem whit mouse events.
When i click multiple times, the method run multiple times too. But i want the method activates only when is not working at this time.
Sorry for my english.
I looking something like:
if (method is running = true)
do nothing
else
do something

But when i click multiple times this method continues running after i stop click (number of times i click).[/QUOTE]

djslater107 10-13-2020 07:50 AM

Use the while mouse is pressed on something event
 
1 Attachment(s)
You have done a good job trying to solve this problem, but as was pointed out, Alice 2 puts events into a Queue and will still fire them in sequence no matter how long you Wait. (Alice 3 addresses this problem with an option to ignore multiple clicks on mouse events, but that does not help you here.)

However, it is possible to convert the "When mouse is clicked on..." event to a "while the mouse is pressed..." event, which will solve the problem.

1) Right-click on the "When mouse is clicked on... " tile
2) Select "change to..."
3) Select "While the mouse is pressed on..."
4) Select your mouse-press target
5) You now have three options Begin, During, and End. Add your method call to either Begin or End, not During. Your gun should now only fire once either when you click the mouse, or when you release the mouse (depending on which option you chose.

Begin responds to the mouse-press one time when you start to press the mouse button

End responds to the mouse-press one time when you release the mouse button

During continually responds to the mouse-press as long as you are holding the mouse button.

I have attached a demo world "bunnyhop.a2w" that illustrates this event.

Please let me know if you have any questions.

Don Slater
Alice Project


All times are GMT -5. The time now is 11:09 PM.

Copyright ©2022, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.