Team:Calgary/29 June 2009
From 2009.igem.org
(Difference between revisions)
PatrickKing (Talk | contribs) |
|||
Line 419: | Line 419: | ||
<br> | <br> | ||
<div class="heading"> | <div class="heading"> | ||
- | + | New Version of the HUD | |
</div> | </div> | ||
<br> | <br> | ||
<div class="desc"> | <div class="desc"> | ||
</html> | </html> | ||
- | + | Retrospective Notebook: This entry was not written on this day, but derived later from working notes I made that day. | |
+ | |||
+ | I figured out Second Life's very backwards link numbering system today. When prims (primitive objects) are linked together into a larger object, each one is assigned a 'link number' within the larger object. Then, scripts running in the prims can send messages to scripts in other prims via a 'link message' system, using the link number as an address (e.g. Prim number two says 'hello!' to prim number five. Prim five responds with 'get off my lawn' to prim number two.) The problem is that if one wants to use these link numbers to send messages, you have to know what they are, and link numbers are assigned invisibly and automatically by the SL game engine when the prims are linked together. | ||
+ | |||
+ | I did some experimentation, and as it turns out, link numbers are assigned in the reverse order that you selected the prims before linking them. So to assign the link numbers predictable, we hold down shift (as in windows explorer) and select the object we want to have the highest link number, and select the next highest, and then the next highest, etc. | ||
+ | |||
+ | This is just what I'd needed to simplify the heads up display. Instead of fiddling with the display tiles names each time I wanted to roll out an updated script, I could create a single tile with the new script. Then, copy that tile four times to get five tiles in a row, copy those five to get a row of fifteen tiles, and then copy that row eight times to get the full 8*15 block. And then, select them from last to first, one at a time, selecting the HUD's background last (where the HUD's main script lives), link them together, and voila. Updated HUD. Thankfully, the selection system is forgiving, so that when I inevitably misclick the 100th tile when I wanted the 101st, I can shift click it again to unselect, and continue without restarting. | ||
+ | |||
+ | Using link numbers also had a secondary benefit: the HUD's main script no longer needed to send each 'display character x at tile y' message to every tile, and let the tiles determine whether it was intended for them or not. Each of the 120 tiles would end up rejecting 119 messages! Instead, I could now do a little math to calculate which tile needed to get which message. The background object got link number '1', so the first tile of the first row was number 2, the first of the second row was number 17, through to 121, the last tile in the bottom row. The higher efficiency made the HUD's screen refresh speed go up by an order of magnitude, giving you the speedy screen you're familiar with today. | ||
+ | |||
+ | And if my decision to change systems needed any more justification, I discovered two more typos in the names of the tiles from the last version while I was building the new version. Out with the old, in with the new! | ||
<html> | <html> |
Revision as of 20:35, 21 August 2009
UNIVERSITY OF CALGARY