Jump to content

Hello, Can anyone help me? Script to remove item inventory on specific date


Calderita Umia
 Share

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

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

Recommended Posts

Hello, I'm making a script to remove item inventory on specific date, but say "syntax error" and cannot resolve it. I'm beginner for scripts. Please. Thank you!

 

// Delete inventory object on date
default
{
    state_entry()
    {   
        llSetTimerEvent(0.1);
    }

    timer()
    {
        if(llGetDate() == "2023-03-09")
            llRemoveInventory(llGetInventoryName(INVENTORY_OBJECT, 0));
            llSetText("Sorry, You must wait next month to take the gift", <0,1,0>, 1.0);

        else
            llSetText("", <0,1,0>, 1.0);
         
        llSetTimerEvent(3600.0);  // check every hour. 
    }
}

Link to comment
Share on other sites

You need to wrap the contents of the 'if' clause in {brackets} for the else clause to be valid, and for the script to do what you expect. Indentation in LSL is non-functional, unlike some other languages like python. You also will want to add a check to not remove the item if it's already been removed to avoid an error message every hour on the specified day.

 // Delete inventory object on date
default
{
    state_entry()
    {   llSetTimerEvent(0.1);
    }
    timer()
    {
        if(llGetDate() == "2023-03-09")
        {   string item = llGetInventoryName(INVENTORY_OBJECT, 0);
            if(item) llRemoveInventory(item);
            llSetText("Sorry, You must wait next month to take the gift", <0,1,0>, 1.0);
        }else
        {   llSetText("", <0,1,0>, 1.0);
        }
        llSetTimerEvent(3600.0);  // check every hour. 
    }
} 

Also, the LSL library section is the wrong place for this topic, usually specific script help questions go in the LSL scripting forum. (parent of this section). [Thank you moderator for moving it]

Edited by Quistess Alpha
  • Like 3
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 483 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...