Jump to content

Sit & give object (with time settings)


Arabelaska
 Share

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

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

Recommended Posts

Hello, I have a script from friend that gives object to avatars upon sitting. She helped me to set up a freebie game for our visitor. Anyway, it's not quite a script that I am looking for. It does it work to give object upon sitting(right away) I prefer it to give object after time pass by a bit like 30 or 60 seconds for an example. You know, not right away. Some of our freebie game is something like riding a mad cow and to not fall out. It should not give object or gift right away when avatar sits


Thanks in advance if anyone can help me to edit this given script. We'd be really appreciate. We don't know how to add time settings here.

string itemname = "item name to give here between quotes";

default
{
changed(integer change)
{
if(change & CHANGED_LINK)
{
integer links = 0;
if(llGetObjectPrimCount(llGetKey()) < (links = llGetNumberOfPrims()))
{
llGiveInventory(llGetLinkKey(llGetNumberOfPrims()),itemname);
}
}
}
}
Link to comment
Share on other sites

We will not write a script for you in this forum.  You'll have to post in the InWorld Employment forum to hire a scripter if you are not able to do the work yourself.  This particular script would not be difficult to change, though, so I am sure that you can manage it if you have any basic skills at scripting.  All you have to do is take the inner few lines of the changed event (the lines in the block after if (change & CHANGED_LINK) ) and put them in a timer event instead. Replace them in the changed event with the trigger that starts the timer ( llSetTimerEvent(30.0); or whatever). Don't forget to turn the timer off after it is triggered, or it will continue to give gifts over and over again.  Review how a timer event works at http://wiki.secondlife.com/wiki/Timer .

That little script is a bit awkward, BTW.  It will work, but it assumes that the object it's in is actually sittable.  Because it doesn't define a sit target, though, you may get an error message ("No room to sit") if the object is hard to sit on.  It would have been wiser to define a sit target and then use llAvatarOnSitTarget as the test to see whether someone has sat down.

Link to comment
Share on other sites

Thanks for explaining. I am sorry I didn't know that I posted to get help in the wrong forum. I saw people asked for help with the script editing and writing here. That was why I also posted it here.  I thought people discussed here to get help. No?

I know so little about the script but I will try the link that you guided here. Thanks for that, too.

Link to comment
Share on other sites

It's a tricky balance.  The LSL Scripting forum is a place for scripters to share insights and worries about scripts that they are writing themselves. We will very ofen respond to each other by posting incomplete scripts or snippets of code to illustrate different approaches to a problem, or as we disagree about which solutions are best. Or we will do as I did above by suggesting a good place to start.  We'll point to resources like the LSL wiki where the OP can find the details or other examples.  The goal is not to solve each other's problems or write each other's scripts, but to help other scripters learn how to do things for themselves.  (As a secondary concern, there are plenty of amateur scripters in SL who will look to the InWorld Employment forum as a way to get small scripting jobs. We would undercut their opportunities by providing free scripts here. In my own mind, that's a much less important goal than education is, but it's one that some scripters do raise from time to time.)

Link to comment
Share on other sites

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...