Alternative Torque Syntax - ATS
by Tj Holowaychuk · 03/18/2009 (12:08 pm) · 3 comments
On behalf of Vision Media I have been developing some TGB tools, including an alternative syntax.
This and other features will be packed into a single Ruby gem 'torque' which can be found at http://github.com/visionmedia/torque. Other features will include command-line access to a snippits / cheat sheet database, and several automation tools.
Note that I have just begun development and it is not stable at the moment. The alternative syntax looks like this:
which is then compiled via a Ragel scanner to:
As I am still new to Torque I have a question for the dev team if you read this, does TGB have a command-line component as well? I am not sure if this is a gotcha but when I edit and Torque scripts I have to restart TGB, which I can understand seeing as the editor itself is built with torque script, however if this does not exist I will work on an automated solution so that its less of a hassle
This and other features will be packed into a single Ruby gem 'torque' which can be found at http://github.com/visionmedia/torque. Other features will include command-line access to a snippits / cheat sheet database, and several automation tools.
Note that I have just begun development and it is not stable at the moment. The alternative syntax looks like this:
# Torque Alternative Syntax
unless is_object(FollowMouseBehavior)
:template = new BehaviorTemplate(FollowMouseBehavior)
:template
.friendly_name = "..."
.behavior_type = "..."
.description = "..."
:template
.add_behavior_field(flip_x, "...", bool, true)
.add_behavior_field(follow_x, "...", bool, true)
.add_behavior_field(follow_x, "...", bool, true)
.add_behavior_field(tracking_speed, "...", float, 15.0)
endwhich is then compiled via a Ragel scanner to:
// Torque Alternative Syntax
if (!isObject(FollowMouseBehavior))
%template = new BehaviorTemplate(FollowMouseBehavior);
%template.friendlyName = "...";
%template.behaviorType = "...";
%template.description = "...";
%template.addBehaviorField(flipX, "...", bool, true);
%template.addBehaviorField(followX, "...", bool, true);
%template.addBehaviorField(followX, "...", bool, true);
%template.addBehaviorField(trackingSpeed, "...", float, 15.0);
}As I am still new to Torque I have a question for the dev team if you read this, does TGB have a command-line component as well? I am not sure if this is a gotcha but when I edit and Torque scripts I have to restart TGB, which I can understand seeing as the editor itself is built with torque script, however if this does not exist I will work on an automated solution so that its less of a hassle
About the author
#2
Good plan, I will try some of this out and see what the best solution will be, just seems like a huge roadblock during development if your constantly reloading TGB. Thanks for the tip I will try that out
03/18/2009 (1:25 pm)
Torsion is windows only though right?Good plan, I will try some of this out and see what the best solution will be, just seems like a huge roadblock during development if your constantly reloading TGB. Thanks for the tip I will try that out
#3
If you don't have/use Torsion though, the re-exec tip will work nicely for you :) That trick can have weird side effects sometimes though (not often, really just depends on what the script is doing), so it's good to keep that in mind.
03/18/2009 (1:31 pm)
Ah, yes, Torsion is Windows only at the moment. I believe some people have experimented with running it on Mac with Wine-esque tools (I don't know anything about the Mac equivalents to things like Wine and CrossOver Office...) and managed to get some amount of the functionality working. If you don't have/use Torsion though, the re-exec tip will work nicely for you :) That trick can have weird side effects sometimes though (not often, really just depends on what the script is doing), so it's good to keep that in mind.
Associate Ross Pawley
TorqueScript edit and continue.
You *can* hack TorqueScript to reload files pretty easily by simply making a function in the script file you want to reload (though it could be anywhere really) that calls exec( "pathToScript" ); and then you can merely call that function to reload any changes you've made.