A Beginning

 This script was written by CHAT-GPT based on plain English specifications:

default

{

    state_entry()

    {

        llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_COLOR, ALL_SIDES, <1, 0, 0>, 1.0]); // set the color of all faces to red

    }


    touch_start(integer total_number)

    {

        integer face = llDetectedTouchFace(0); // get the index of the touched face

        list current_color = llGetLinkPrimitiveParams(LINK_THIS, [PRIM_COLOR, face]); // get the current color of the touched face

        

        vector new_color; // create a variable for the new color

        

        if (llList2Vector(current_color, 0) == <0, 0, 1>) // if the current color is blue

        {

            new_color = <0, 1, 0>; // set the new color to green

        }

        else if (llList2Vector(current_color, 0) == <1, 0, 0>) // if the current color is red

        {

            new_color = <1, 1, 0>; // set the new color to yellow

        }

        else // if the current color is neither red nor blue

        {

            new_color = <0, 0, 1>; // set the new color to blue

        }

        

        llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_COLOR, face, new_color, 1.0]); // change the color of the touched face

    }

}

The details don't matter much but generally, the idea is to add "behavior" to a box in Second Life.


I asked:
  • Make the box red;
  • When I touch a red face, make it blue;
  • When I touch a blue face, make it green 
etc.

Actually, there is a small bug in the code above, but I was impressed with this as a first effort. In subsequent posts, I will provide the dialogue and the scripts. For now, I wanted to test the feasibility
of doing things this way.

In the actual dialogue, CHAT-GPT explains its work and corrects the scripts if they don't behave as expected. Much of the code above would be beyond the capabilities of a novice script writer. Even then, it would take hours to get it right. CHAT-GPT doesn't get it right the first time, but smoothly modifies the script - even correcting the rare syntax error.


Comments

Popular posts from this blog

Facebook and Bing - A Killer Combination

A Process ...

Warp Speed Generative AI