Blade Edge

Computer software | Video production | My life in general

Blade Edge main header

Note to Self….

March 2nd, 2007 · No Comments · Software

Transposed from Gaiiden’s Scroll

Just a quickie before I head off to bed. I managed to get some more time in coding Blitz Blox tonight, and I have to admit that these chain reaction are giving me a headache. They are a logistical nightmare I’m still working to unravel. Still, I’m having eureka moments every now and then.

Anyways I wanted to post about to things related to TorqueScript. The first is that I made the mistake once again of defining a ‘new’ object inside of another ‘new’ definition. I dunno why TS doesn’t like this, but it doesn’t. I thought I’d be safe because unlike last time, I wasn’t doing two ‘new’ definitions on the same line. However I suppose as far as the compiler is concerned, this is one line:

%newReaction = new ScriptObject()
{
   id          = %this.chainReactionId++;
   effectsNum  = 1;
   effect0     = new t2dParticleEffect() { config = "chainReactionLink"; };
};

This caused me some grief to track down because ‘id’ and ‘effectsNum’ would be assigned an empty string value instead of the integers I thought they contained.

The second thing that tripped me up bad was the fact that, for some reason Torque likes to add a trailing space to its object IDs. For example, if you were to do this:

%object = new t2dStaticSprite();
echo("'" @ %object @ "'");

the output would look like this (obviously the ID number would vary):

'78977 '

What’s important to note here is that blasted trailing space. Why? WHY I say! This caused my Schedule manager to throw up a parse error when I tried doing this:

Schedule.addFunction(false, %this, 250, "chainReaction", %dstBlock SPC %newReaction.id);

Since that last argument would be passed along as “65383 1″ (note the extra space) when the Schedule manager pieces together the function call to chainReaction it comes up with “65383, ,1″ for the parameters to pass. chainReaction only has two arguments, hence a parse error.

Bah. In case you weren’t aware of that stupid trailing space, now you know. And if anyone could tell me why it’s there, I would appreciate it.

Okay I’m done. In between coding and doing some GDNet GDC prepwork, I played some GH II and beat Hard with all 5 stars and got a few more 5 star ratings on Expert as well. It works out nice, getting up to play a song every once in a while, keeps me from being chair-bound for a lengthy period of time.

The End

Tags: ··

No Comments so far ↓

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment