BricxCC now has preliminary but fully functional support for compiling and executing PC-based scripts to control your programmable brick (NXT, RCX, Spybot, whatever). These scripts can be edited in BricxCC with syntax highlighting and (coming soon) code and argument completion/insight support. The active brick connection is used to send commands to the brick. The exact same interface used internally by BricxCC (originally based on the Spirit OCX control) to communicate with a programmable brick is exposed within the scripting language. The scripting language is RemoteObjects Pascal Script. Here are a couple sample scripts:
program joybtn01p;
const
OUT_C = 4;
begin
BrickComm.SetMotorPower(OUT_C, 2, 4);
BrickComm.SetFwd(OUT_C)
BrickComm.MotorsOn(OUT_C);
end.
program joybtn01r;
const
OUT_C = 4;
begin
BrickComm.MotorsOff(OUT_C);
end.
These scripts will work for either a connection to an RCX or to an NXT. The BrickComm class’s public interface is shown at
http://bricxcc.sourceforge.net/uSpirit.html
BricxCC also has a mechanism for assigning scripts to joystick button press and release events (up to 32 buttons). The first script above would execute when the joystick button 1 is pressed since it is named joybtn01p.rops while the second would execute when button 1 is released. These script files must be located at
C:\Documents and Settings\jhansen\Application Data\JoCar Consulting\BricxCC\3.3
replacing “jhansen” with your own username.
All the pascal scripts have a .rops extension. If you have a script open in an editor window you can compile it and run it using the standard BricxCC compile and Run toolbar buttons or menu items. You can define Pascal Script templates and customize the syntax highlighting color scheme like you can with any other supported programming language.
Soon the scripting language will have access to all of the tool windows in BricxCC. You can even write scripts that display GUI dialogs with event handlers, etc…
http://bricxcc.sourceforge.net/test_release.zip
John Hansen