none
Sequential or Multi Mode? RRS feed

  • Question

  • Part of what is confusing people is how SB executes graphics.  Think of this problem.  We have a program that has 5 steps: Bounceball1, Bounceball2, bounceball3, bounceball4, bounceball5.  each step is identical in that it simply bounces a ball up and down on thee screen.  What SB does is start each step one after another BUT before the previous step is completed.  If we want all 5 balls to bounce at the same time, this is what you will see on the screen. 

    If how ever you want the first ball to bounce then the second ball to bounce etc. or to execute the program sequentially, the only way appears to be inserting Program.delay(DelayTime) in between each step where DelayTime = the time needed, in this case, to bounce the ball. 

    A much cleaner way would be to set ExecuteMode = Sequental.  In this case step2 would not commence util step1 has completed, but I don't think this exists. 

    An alternative would be some sort of while loop that would keep looping until step1 has completed then loop until step2 is completed etc.

    While (Step1 is Executing) Loop
    while (Step2 is Executing) loop
    etc

    If you addin Silverlight the problem is compounded in that it appears that Silverlight seems to be executing everything at once or simulataniously.  In some cases this could have a spectactlure effect, in others a big disapointment.  Is it possible to first add this to small basic and then add it to silverlight running small basic?  The the long run it may save many bug reports and incidents of programer furstration!

    Thursday, March 18, 2010 2:41 AM

Answers

  • To run things asynchronously, you have the Timer object. Or, if you're using my extension, the SmallBasic.setTimeout function.

    It's really possible to implement a correct setTimeout fully in Small Basic now we have the Timer object.
    Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension
    Thursday, March 18, 2010 8:30 PM