<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Emily,<div class="">See this attached world, and the explanation I sent in my previous message…</div><div class=""><br class=""></div><div class="">If you set the boolean variable to false in the main method, it will become false when the run button is pushed, regardless of when you try to trigger the event listener… You have to change the state (or value) of isActive as part of some other event, or procedure call</div><div class=""><br class=""></div><div class="">One example of using isActive</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">      </span>mouse click on some thing</div><div class=""><span class="Apple-tab-span" style="white-space:pre">         </span>if isActive</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                       </span>call procedure</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                    </span>set isActive to false  // here the event will happen only once, unless isActive is reset to true in some other event or procedure</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">     </span>another event mouse-click or keypress or some other procedure is called</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                   </span>set isActive to true</div><div class=""><br class=""></div><div class="">Another example</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">       </span>mouse click on some thing</div><div class=""><span class="Apple-tab-span" style="white-space: pre;">               </span>if isActive</div><div class=""><span class="Apple-tab-span" style="white-space: pre;">                     </span>call procedure  // here the event will happen until isActive is set to false in some other event or procedure call</div><div class=""><span class="Apple-tab-span" style="white-space: pre;">                 </span></div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>another event mouse-click or keypress or some other procedure is called</div><div class=""><span class="Apple-tab-span" style="white-space: pre;">                 </span>set isActive to false </div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Let me know if you have any other questions…</div><div class=""><br class=""></div><div class="">All the best,</div><div class="">Don Slater</div><div class=""><span class="Apple-tab-span" style="white-space:pre">       </span><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Nov 12, 2017, at 3:59 PM, Emily Higgins <<a href="mailto:erphiggins@gmail.com" class="">erphiggins@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="white-space:pre-wrap" class="">I put a global Boolean to turn to false in the main method and then set up the event listener to have an if key pressed AND Boolean true, and that did not work.  <br class="">Emily</div><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Sun, Nov 12, 2017 at 3:29 PM Joel Caulum <<a href="mailto:JCaulum@edgewood.edu" class="">JCaulum@edgewood.edu</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr" class="">
<div id="m_-2959315668771811121divtagdefaultwrapper" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" dir="ltr" class=""><p class="">Don,</p><p class="">Could you send a code sample, preferably in Alice 2, showing an example of what you described here?</p><p class=""><br class="">
</p><p class="">Thanks,</p><p class="">Joel Caulum</p><p class="">Computer Science</p><p class="">Portage High School</p><p class="">Portage, WI</p>
</div>
<hr style="display:inline-block;width:98%" class="">
<div id="m_-2959315668771811121divRplyFwdMsg" dir="ltr" class=""><font face="Calibri, sans-serif" style="font-size:11pt" class=""><b class="">From:</b> alice-teachers <alice-teachers-bounces+jcaulum=<a href="mailto:edgewood.edu@lists.andrew.cmu.edu" target="_blank" class="">edgewood.edu@lists.andrew.cmu.edu</a>> on behalf of Donald Slater <<a href="mailto:djslater107@mac.com" target="_blank" class="">djslater107@mac.com</a>><br class="">
<b class="">Sent:</b> Thursday, November 9, 2017 3:36:54 PM<br class="">
<b class="">To:</b> Alice educators<br class="">
<b class="">Subject:</b> Re: alice-teacher Alice 3 Event Listener Question</font>
<div class=""> </div>
</div></div><div dir="ltr" class="">
<div class="m_-2959315668771811121BodyFragment"><font size="2" class=""><span style="font-size:10pt" class="">
<div class="m_-2959315668771811121PlainText">Emily,<br class="">
One solution would be to create a Boolean variable for the Scene / World, maybe called isActive, with an initial value of true.<br class="">
<br class="">
In the event, create an if... statement<br class="">
        if (isActive)<br class="">
<br class="">
And then the work of the event would be inside the if statement code block...<br class="">
<br class="">
You would set the isActive variable to false at the point in the program where the user should NOT be able to move the wolf.<br class="">
<br class="">
Let me know if you have any questions...<br class="">
<br class="">
All the best,<br class="">
Don Slater<br class="">
<br class="">
Alice Project<br class="">
<br class="">
Sent from my iPad<br class="">
<br class="">
> On Nov 9, 2017, at 2:29 PM, Emily Higgins <<a href="mailto:erphiggins@gmail.com" target="_blank" class="">erphiggins@gmail.com</a>> wrote:<br class="">
> <br class="">
> Hi All,<br class="">
> I have a problem.  How can I make an event listener stop working?  We have an event listener moving a wolf, and at certain point in the program, the user needs to NOT be able to move the wolf.  I can't figure it out.<br class="">
> <br class="">
> Thank you very much,<br class="">
> Emily Higgins<br class="">
> STEM/Gifted and Talented<br class="">
> Boothbay Region High School<br class="">
> _______________________________________________<br class="">
> alice-teachers mailing list<br class="">
> <a href="mailto:alice-teachers@lists.andrew.cmu.edu" target="_blank" class="">alice-teachers@lists.andrew.cmu.edu</a><br class="">
> To change settings or unsubscribe visit:<br class="">
> <a href="https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers" target="_blank" class="">https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers</a><br class="">
_______________________________________________<br class="">
alice-teachers mailing list<br class="">
<a href="mailto:alice-teachers@lists.andrew.cmu.edu" target="_blank" class="">alice-teachers@lists.andrew.cmu.edu</a><br class="">
To change settings or unsubscribe visit:<br class="">
<a href="https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers" target="_blank" class="">https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers</a><br class="">
</div>
</span></font></div>
</div>

_______________________________________________<br class="">
alice-teachers mailing list<br class="">
<a href="mailto:alice-teachers@lists.andrew.cmu.edu" target="_blank" class="">alice-teachers@lists.andrew.cmu.edu</a><br class="">
To change settings or unsubscribe visit:<br class="">
<a href="https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers" rel="noreferrer" target="_blank" class="">https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers</a></blockquote></div>
_______________________________________________<br class="">alice-teachers mailing list<br class=""><a href="mailto:alice-teachers@lists.andrew.cmu.edu" class="">alice-teachers@lists.andrew.cmu.edu</a><br class="">To change settings or unsubscribe visit:<br class="">https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers</div></blockquote></div><br class=""></div></body></html>