Browse Search Popular Register Upload Rules User list Login:
Search:
THYME SCRIPT DEBUGGING TOOL AND DEMONSTRATION

Image:
screenshot of the scene

Author: Xray

Group: Default

Filesize: 61.14 kB

Date added: 2012-11-13

Rating: 5.5

Downloads: 738

Views: 587

Comments: 3

Ratings: 2

Times favored: 0

Made with: Algodoo v2.0.2

Tags:

Scene tag

Some of my Thyme scripts get rather large and complex, and the larger and more complex any piece of software becomes, then the more difficult it becomes to modify it and to debug it. I want to share a tool that I use which helps me a great deal during the debugging process. It is called a BREAKPOINT. Back in my early days of programming, I wrote and maintained programs for 8-bit embedded systems. We used a hardware tool called an emulator which allowed the software engineer to step through his/her code, one instruction at a time. Also, you could set breakpoints, which are specific addresses at which you want the emulator to halt, so you could check certain variables and I/O ports. The use of breakpoints was essential for debugging software. Well, I thought that it would be great if I were able to set breakpoints in my Thyme scripts. Since I do not have a hardware emulator, I must implement software breakpoints. A software breakpoint is a small piece of code that you place anywhere in your script where you want to determine the value of a variable either before or after it was written to. A breakpoint not only saves the condition of the variable at that point in the program, but it also HALTS the simulation so that the variable cannot be changed again until you've observed what you need to see.

A common breakpoint that I use is only two lines of script. The first line reads the desired variable and places the value in the text variable of a box so that I could immediately see what the value is. The second line of script is what stops the simulation, which is SIM.RUNNING = FALSE. In some scripts I may have two or three breakpoints in different areas that monitor specific variables at specific times. Breakpoints can also be conditional by using If/then statements. For example (here I use pseudo-code for explanation), Xvar == 5 ? {print Yvar; stop sim}:{ignore}. After your breakpoint is no longer needed, simply delete it, or cut and paste it at some other script line where you need to know some other values.

In this scene, I also demonstrate how certain scripts in Algodoo continue to execute even while the simulation has stopped. Script that are triggered by collision or laser, will stop immediately when the simulation stops, but script written in certain variables, such as "airFrictionMult", will continue executing regardless of the status of the simulation.

Play with this scene until you understand it, and then go play around with your own script!
Please log in to rate this scene
edit
Similar scenes
Title: Scene Debugging Tools
Rating: 5.625
Filesize: 68.36 kB
Downloads: 2146
Comments: 4
Ratings: 2
Date added: 2021/01/30 05:10:44
Made with: Algodoo v2.1.0
Rating: rated 5.6
download
Title: XY MECHANISM
Rating: 5
Filesize: 445.89 kB
Downloads: 603
Comments: 0
Ratings: 1
Date added: 2013/12/11 03:58:25
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Versatile Fuel Script*NOW WITH ENGINE!*(Read Description)
Rating: 5
Filesize: 83.41 kB
Downloads: 513
Comments: 0
Ratings: 1
Date added: 2015/05/21 00:10:08
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Self-Balancing Thyme bar, tutorial is included.
Rating: 6.2
Filesize: 20.06 kB
Downloads: 822
Comments: 6
Ratings: 4
Date added: 2010/08/17 01:59:35
Made with: Algodoo before v1.8.5
Rating: rated 6.2
download
Title: Loosen Shapes With Laser
Rating: 5.375
Filesize: 38.41 kB
Downloads: 2076
Comments: 9
Ratings: 2
Date added: 2020/12/27 02:59:49
Made with: Algodoo v2.1.0
Rating: rated 5.4
download
Title: A Better Timebase
Rating: 5
Filesize: 28.88 kB
Downloads: 504
Comments: 28
Ratings: 1
Date added: 2016/01/02 02:12:54
Made with: Algodoo v2.1.0
Rating: rated 5
download
Great tool and demo. Very simple and yet I never thought of doing this myself. Should save many people some debugging time. We will send you money for the time we save. My check is in the mail.
Sorry, I don't accept checks. CASH ONLY!
Cool thyme.