Calderita Umia Posted March 9, 2023 Share Posted March 9, 2023 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 More sharing options...
Quistess Alpha Posted March 9, 2023 Share Posted March 9, 2023 (edited) 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 March 9, 2023 by Quistess Alpha 3 Link to comment Share on other sites More sharing options...
Calderita Umia Posted March 9, 2023 Author Share Posted March 9, 2023 Thank you so much! 😊 Link to comment Share on other sites More sharing options...
Recommended Posts
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