Jump to content

Trouble with Random Greet Script


Lili Renilo
 Share

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

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

Recommended Posts


Rolig Loon wrote:

...If nothing else, I hope the OP sees that there is more than one way to handle almost any scripting challenge.

I hope this script actually HELPS too, but that was my objective too; there's more than one way to skin a cat.  In fact, sometimes we write things just to try out a different way.  As I said, "then couldn't resist changing the actual greets because, lol, it's the first time I've had a chance to use llRegionSayTo() ^^" :-) My first greeter was just as you say too, if I remember correctly.

@ Lili - please do say if this is confusing more than helping!  We, programmers/scripters collectively, will tend to talk alternatives for ages to try to get a 'best in xxxx circumstances'.  If you don't understand one method it's worse to not understand three different ways at ones but later it helps to put everything in context.  None of this matters in any big way, as long as you can make something work, everyone develops their own style.

@ Everyone else who isn't a regular here - that goes for you too!

Link to comment
Share on other sites

It is very confusing and more often than not I attempt to read it all, then go into panic mode and have to return when I have taken a few thousand deep breaths. LOL

However! When I do return I try to pick apart what the forum is teaching me, some of it I have to accept that I don't understand at this stage. That which I can make sense of, I just throw questions back into the forum about.

This is such an amazing learning curve for me though. A month ago I would never have thought I would be attempting to do anything to a script other than make the regular little adaptations that most people do. I'm both terrified by it and exhilerated at the same time. If I can achieve anything in this area, it will be so liberating as I can begin to use it alongside my building skills but even more so I will be beginning to learn a new skill in secondlife.

So... for now I am in panic mode but I will read through all the posts again shortly and no doubt ask more about them :)

Thanks, Lili

Link to comment
Share on other sites

Ok... lots of ways and ideas to take in. I think at this point I need to refocus on my original intention for this script and clarify it on the forum. Although I have been working on a greeter based script, my purpose isn't exactly to use it as a traditional greeter. The whole reason I got into scripting is because of a recent creation in Secondlife. I wanted an object to be able to 'make jokes' or 'witty comments' as an avatar passed by. This could be used in the context of a store front for a bit of fun for the customers, or within a roleplay sim, or at a party. So... I am partly doing this now to get my head straight:

1) Senses avatars in close range, ever 5 seconds because I don't want it to miss the entry of someone.

2) Have they heard a joke in last 6 hours?

3) Crack a joke in local chat so that anyone around can also hear.

4) Don't repeat to listed avatars for 6 hours. Keep scanning ever 5 seconds.

I keep coming up with new requirements as I tinker with the scripts.

-I want it to check for avatars every 5 seconds but I don't want it firing jokes any more than every 1-2 mins because if someone was still standing there as others arrived they would get bombarded. So even though it is sensing, how do you control how often it fires out the randomsay?

-If five avatars are standing there, it makes sense they should all hear the same joke rather than 5 jokes all at once.

I'm getting lost somewhere between my purpose and the endless scripting options. Maybe this is where I should take on board the idea suggested where it speaks directly to one avatar (regionsayto)? What are people's thoughts?

 

Link to comment
Share on other sites

for the questions, when you do a detection you can compare the current time to a saved time. if it's greater than the limit record all present avatars and then say the line and record the time (llGetUnixTime or llGetTime and llResetTime would be useful here), if it's less do nothing.

 

and you don't need to scan directly on a frequent time basis IF there is a set teleport location.... because you can use llVolumeDetect on an object theyd come into contact with.

 

Link to comment
Share on other sites


Lili Renilo wrote:

What are people's thoughts?

 

  1. As long as it's two steps forward and only one step back you're winning - pah!  "if(Advance > Retreat){Win();}" :-)
  2. Yes, as you become more familiar, or even aware of, what can be done and how new ideas present themselves
  3. Verifying what you've done/found so far and clarifying the objectives are iterative.  "Old School" IT managers used to think it was define -> plan -> write.  Now we just go round in circles all the time "getting closer" until everyone's had enough.

