Jump to content

Letter Rezzer?


Giyua
 Share

You are about to reply to a thread that has been inactive for 200 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello all I have created my own mesh letters and i'm wondering if there is a script for rezzing them. Like you would click the rezzed box - type in your word - the word rezzes from the letters in the box. 

How would i be able to do this?

Link to comment
Share on other sites

Assuming your word is short enough, and letters are small enough that the 10-meter rez radius doesn't come into effect, it shouldn't be all that difficult, but might be a bit of work as a first project to learn LSL.

  • your script would need to set up a listener so that it can respond to what is said to it (by rezzing the letters)
  • your script probably wants to give a llTextBox  in the touch_start event.
  • in the listen event, to actually rez the letters, you'll want to calculate the total width of the word, then for each letter, rez it at the position of the object plus some height, plus half the width of the word in the left direction of the rezzer's orientation less half the width of the letter, and the total width of all previous letters.
  • you may want a way to remove the letters when it's time for some new letters. to do that you'd need a script in each of the letters that makes them die when they hear a specific message.
Edited by Quistess Alpha
  • Like 1
Link to comment
Share on other sites

26 minutes ago, Quistess Alpha said:

Assuming your word is short enough, and letters are small enough that the 10-meter rez radius doesn't come into effect, it shouldn't be all that difficult, but might be a bit of work as a first project to learn LSL.

  • your script would need to set up a listener so that it can respond to what is said to it (by rezzing the letters)
  • your script probably wants to give a llTextBox  in the touch_start event.
  • in the listen event, to actually rez the letters, you'll want to calculate the total width of the word, then for each letter, rez it at the position of the object plus some height, plus half the width of the word in the left direction of the rezzer's orientation less half the width of the letter, and the total width of all previous letters.
  • you may want a way to remove the letters when it's time for some new letters. to do that you'd need a script in each of the letters that makes them die when they hear a specific message.

I will try this thank you

Link to comment
Share on other sites

I have a starter script for this but we seem to cant figure out the error. Any help is appricated

 

// Advanced Letter Rezzer Script

key gUser; // User who interacted with the object
integer gListener; // Listener handle
vector gRezOffset = <0.5, 0, 0>; // Change this based on the average width of your letters and desired spacing
rotation gRezRotOffset = ZERO_ROTATION; // Adjust if you need a specific rotation offset for the letters
float gCleanupMessageChannel = -9876.0; // A unique channel for cleanup messages

cleanup() {
    // Inform all previously rezzed letters to delete themselves
    llRegionSay(gCleanupMessageChannel, "cleanup");
}

rezLetter(string letter, vector pos, rotation rot) {
    vector rezPos = llGetPos() + pos; // Calculate the world position for the rez
    rotation rezRot = llGetRot() * rot; // Calculate the world rotation for the rez
    llRezObject(letter, rezPos, ZERO_VECTOR, rezRot, 0); // Rez the object
}

default {
    touch_start(integer total_number) {
        gUser = llDetectedKey(0);
        llListenRemove(gListener);
        gListener = llListen(0, "", gUser, "");
        llTextBox(gUser, "Enter the word:", 0);
    }

    listen(integer channel, string name, key id, string message) {
        if (channel == 0 && id == gUser) {
            cleanup(); // Clean up any previously rezzed letters
            vector curPos = <0, 0, 0>; // Starting position for the first letter
            integer i;
            for (i = 0; i < llStringLength(message); ++i) {
                string letter = llGetSubString(message, i, i);
                if (llGetInventoryType(letter) != INVENTORY_NONE) {
                    // Only rez the letter if it exists in the inventory
                    rezLetter(letter, curPos, gRezRotOffset);
                    curPos += gRezOffset; // Move position for the next letter
                }
            }
        } else if (channel == gCleanupMessageChannel && message == "cleanup") {
            llDie(); // Delete this object when cleanup message is received
        }
    }

    on_rez(integer start_param) {
        // Set up the listener for cleanup messages
        llListen(gCleanupMessageChannel, "", NULL_KEY, "");
    }
}

 

https://prnt.sc/HiKkFe1PoTcy

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 200 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...