by date
Scripting .....
Scripting .....
| Name: | Le Roi | |
|---|---|---|
| Date Posted: | Jun 15, 2006 | |
| Rating: | 4.0 out of 5 | |
| Public: | YES | |
| Comments: | YES | |
| RSS Feed: | or Subscribe with . | |
| Profile Page: | View profile page for Le Roi |
Blog post
So I was at it again last night (keep the schedule you know :)) , and I designed my Actor and Controller classes with interfaces and base classes etc.
Then I turned to script these objects , and oops .... torque script does not know what an interface is ...
So i went to the forums , and after searching found 2 ways to do what I wanted ,
First way was to use the OO-TorqueScript - but I did not want to modify my engine (having already added the maximize box was enough for me ;)) - and used method 2 :
On the forums I found a whole post and replies about using the ":" (or scope as I like to call it) operator in your object definition
new ScriptObject(BaseClass)
{
someVar = 0;
};
new MyObject( :BaseClass)
{
};
This actually brings me to my point , after searching the forums and the site I came upon the TGE "Preview Documentation" on the garagegames site
(there is no link to this - I checked , only a search will reveal this)
There I found Chapter 5 - Scripting
EDIT : I Found the relevant pages on the TGB Wiki :) *hehe*
Boy did that help alot , I hope someone puts this chapter on the TGB Wiki page , because this really explains alot about how the scripting works etc.
Anyways I got my Actor/Controller working , then I realized that even if you associate a class in the TGB to your animated sprite , it won't recognize it unless the variable is declared beforehand and globally , this presented a problem for me as I have to create Actor objects dynamicly , luckily I started delving into the documentation and found the sceneGraph() documentation.
So basicly , I loaded my Level (without my sprite in it) with loadLevel() and then manually did a addToScene() to add my Actor.
I'm finally beginning to understand how this all fits together , but I think that newbies will be very confused when they fist start out with the tgb
(see my Perspective blog) and try to apply a "programming" approach.
I'll try and get a "getting started for coders" tutorial out on the wiki that explains to newbies (like me) how to get started making a basic level and adding/removing objects to it purely from a scripting p.o.v.
Thus the TGB at this stage is for me a "staging tool" - I use it to quickly prototype level ideas and test other stuff , once I'm done with this I'll save the level and then open it with a text editor , copy all the stuff I need to my custom classes and be done with it.
Don't get me wrong , the TGB is very useful - I love the editor , and I also love the fact that I can see immediately how a animation looks like for example and the GUI tools just rock , I haven't tried the other tools yet (particle) etc. - but I'm sure that they too will rock.
One final thing I must state is the wonderful IDE "Torsion" (http://www.sickheadgames.com/torsion.php) ,
I haven't really looked at other IDE's
(except for one who shall not be named , where when I moved a script file to another folder , lost my script file (just deleted it!)) anyways
this one(torsion) really sped up my development and debugging , it really is a great tool , It automaticly picks up your project and all associated files , and lets you debug and step into the script like any other IDE ,
one feature I would love though is the concept of a "watch" - but I saw on the forums somewhere that they are working on it.
Anyways thats my post for today
Cheers
Le Roi
Then I turned to script these objects , and oops .... torque script does not know what an interface is ...
So i went to the forums , and after searching found 2 ways to do what I wanted ,
First way was to use the OO-TorqueScript - but I did not want to modify my engine (having already added the maximize box was enough for me ;)) - and used method 2 :
On the forums I found a whole post and replies about using the ":" (or scope as I like to call it) operator in your object definition
new ScriptObject(BaseClass)
{
someVar = 0;
};
new MyObject( :BaseClass)
{
};
This actually brings me to my point , after searching the forums and the site I came upon the TGE "Preview Documentation" on the garagegames site
(there is no link to this - I checked , only a search will reveal this)
There I found Chapter 5 - Scripting
EDIT : I Found the relevant pages on the TGB Wiki :) *hehe*
Boy did that help alot , I hope someone puts this chapter on the TGB Wiki page , because this really explains alot about how the scripting works etc.
Anyways I got my Actor/Controller working , then I realized that even if you associate a class in the TGB to your animated sprite , it won't recognize it unless the variable is declared beforehand and globally , this presented a problem for me as I have to create Actor objects dynamicly , luckily I started delving into the documentation and found the sceneGraph() documentation.
So basicly , I loaded my Level (without my sprite in it) with loadLevel() and then manually did a addToScene() to add my Actor.
I'm finally beginning to understand how this all fits together , but I think that newbies will be very confused when they fist start out with the tgb
(see my Perspective blog) and try to apply a "programming" approach.
I'll try and get a "getting started for coders" tutorial out on the wiki that explains to newbies (like me) how to get started making a basic level and adding/removing objects to it purely from a scripting p.o.v.
Thus the TGB at this stage is for me a "staging tool" - I use it to quickly prototype level ideas and test other stuff , once I'm done with this I'll save the level and then open it with a text editor , copy all the stuff I need to my custom classes and be done with it.
Don't get me wrong , the TGB is very useful - I love the editor , and I also love the fact that I can see immediately how a animation looks like for example and the GUI tools just rock , I haven't tried the other tools yet (particle) etc. - but I'm sure that they too will rock.
One final thing I must state is the wonderful IDE "Torsion" (http://www.sickheadgames.com/torsion.php) ,
I haven't really looked at other IDE's
(except for one who shall not be named , where when I moved a script file to another folder , lost my script file (just deleted it!)) anyways
this one(torsion) really sped up my development and debugging , it really is a great tool , It automaticly picks up your project and all associated files , and lets you debug and step into the script like any other IDE ,
one feature I would love though is the concept of a "watch" - but I saw on the forums somewhere that they are working on it.
Anyways thats my post for today
Cheers
Le Roi
Recent Blog Posts
| List: | 06/15/06 - Scripting ..... 06/14/06 - Perspective ... 06/12/06 - Finally ... |
|---|
Submit your own resources!| Pisal Setthawong (Jun 15, 2006 at 08:22 GMT) |
| Tom Spilman (Jun 15, 2006 at 11:58 GMT) |
Specifically what do you want to see in a "watch" feature?
| Ian Poma (Jun 15, 2006 at 13:44 GMT) |
I would pay you( well, at least give you a very big hug, or convince a very pretty girl to give you a very big hug) to do this once you are done with your own struggles. I have had a heck of time trying to figure out how to do things in torque script and I'm getting no where fast.
The docs that come with TGB are barely passable for the way I learn. The tutorials are ok, but I am really wanting something more technical. I hit my breaking point this week and set TGB aside until final release, hoping that when it ships they will provide more docs on the technical side. I am a software developer and have been working with OO languages for the past ten years, I find myself fighting with torque script more than learning it.
I probably just need to keep grinding away at it until the light bulb comes on. But honestly I haven't had this much trouble learning a new language/tech since I was a neophyte coder in college.
Edited on Jun 15, 2006 13:47 GMT
| Jonathon Stevens (Jun 15, 2006 at 14:48 GMT) |
| Brandon Maness (Jun 15, 2006 at 15:34 GMT) |
| Le Roi (Jun 15, 2006 at 17:26 GMT) |
@Tom: Thanks for torsion - it rules - anyways I discovered the "watch" window thanks @Jonathon , what I actually meant was that when I right-click on a variable , in the pop-up menu that if it could display a "quick watch" function , when clicked this will popup the object/variable and list all of its members etc. (i'm thinking of visual studio so bear with me ;)).
@Ian: I'll try and get it up soon , you'll be the first to proof read it *hehe*
You must be a member and be logged in to either append comments or rate this resource.


4.0 out of 5