For what you're saying so far:

  • Sense every 5s to make sure you don't miss arrivals (done it)
  • "Do something" if someone's there who hasn't heard a joke in 6 hours (variation of what we've done)
  • Don't "do something" if anyone's still there for the next couple of minutes (suggest state-change)

Since the 'do something' you want is telling a joke and you'll want to have several jokes and they'll each be rather longer than 'hi' I suggest storing them a notecard or several notecards.  Imagine - you have the script and a 'joke book' notecard in the object's contents.  Each joke is written on a single notecard line.  The script knows how many lines/jokes there are in the notecard and selects one at random just as you were doing before for entries in the list (make a random integer between 0 and max).

Each notecard line is limited to 255 bytes, which may not be enough.  You could use formatting to have multi-line jokes in a single notecard but it would probably be simpler to have one joke per notecard and lots of notecards.  llGetInventoryNumber(INVENTORY_NOTECARD); will tell you how many you've got, you still pick a random number in exactly the same way, then chat the contents of that notecard.

So now I'll write a two-state, notecard-reader.

Link to comment
Share on other sites

Aha!  Yes, even if a person isn't getting a personal greeting over and over again, she'll get annoyed if she can hear other people being greeted.  Or hearing the same joke.  There are two ways around it.  One is to give the greeting or tell the joke in private (as an IM or llRegionSayTo message).  The other is to change the logic of the script so that it won't read the same line if anyone within hearing range is likely to have heard it recently.  If this were a greeter, I'd go with choice #1. Frankly, though, jokes told in private never have as much punch as ones told in a crowd, so for your application I'd opt for the second choice myself.

I like Peter's idea of using a notecard reader to give the script a larger pool of jokes to tell. With just a little bit of filtering, that would reduce the possibility of hearing the same joke twice by quite a bit.  It's a lot easier than constantly checking everyone within chat distance to see if they've heard the joke before, although that's still another possibility.  So is your idea of telling a new, random joke every 1 or 2 minutes, but only if a new visitor has stepped within range. ...

if ( Has it been 2 minutes yet?)

{

    if( Is there a new avatar standing here?)

   {

        if( Is this avatar someone I haven't seen for at least 6 hours?)

        {

            if( Has it been at least 24 hours since I told this randomly selected joke?)

            {

                llSay(0, Joke);

            }

        }

    }

}

Link to comment
Share on other sites

Wow I learn so much in every post written back to me, it's so vast and incredible. I didn't realise that the possibility even existed to speak directly to an avatar without it being via IM. I hadn't even considered some of the options presented to me like expiring visitor lists. It might seem an OTT statement but I really feel like I am awakening a whole different area of my brain LOL. I have never thought this way round about anything.

AND much as it is making me cringe right now after all the input and guidance everyone has given me on that particular script... my re-focusing on my purpose has made me look at this in a totally new light and now I think I need to start back from scratch on this script. The way I am seeing it right now, is that for this purpose maybe I don't need to use an avatar sensor as a fire for the jokes. Maybe I should be looking in a different direction. I am thinking that the jokes should perhaps come at their own time intervals. Perhaps with a collision or sensor on/off function so that it isn't saying them when noone is within chat range.

1) Collision/Sensor avatar in 5m range = on

2) Say joke in local chat and then after every Xmins (havent yet decided what amount would be non-irritating)

3) No avatars detected = off

Need to think this through a little more. Thanks to everyone for helping me on this path... and please don't hate me for my sudden u turn :)

Link to comment
Share on other sites

Thank you Rolig. I think I must have been typing my post as you posted your's. I hadn't seen it. I think I need to stop and think this all through now. So many possibilities and I now need to work out which direction to take. I like your idea and I agree the jokes need to be said out to the crowd, else it loses its punch.

Link to comment
Share on other sites


Lili Renilo wrote:

Need to think this through a little more. Thanks to everyone for helping me on this path... and please don't hate me for my sudden u turn
:)

I said earlier that becoming familiar with the tools of scripting - the language you're using - makes more options and possibilities apparent but isn't all there is to programming.  What you're talking about now is analysis and design; the harder part of really thinking-through what is required when and putting that all together to make a specification of what the script/program has to do.

RL software professionals usually start as programmers (aka coders) to understand the technicalities and what the industry is all about.  Practice makes perfect for coders - write as many programs to do as many different things as possible.  Perfect fluency in your chosen programming language(s) is the ideal.   An inexperienced coder makes mistakes like "if(this = that)" (should usually be '==').  We discuss and assist with coding most of the time here.

Analysts need to find out what the requirements of the programme are; functionality, speed, colours even. They need a combination of people skills and logic in order to understand what people want, how things will be used and what the technical implications of that are.  This is the bit you're currently stuck on :-) Don't worry, when you find analysis easy you'll be earning a fortune.  Bad analysts result in programmes no-one wants to use.  Apart from bouncing ideas off each-other there isn't much we can do to help with analysis, it's necessarily mostly 'pre-technical'.

Designers/architects tend to be the senior coders without the people-skills to be analysts (just kidding, partly).  Turning analysts' requirements into coders' specifications requires uber-geek technical skills.  These goes beyond the coders' language skills to include the whole technical and operating environment in which the program will be developed and used.  "LSL scripts compiled in LSO rez quicker than MONO ones so are better for sim-crossings and bullets" is an example.  The danger with designers is that they can be dogmatic that the way they learnt to do things is the way things have to be done.  Notice that we have already actively looked for alternative approaches here :-)

Link to comment
Share on other sites

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