Wednesday, July 9, 2014

Huge Upgrade for Kitto Flora's Steam Train: Part II

Chey Admires Her New Steam Train
The scripts in version 2 of Kitto Flora's little steam train were completely rewritten to take advantage of new features in Linden Scripting Language. As a result the engine now has a script time of about .06 ms, as opposed to .35 for version 2. It tracks better than version 2 and the carriages follow more closely.

Unlike version 2, version 3 is phantom while running, which means it ignores objects that block the tracks. Even after everything had been moved well clear of the rails I would occasionally get IMs from the engine telling me something was impeding its progress and where that object could be found. Usually the culprit was a huge hot, smoking temp-on-rez boulders that had been flung into the air by the volcano Pele. Phantom status also stops the collision warnings I was always getting from my Mystitool when I rode version 2.

The only no copy part of Kitto's train set is, for obvious reasons, the engine. Version 3 was smart enough to know when it was lost and could be set to IM its owner, giving its location. Version 3 comes with a rezzer that can rez or derez engines. Unlike version 2, which used a notecard, version 3 uses a blue menu for configuration. The owner can set the engine's speed, its loudness, the length of the column of smoke it generates, and set custom textures for the sides of the engine's boiler and cab.

Version 3 with Rezzer
I wasn't happy to learn version 3 required new track, for there are several hundred pieces that had to be replaced. The change is due to the way the engine reads the name and description of the assorted sections. Happily, Kitto supplies a track laying vehicle with version 3. I rezzed it at the main station and sat on it and it moved from section to section, beeping to tell me to locate the track upon which it had stopped. When I did, it rezzed a new piece of track with the same size, rotation, and position as the old section. Kitto was kind enough to travel to Whimsy and sit on the vehicle with me as it moved through the entirety of the route. Things went smoothly except for a half-dozen sections I deleted by mistake.

Track Updater. It Creates New Track to Mirror the Old
The new engine is less forgiving of overlapping sections of track than the old, so I rode the route, adjusting the length wherever there was an overlap. This was easy because unlike the track for version 2, the new track has full permissions. When I changed a section more than one meter in length I needed to modify the description field to to note the new size, but that was simple enough. I was able to save a dozen or more prims by stretching sections to double or triple their original length. Saving prims is always good.

I Ride the New Track, Hoping for the Best
Version 2 used invisible phantom prims that could be placed along the route to blow the whistle or adjust the length of the smoke column. Version 3 replaces those with codes added to the description. I saved ten or so prims by by picking up the version 2 event triggers and adding code to the track where they sat.

Track Event Marker for Version 2. The Prim is Visible
Because I Have Turned on Highlight Transparent
When avatars sit on the new engine they are offered a HUD which they can use to change speed and direction or return the train to its home position. When the HUD is detached a copy is not left in Inventory. That's a new feature of LSL, and a happy one. No one wants a dozen canoe paddles or operation HUDs clutting their Objects folder!

With new track laid and adjusted and the train running property through its route, I realized I had a new problem. Unlike version 2, which bumped and shook when it encountered the bumpers at the end of the track and then teleported home, the new version simply stopped. I had set it to return home when unoccupied for three minutes, but I missed the wreck, in which avatars suddenly found themselves teleported back to the train's home. Fortunately, Kitto provided me with a full permission script which tells the train to return home immediately when it encounters the end of the track.

The wreck is better than ever That's because the new train follows the direction of the track. It can run sideways or even upside down! That makes for a far more spectacular deliberate accident. At Kitto's suggestion I changed the name of the last section of visible track so it would not appear to the engine and lay a number of short sections to guide the train to its demise.


Then I turned them phantom and invisible. Here they are with highlight invisible turned on.


Here's the scene as it looks with highlight invisible turned off.


Here's the resulting train wreck.





As an afterthought I placed a penny on the track. We all know that will derail a train.


It wasn't a regular penny, either, but a special Whimsy coin.


The new wreck is much better than the old one.



No comments: