Threads

View context
You are a building machine!!
like(1)
Only when I'm inspired.
liked(1)
View context
I rezzed it out its lovely thanks!!!
like(1)
View context
Stop being so adorable plsss!!
like(1)
View context
Wondering if this party will still be on today?
like(0)
View context
Seriously awesome. Perfect for the world im creating!! If you use the rezzer you cant go across sims but I tool the dragon out of the rezzer and it crosses fine and i can do barrel rolls heheeh
like(1)
View context
Don't forget The Butcher, The Baker and The Candlestick Maker to. A poetic thriller.
like(2)
Let's not forget The Nun, The Nun II, The Pope's Exorcist....
like(0)
View context
Hhaha logged in and insulted someone!!! Such an opensim thing hahahah
like(1)
View context
As Im Aussie i will still be asleep for this sorry but i hope you all have fun.
like(1)
View context
yes! I'm working on the animations for it, hope to throw it in the shop some day soon:)
liked(1)
View context
Israel's temper tantrum?
like(3)
View context
A ton of effort to do this!
like(1)
View context
Wow you are rocking this animesh thing!!
like(1)
View context
So many sounds here yay made finding a Sawing sound easy!
like(0)
View context
SO after everyone's input and several hours of testing and getting ChatGPT to rewrite this over and over this is what i have got so far. The only issues are that the ingredients (which are placed near the crafting station) do not get deleted and for some reason the chair option on the menu does not rez out. The table and stone wall do however. I tested naming prims the ingredients and the end product. There is a menu option to select which recipe you want to make.

// Crafting Station Script
integer dialogChannel = 1234; // Channel for dialog
list recipes; // List of recipes
list requiredIngredients; // Ingredients needed for crafting
string craftedItem; // Variable to hold the name of the crafted item
integer foundCount; // Counter for found ingredients
list detectedIngredientKeys; // List to hold keys of detected ingredients

default
{
state_entry()
{
// Define some crafting recipes
recipes = [
"Chair", "Wood1", "Nails", // Chair requires Wood1 and Nails
"Table", "Wood", "Nails", // Table requires Wood and Nails
"Stone Wall", "Stone", "Cement" // Stone Wall requires Stone and Cement
];

llSay(0, "Welcome to the Crafting Station! Touch to see available recipes.");
}

touch_start(integer total_number)
{
// Create a list of crafted item names for the dialog
list itemNames = [
"Chair",
"Table",
"Stone Wall"
];
llDialog(llDetectedKey(0), "Select an item to craft:", itemNames, dialogChannel);
llListen(dialogChannel, "", llDetectedKey(0), ""); // Start listening for dialog responses
}

listen(integer channel, string name, key id, string message)
{
if (channel != dialogChannel) return;

// Check if the item is in the recipes list
integer index = llListFindList(recipes, [message]);
if (index != -1)
{
// Get the required ingredients for the selected item
requiredIngredients = llList2List(recipes, index * 3 + 1, index * 3 + 2);
craftedItem = message; // The crafted item name is the selected message

// Reset the detected ingredient keys list
detectedIngredientKeys = [];
// Check for ingredients nearby after a short delay
llSetTimerEvent(0.5); // Set a timer for 0.5 seconds
}
else
{
llSay(0, "Recipe not found. Please try again.");
}

llListenRemove(channel); // Stop listening after processing the message
}

timer()
{
llSensor("", NULL_KEY, ACTIVE, 10.0, PI); // Start sensing for nearby objects
llSetTimerEvent(0.0); // Stop the timer
}

sensor(integer total_number)
{
list detectedObjects = [];
for (integer i = 0; i < total_number; i++)
{
detectedObjects += llDetectedName(i);
}

// Check if all required ingredients are found
integer count = llGetListLength(requiredIngredients);
foundCount = 0; // Reset found count for this sensor event
detectedIngredientKeys = []; // Reset the detected ingredient keys list

for (integer i = 0; i < count; i++)
{
string ingredient = llList2String(requiredIngredients, i);
if (llListFindList(detectedObjects, [ingredient]) != -1)
{
foundCount++;
// Store the key of the detected ingredient
key ingredientKey = llDetectedKey(i); // Get the key of the detected ingredient
detectedIngredientKeys += [ingredientKey]; // Add to the list of detected ingredient keys
}
}

// If all ingredients are found, craft the item
if (foundCount == count)
{
llSay(0, "You have crafted a " + craftedItem + "!");
vector rezPosition = llGetPos() + ; // Adjust the position as needed
llRezObject(craftedItem, rezPosition, ZERO_VECTOR, ZERO_ROTATION, 0);

// Call the function to delete ingredients from the world
deleteIngredients(detectedIngredientKeys);
}
else
{
llSay(0, "You do not have the required ingredients nearby.");
}
}

on_rez(integer start_param)
{
llResetScript();
}
}

// Function to delete ingredients from the world
deleteIngredients(list ingredientKeys)
{
integer count = llGetListLength(ingredientKeys);
for (integer i = 0; i < count; i++)
{
key ingredientKey = llList2Key(ingredientKeys, i);
// Send a message to the ingredient to delete itself
llSay(0, "DeleteSelf"); // This message will be listened for by the ingredient scripts
}
}
like(1)
And sooo now here is the working script !!! The station gives the crafted item into the inventory of the crafter and then deletes the ingredients YAY!! Ingredients and crafted item can be changed in the script though i did try getting Chat GPT to make a config card it would not work for me.

