Loading ...
Sorry, an error occurred while loading the content.
 

Final Commands after Interrupting a Forever Go Loop

Expand Messages
  • Ernest J Sergenti
    Hello: Is there a way to have NetLogo execute a final command if a forever-go loop is interrupted? That is, using the interface, if I want to run the model
    Message 1 of 5 , Aug 1, 2008
      Hello:

      Is there a way to have NetLogo execute a final command if a forever-go loop is interrupted? That is, using the interface, if I want to run the model manually (without using Behavioral Space) by first hitting the Setup button followed by the Go button and then I want to stop the run by hitting Go again, can I have NetLogo execute a final command, such as "file-close"?

      I know how to do this with Behavioral Space. I just add "file-close" in the Final Commands box.

      I also have a work-around in that I can add a button to the interface, and hit the "file-close" button after hitting the "Go" button for the second time. I was wondering if there was something a little more elegant.


      Thanks a lot for any help!

      Ernest
    • Izzet Pembeci
      Would this work: * Define a global variable (i.e. running) and set it initially to false: * In the Go procedure check if running is false or not. If it is
      Message 2 of 5 , Aug 5, 2008
        Would this work:

        * Define a global variable (i.e. running) and set it initially to false:
        * In the Go procedure check if running is false or not. If it is false make it true (we started running), if it is true (we are already running) set it to false and also execute your final command.

        iZzeT

        On Sat, Aug 2, 2008 at 1:22 AM, Ernest J Sergenti <ejs210@...> wrote:

        Hello:

        Is there a way to have NetLogo execute a final command if a forever-go loop is interrupted? That is, using the interface, if I want to run the model manually (without using Behavioral Space) by first hitting the Setup button followed by the Go button and then I want to stop the run by hitting Go again, can I have NetLogo execute a final command, such as "file-close"?

        I know how to do this with Behavioral Space. I just add "file-close" in the Final Commands box.

        I also have a work-around in that I can add a button to the interface, and hit the "file-close" button after hitting the "Go" button for the second time. I was wondering if there was something a little more elegant.

        Thanks a lot for any help!

        Ernest


      • Seth Tisue
        ... Ernest I also have a work-around in that I can add a button to the Ernest interface, and hit the file-close button after hitting the Ernest Go
        Message 3 of 5 , Aug 6, 2008
          >>>>> "Ernest" == Ernest J Sergenti <ejs210@...> writes:

          Ernest> I also have a work-around in that I can add a button to the
          Ernest> interface, and hit the "file-close" button after hitting the
          Ernest> "Go" button for the second time. I was wondering if there was
          Ernest> something a little more elegant.

          Nope. What you did is exactly the solution I would suggest.

          --
          Seth Tisue / http://tisue.net
          lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/
        • Ernest J Sergenti
          Hi iZzeT, Thanks a lot for your suggestion. I don t think that will work as I repeat the go step many times. Ernest ... From: Izzet Pembeci
          Message 4 of 5 , Aug 11, 2008
            Hi iZzeT,

            Thanks a lot for your suggestion. I don't think that will work as I repeat the go step many times.


            Ernest


            ----- Original Message -----
            From: Izzet Pembeci <pembeci@...>
            Date: Tuesday, August 5, 2008 8:18 am
            Subject: Re: [netlogo-users] Final Commands after Interrupting a Forever Go Loop
            To: netlogo-users@yahoogroups.com


            > Would this work:
            >
            > * Define a global variable (i.e. running) and set it initially to false:
            > * In the Go procedure check if running is false or not. If it is
            > false make
            > it true (we started running), if it is true (we are already running)
            > set it
            > to false and also execute your final command.
            >
            > iZzeT
            >
            > On Sat, Aug 2, 2008 at 1:22 AM, Ernest J Sergenti <ejs210@...> wrote:
            >
            > > Hello:
            > >
            > > Is there a way to have NetLogo execute a final command if a
            > forever-go loop
            > > is interrupted? That is, using the interface, if I want to run the
            > model
            > > manually (without using Behavioral Space) by first hitting the
            > Setup button
            > > followed by the Go button and then I want to stop the run by
            > hitting Go
            > > again, can I have NetLogo execute a final command, such as "file-close"?
            > >
            > > I know how to do this with Behavioral Space. I just add
            > "file-close" in the
            > > Final Commands box.
            > >
            > > I also have a work-around in that I can add a button to the
            > interface, and
            > > hit the "file-close" button after hitting the "Go" button for the second
            > > time. I was wondering if there was something a little more elegant.
            > >
            > > Thanks a lot for any help!
            > >
            > > Ernest
            > >
            > >
            >
          • Ernest J Sergenti
            Hi Seth, OK. Thanks. Ernest ... From: Seth Tisue Date: Wednesday, August 6, 2008 6:42 pm Subject: Re: [netlogo-users] Final Commands after
            Message 5 of 5 , Aug 11, 2008
              Hi Seth,

              OK. Thanks. Ernest


              ----- Original Message -----
              From: Seth Tisue <seth@...>
              Date: Wednesday, August 6, 2008 6:42 pm
              Subject: Re: [netlogo-users] Final Commands after Interrupting a Forever Go Loop
              To: netlogo-users@yahoogroups.com


              > >>>>> "Ernest" == Ernest J Sergenti <ejs210@...> writes:
              >
              > Ernest> I also have a work-around in that I can add a button to the
              > Ernest> interface, and hit the "file-close" button after hitting the
              > Ernest> "Go" button for the second time. I was wondering if there was
              > Ernest> something a little more elegant.
              >
              > Nope. What you did is exactly the solution I would suggest.
              >
              > --
              > Seth Tisue / http://tisue.net
              > lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/
              >
              >
            Your message has been successfully submitted and would be delivered to recipients shortly.