Sonntag, 28. Februar 2010

MACS, Part 5.2 - Simple control HUD

Yesterday, in prevous post we equiped a pair of shoes with the connector script (core of the MACS) and processor scripts. By now nothing has changed, we can not even click the shoes to shrink or enlarge them or change the style. This is all correct, we need a remote control device to do that. We will now make a hud to perform all planed tasks.

Our challenge is: We will make that hud from control modules out of the SDK package, we will have to arrange the modules to configure them and perhaps do some reshaping, but we will not write any line of LSL code. We even do not know what LSL is.

Step 1: Planing the hud

This step is similar to planing how to group the shoe prims. The tasks for the shoes were:
  • resizing the shoes, 
  • changing the textures of straps and base side, 
  • changing colors of top and
  • bottom side, also the side of the heel.
    We will need this modules from the SDK:
    • A simple hud base "HUDB 1P".
    • Clickbuttons for resizing. The captions will be "+ 10%", "+ 5%", "+ 1%", "reset" and three with "-" instead of "+". So we can use seven "Button 5C 2P" modules as all captions are not longer than 5 chars.
    • A texture selector "MPIS 1F 3P" so we can use dozens textures to select and we can see what we take.
    • Three times the color selector "SCIB 5F 1P", 5 colors for diamond, top and bottom are enough for beginning.
    • For visual improvement the "Status 1P" module.
    Also we need the "resources" box, as we will use some images from inside. We arrange our modules horizontally. We use more place that the hud base gives but we will enlarge it later. What we have now looks like this:
    Picture 1: Pre-arranged Modules of the HUD

    Step 2: Configuring modules

    Clickbuttons

    The buttons are 6cm wide, so we place them in 6cm steps in a row. The buttons are unscripted and use T2M service to command the shoes. The resizing commands have to be the button names. The resizing command is "size:target:factor". Command without the factor resets the size. To resize all prims we target them by asterisk.

    To add 10% to the size we must multiply dimensions of each prim with 1.1, to decrease the prims by 10% we divide the dimensions with 1.1, i.e. multiply with 0.9091 = 1/1.1. This is how to rename the buttons from left to right, the button descriptions give their captions:
    • Name "size:*:0.9091", description "- 10%" 
    • Name "size:*:0.9524", description "- 5%"
    • Name "size:*:0.9901", description "- 1%"
    • Name "size:*", description "reset"
    • Name "size:*:1.01", description "+ 1%"
    • Name "size:*:1.05", description "+ 5%"
    • Name "size:*:1.1", description "+ 10%"

    After a check if all is right, we touch every button and after that link them all together, to make the row handier. It looks than like this:

    Picture 2: Prepared reize buttons

    Texture selector

    First we reshape, the module changing it's scale and taper. All four leant faces around the face 0 get assigned the "black' texture from the ressources box.

    Both arrow prims become boxes with yellow texture and we use the "arrows" image from the ressources box as front texture. The texture parameter must changed the repeats, rotation  and offset. To improve the view we add Background prims to arrow prims by unlinking the arrow prims, copying them and setting the copies the "glass button32x32" texture from resources box. Than all butons are linked again to the main prim.

    Now we have to rename and redescript the module prims. The main prim's description must be syncronized with the names of the arrow prims and their copies: As we use just one texture selector, we left them as they are: The main prim's description stays "mpis:0" and the name of arrow prims and copies stays "!pgsel:mpis:prev", "!pgsel:mpis:next".

    The name of the main prim is the texturing command without the image key. The command target is "*-base" (straps, base and heel prims, targetted all at once by using joker) and the face to take image is the golden face, alias 101. Hence, this is the name of the main prim: "img:*-base:101".

    Now we can link all prims of the texture selector togetter again. and get this result:
    Picture 3: Reshaped texture selector

    Color selectors

    Each of three color selectors become a bit smaller and get background prim and an icon prim left to color selector. The background prim is large, this their front texture wil be "glass button256x32". Arranging them all vertically brings this result:

    Picture 4: Color selectors

    Now renaming the module prims. Each name saves the color changing command without the color value (to extend the message by the color is the job of module). The name is "color:target:face". As target we use either the diamond (than we left the face number) or "*-base" to set the upper base, alias 100 or lower face, alias 102:
    • Upper selector, module name "color:diamond"
    • Middle selector, module name: "color:*-base:100"
    • Lower selector, module name: "color:*-base:102"
    The background and icon prims we left having name "Object", as they are just decorative elements. Linking all 9 prims together is also a good idea. The textures of each color selector we remove and change the face colors:
    • Upper selector: white, red, blue, brown, green
    • Middle selector: black, white, red, blue, green
    • Lower selector: black, white, red, blue, green

    The status module

    The status module is a gimix that we do not realy need, but it improves the hud a lot if it starts to blink as soon we click a button. To improve the look, we add also two thin bars to the hud, above and below the control modules. The lower bar will take the status module.

    The status module can be configured by a notecard inside, but the choosen colors are good for the actual design, so we let it. The module description lists commands to visualize the status. We leave also the actial settings: It will react on the commands "img", "alpha", "color", "size" and "ping". We do not send the command "alpha" by now but we could. To send the comand "ping" we have to rename the status module giving it the name "ping". The module script does'nt handle the touch event, so the T2M service will send the command.

    The hud base

    Ok, this part is easy. We have to rescale the base so it covers the actual module area. Than we arange and link everything together.

    The selecting textures and the icon prims

    Ok, the texture selector stil shows the face number texture. It is actually empty. We just go and find some textures we can put into it. That must be full perm images. We could find a golden, a silver texture, a blue latex texture and also the ressources box has a black and white textures. We put them all into the main prim of the texture selector (by editing the prim)

    Now the icon prims beside the color selectors. We want give them an image about what the color selectors are for. We need an icon showing the diamond, upper and lover base side. We don't need good designer skills for the job, SL itself gives us good pctures. Who has a nice diamond prim in the inventory, can cheat at this place.

    First, we rezz a copy of our shoes (they are copy so its easilly done). Than unlink and remove invisible prims, remove all shoe textures and set all colors to white. Now arrange both shoes good and place a blue screen behind them.

    Now take the screenshot of the diamond and two shoe pictures without to change camera position. The first one with set the base's upper face red, another with red heel prims but white base. Finally do some photo editing, removing the blie background and putting three pictures together to a 512x512 px² image for upload:

    Picture 5: Icon pictures (combined)

    This picture goes on the icon prims, with changed repeats and offset values. This is our result inworld:

    Picture 6: Our HUD inworld and worn

    and if worn as hud (at bottom left):

     Picture7: worn HUD


    Step 3: Installing MACS

    Now we have to install the controler script after we put and edit the config notecard into it. The notecard will have the name "macs.controler.config" and have this content:

    target   shoes@
    access   owner
    distance whisper

    This means: The hud wil send commands to all devices using alias "shoes" and belonging to same agent, the owner belongs to. The "@" at the alias end says the controller to complete the target by the actual owner's name. We could target the shoes statically by adding the owner's name: "shoes@Jenna Felton", but than the new hud owner would have to actualize the name in order to control own shoes. Here the target is dynamic.

    Second line says that only the owner might click the buttons, which is obvious if we use the hud. And the third line restricts the sending distance also to 10m.

    Now we put the controler script "macs.controller" from the private or professionsl MACS package. If we use the professional package, we have to activate the script by unsetting it's next owner copy or tranasfer permission.

    Step 4: System test

    To test our system we need detach or take into inventory the hud and shoes and rezz or attach them again: Only while rezzing the scripts read prim names and update their settings. Now we start testing.

    First the resize buttons. If we click one, e.g. "- 10%", the shoes schrink and the status LED on the hud goes green and fades out after 5 sek. - good. Clicking around makes them bigger or smaller, as buttons say. Clicking the "reset" button restores the size. And every time the status button shows that the command was accepted. The resizing works.

    Now the texture selector. We scroll through the testures and select one, the blue latex, than click the texture. The status button blinks green, the straps and golden heel part go blue, but the base stays golden, figure 8, left. Also the halfsphere around the diamond changes not completelly!

    The same hapens if we change the colors. The diamond changes the color bravelly if we touch the upper color bar, also the heel changes the color if we click on the lower color bar, but not the base. Also the middle color selector has no effect on the shoes, just the status module displays, the shoes accept the commands, figure 8, right part. What goes wrong?

     Picture 8: Something goes wrong...

    There are two problems. First we aliased not every face of the diamond halfsphere. We forgot the face 3 if we scanned it. This face keeps it's texture.

    Another problem is, we gave the base prims the group "base", which do not match the command target "*-base", while straps' and heel's groups "s-base" and "h-base" do. We have two solutions here. We can either give the base prims the group "b-base", additional to "base", or we edit the hud and change the commands target to something matching all three groups: The group name "*base" will do.

    Our corrections:
    • To add the alias to the face 3, we change the description of the diamond halfsphere prims to "straps:s-base @ 101:101:101:101".
    • The heel torus has another face we forget, the face 2. So we change the description of the prims from "heel:h-base @ :102" to "heel:h-base @ :102:102". Than we rerezz the shoes.
    • We change the name of the texture selector to "img:*base:101"
    • We change the names of the color selectors: Middle one gets name "color:*base:100", lower one the name "color:*base:102". Than we reattach the hud
    Now everything seems to work correctly. But some colors look ugly on our shoes. We change the face colors on the color selectors until we get better results.

    Picture9: The problems are now fixed.

    In the next part

    Next time we build an advanced hud:  We replace the base by another one adding the collapsing ability. We add two more buttons to make the processor scripts removable. And we replace our three color selectors by a HLS color picker and a simple color library. To decide what we colorize, we will have to use the command module.
    ..

    Keine Kommentare:

    Kommentar veröffentlichen

    Moving out and deadline strategy

    Hello everyone! It is pretty a while that I posted something last time, but now there are changes about stores and JFS at all (my company...