RoboGrip Posted September 29, 2013 Share Posted September 29, 2013 I am very new to LSL but have programmed in the past so I am learning fast. I have an object read out a persons name along with some other stuff when they are in range and this sensor is on repeat every 3 seconds. If someone stands too close for too long it will spam chat with text . I like the sensor how it is because I have it making the object do other things as well as read out text. My question is, is there a way to make the script not say anything if it is about to repeat the same characters? If I could make them write the names in a notecard and have it check the notecard before it types anything I would.Could I asign that last thing it said to a string and make it check the string before "speaking" again? Link to comment Share on other sites More sharing options...
Adromaw Lupindo Posted September 29, 2013 Share Posted September 29, 2013 RoboGrip wrote: Could I asign that last thing it said to a string and make it check the string before "speaking" again? You can assign strings to a variable. You can test the contents of a variable. Yes. Link to comment Share on other sites More sharing options...
Dora Gustafson Posted September 29, 2013 Share Posted September 29, 2013 It looks to me you are trying to make a 'Greeter' By all means do that:) We have all done that I guess and it is instructive To get your questions answered I recommend you read a few of the many Greeter scripts published in the libraryThis for example I am not saying you should copy any of the scripts It is the easiest thing to do, but you won't learn much from it :smileysurprised::smileyvery-happy: Link to comment Share on other sites More sharing options...
steph Arnott Posted September 29, 2013 Share Posted September 29, 2013 I wrote this for a previous question, but the principle is the same. So a few mods will do what you want. integer card;list cardlist=[];integer limit = 10000; // <- bytes This was only for this script.default{ changed(integer ch) { if(ch&CHANGED_OWNER) { llResetScript(); } } on_rez(integer num) { llResetScript(); } state_entry() { llSetMemoryLimit(limit);//No point waisting resorces } touch_start(integer total_number) { card = (integer)(llFrand(50));//This you have to change if(~llListFindList(cardlist,(list)card))//Search to see if card is in the memory { llSay(0,(string)card+" You got a match, card number is "+(string)card);//I would keep this as a debug } else { llSay(0,"card number is "+(string)card);//There was no match in the memory, so your message would go here cardlist += card;//Add card to list cardlist = llListSort(cardlist, 1, TRUE);//I just like neatness } }} 1 Link to comment Share on other sites More sharing options...
RoboGrip Posted September 29, 2013 Author Share Posted September 29, 2013 Thanks a bunch! It's funny really I was trying to do something similar last night before I got frustrated and went to bed but what you have makes sense. It might take me some fooling around to get what you have here to work for me but that's where learning and fun happens. Link to comment Share on other sites More sharing options...
Innula Zenovka Posted September 29, 2013 Share Posted September 29, 2013 The way most people make greeters and the like is to have the script keep a list of people it's greeted, and check anyone it detects against that. If their uuid isn't on the list, greet them and add it to the list, so you don't keep on greeting them. If it is, ignore them. You then have to think of how to remove them from the list (e.g. check every so often and remove from the list people who are no longer on the sim) so you can greet them on their next visit and so you don't run out of script memory. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now