// Crafting Station Script
integer dialogChannel; // Channel for dialog
list recipes; // List of recipes
list requiredIngredients; // Ingredients needed for crafting
string craftedItem; // Variable to hold the name of the crafted item
integer foundCount; // Counter for found ingredients
list detectedIngredientKeys; // List to hold keys of detected ingredients
key crafterKey; // Variable to hold the key of the player crafting

default
{
state_entry()
{
// Define some crafting recipes as a list of lists
recipes = [
"Chair", "Wood1", "Nails",
"Table", "Wood", "Nails",
"Stone Wall", "Stone", "Cement"
];

llSay(0, "Welcome to the Crafting Station! Touch to see available recipes.");
}

touch_start(integer total_number)
{
// Store the key of the player who touched the crafting station
crafterKey = llDetectedKey(0);

// Create a list of crafted item names for the dialog
list itemNames = [
"Chair",
"Table",
"Stone Wall"
];

// Generate a unique dialog channel for this user
dialogChannel = (integer)llFrand(10000); // Random channel between 0 and 9999
llDialog(crafterKey, "Select an item to craft:", itemNames, dialogChannel);
llListen(dialogChannel, "", crafterKey, ""); // Start listening for dialog responses
}

listen(integer channel, string name, key id, string message)
{
if (channel != dialogChannel) return;

// Check if the item is in the recipes list
integer index = llListFindList(recipes, [message]);
if (index != -1)
{
// Get the required ingredients for the selected item
requiredIngredients = llList2List(recipes, index + 1, index + 2);
craftedItem = message; // The crafted item name is the selected message

// Provide feedback on required ingredients
llSay(0, "You need: " + llDumpList2String(requiredIngredients, ", ") + " to craft a " + craftedItem + ".");

// Reset the detected ingredient keys list
detectedIngredientKeys = [];
// Check for ingredients nearby after a short delay
llSetTimerEvent(0.5); // Set a timer for 0.5 seconds
}
else
{
llSay(0, "Recipe not found. Please try again.");
}

llListenRemove(channel); // Stop listening after processing the message
}

timer()
{
llSensor("", NULL_KEY, ACTIVE, 10.0, PI); // Start sensing for nearby objects
llSetTimerEvent(0.0); // Stop the timer
}

sensor(integer total_number)
{
list detectedObjects = [];
list foundIngredients = []; // List to hold found required ingredients
for (integer i = 0; i < total_number; i++)
{
detectedObjects += llDetectedName(i);
}

// Check if all required ingredients are found
integer count = llGetListLength(requiredIngredients);
foundCount = 0; // Reset found count for this sensor event
detectedIngredientKeys = []; // Reset the detected ingredient keys list

for (integer i = 0; i < count; i++)
{
string ingredient = llList2String(requiredIngredients, i);
// Case-insensitive matching
if (llListFindList(detectedObjects, [ingredient]) != -1 ||
llListFindList(detectedObjects, [llToLower(ingredient)]) != -1)
{
foundCount++;
// Store the key of the detected ingredient
key ingredientKey = llDetectedKey(i); // Get the key of the detected ingredient
detectedIngredientKeys += [ingredientKey]; // Add to the list of detected ingredient keys
foundIngredients += [ingredient]; // Add found ingredient to the list
}
}

// If all ingredients are found, craft the item
if (foundCount == count)
{
llSay(0, "You have crafted a " + craftedItem + "!");
// Check if the crafted item exists in inventory before giving it
if (llGetInventoryType(craftedItem) != INVENTORY_NONE)
{
llGiveInventory(crafterKey, craftedItem); // Give the crafted item to the crafter
llSay(0, "Giving " + craftedItem + " to " + llDetectedName(0));
}
else
{
llSay(0, "Crafted item not found in inventory.");
}

// Call the function to delete ingredients from the world
deleteIngredients(detectedIngredientKeys);
}
else
{
// Only announce the found required ingredients
llSay(0, "You do not have all the required ingredients nearby. Found: " + llDumpList2String(foundIngredients, ", ") + ".");
}
}

on_rez(integer start_param)
{
llResetScript();
}
}

// Function to delete ingredients from the world
deleteIngredients(list ingredientKeys)
{
integer count = llGetListLength(ingredientKeys);
for (integer i = 0; i < count; i++)
{
key ingredientKey = llList2Key(ingredientKeys, i);
// Send a message to the ingredient to delete itself without any announcement
llRegionSayTo(ingredientKey, 0, "DeleteSelf"); // This message will be listened for by the ingredient scripts
}
}
liked(1)
Bravo !!! :-)
like(0)
I have been slowly improving it today to :)
liked(1)
You will be a pro before our Leo ;-)
like(0)
No Pro I am using a chat thing haha
like(0)
I saw but only the result counts! ;-)
like(0)
View context
We need more of it in this world for sure! :) :)
like(1)
View context
Its scary what we can do with ai and chat now :) Thanks for giving that a try! I really really appreciate all the help!!
like(0)
well I don't fully understand what you need it to do, but paste the script to it yourself and ask it to modify it according to your needs and see if it can help you :)
like(0)
It did work though :) This is close to what i want !! Say I have an oven that needs to check a box that has cherries, pastry, sugar in it. When it sees that the box does have the items in it the oven will give a cherry pie. Is that possible?
like(0)
Keep in mind that an object cant tell what is in another object directly. The two objects would need to be scripted to communicate with each other.
Anyway you have the link to the chat GPT that i was using. Ask it stuff and see if it can help you do what your trying to do.
like(0)
Thanks so much for your help ill give it a try!!
like(0)