I have recently been playing with the free chat GPT 4.0 mini in the duckduckgo search engine to write scripts. I have had some success in getting it to modify scripts or even write them from scratch.
https://duckduckgo.com/?t=h_&q=b&ia=chat
I pasted chat GPT the giver script that Arcfury posted, it give me a rundown of the code and explained it to me. Then I ask it :
"how would i modify this script in such a way that it would check for an object called X and a note card called Y in the objects inventory, and instead of giving the objects, it would say the objects were correctly detected in local chat"
it gave me this new (untested) script:
default
{
touch_start(integer num_detected)
{
string objectName = "X"; // Name of the object to check for
string notecardName = "Y"; // Name of the notecard to check for
integer objectFound = FALSE;
integer notecardFound = FALSE;
integer count = llGetInventoryNumber(INVENTORY_ALL); // Count of all items in prim's contents
string itemName;
while (count--)
{
itemName = llGetInventoryName(INVENTORY_ALL, count);
if (itemName == objectName)
{
objectFound = TRUE; // Set flag if object is found
}
else if (itemName == notecardName)
{
notecardFound = TRUE; // Set flag if notecard is found
}
}
// Check if both the object and notecard were found and send a message to local chat
if (objectFound && notecardFound)
{
llSay(0, "Both the object '" + objectName + "' and the notecard '" + notecardName + "' were correctly detected in the inventory.");
}
else if (objectFound)
{
llSay(0, "The object '" + objectName + "' was correctly detected in the inventory, but the notecard '" + notecardName + "' was not found.");
}
else if (notecardFound)
{
llSay(0, "The notecard '" + notecardName + "' was correctly detected in the inventory, but the object '" + objectName + "' was not found.");
}
else
{
llSay(0, "Neither the object '" + objectName + "' nor the notecard '" + notecardName + "' were found in the inventory.");
}
}
}
I found that if you take baby steps and just focus on adding one thing at a time, and testing that it works as expected before asking it to add more features it can work quite well. Though its not perfect and sometimes it goes down a path it cant recover from. If that happens just fire the conversation and paste the script again and rephrase your question stating the issue and the desired result.
I got it to write me a lap timer script from scratch which keeps track of multiple racers, the current lap time of each racer and also keeps an ordered list of the fastest time per racer. It took many questions and iterations back and forth, but it did something that I couldn't have done on my own.
There are limits on the length of chats and amount of chats per day, so try and be efficient and don't waste questions. Though you can get quite a lot done before hitting these limits.