Jump to content
Sign in to follow this  
varrich Steamweaver

object giver multiple objects Still very new to scripting...:P

Recommended Posts

I know this is a comon program.  I see it used all the time from notecard libraries to food plates that offer 3 or 4 kinds of food.  I have searched hte data base and have not found one.

 

Does anyone know a good program for giving out multiple objects please?  I can easily make a single object giver.  it is the one that gives out multiple objects i keep having problems with.  I would really appreciate help on this. 

Share this post


Link to post
Share on other sites

I'm not sure which option you want.  If you simply want to hand out everything that's in the vendor's contents, use llGetInventoryList.  That will hand th user a folder with everything inside.  See the example HERE.

On the other hand, if you want to put several items in the vendor and give the user a choice of which one to receive, you'll need to build a script that uses a dialog.  If you've never written one before, take a look at the very nice tutorial HERE.  If you are selling the object that the user chooses, the smart thing to do is change to a new state with a money event in it.  Use a pair of global lists to be sure that the name and price of the chosen item are passed to the money event, and then hand over the item with llGiveInventory when the script senses that the correct price is paid.  If you're not selling the item, you can do the whole transaction in one state, just putting the llGiveInventory function in the listen event where your dialog choice is received.

Share this post


Link to post
Share on other sites

my problem is i am very very new scripting...i mean really new....and though i think this is probably not the most difficult script ever written and after the light dawns on me i will be boing and take off and running.

 

this is my idea for the whole long term script.

1 there will be some inventory in the object

2. i want people to make a selction in the inventory

3 when a specific number of obects in the inventory have been given i would like for the object to be deleted with lldie

 

3a also i would like to make a timer that when an object has been around for a certain number of seconds it dies.

 

now i am pretty sure this will be a basic script not too advanced but i must be missing something since i can not seem to get it to work....

 

please help me

 

Share this post


Link to post
Share on other sites


varrich Steamweaver wrote:

my problem is i am very very new scripting...i  i can not seem to get it to work....

 

please help me

 

I CAN get it to work, it won't actually help you that much just to give it to you though, and I haven't got time to write it now.  Tell us WHAT you are having trouble with rather than "I can not seem to get it to work" and we can explain how to go about it.

We all started the same way, don't worry about it.  When you're starting though this is not "a basic script".  It gets complex because you want it to ... and ... and ...   Take it one function at a time and build it up slowly.  Simplest function in your list is die-after-n-seconds: in your default state_entry() put llSetTimerEvent() to set the timer for how long you want.  Add a timer() event-handler and put llDie() in there.

http://wiki.secondlife.com/wiki/State_entry, http://wiki.secondlife.com/wiki/LlSetTimerEvent, http://wiki.secondlife.com/wiki/Timer, http://wiki.secondlife.com/wiki/LlDie

Test it, debug it, test again, repeat ... ask again if you need to.  ... Next thing to look at will be making a menu selection.  Call us back when you're ready, we'll be here :-)

(http://wiki.secondlife.com/wiki/LlDialog, http://wiki.secondlife.com/wiki/Listen, http://wiki.secondlife.com/wiki/LlGiveInventory - although you've already said you're fine with that one)

[i really mean it about building-up slowly.  Programs (scripts) can get very complex but they are never complicated; computers are too dumb to do complicated things]

============================================================================

Your duplicate thread: http://community.secondlife.com/t5/LSL-Scripting/lldie-for-a-noob/m-p/763541/message-uid/763541#U763541

has more posts so I'll ignore this one and answer there from now on

Share this post


Link to post
Share on other sites


varrich Steamweaver wrote:

3 when a specific number of obects in the inventory have been given i would like for the object to be deleted with lldie

 

this brings to mind...just how many seconds can llDie have?

Share this post


Link to post
Share on other sites

I'm not sure what you mean.  Dead is dead. The timer you write determines when the object dies. Once it no longer exists, there is no more.  In this case, it sounds like the OP really wants to delete the object from inventory when he has given out enough copies.  That's not llDie, but llRemoveInventory.

ETA:  Actually, as I reread the OP, it's not clear whether he wants the items in the vendor's inventory to disappear after a number of them have been dispensed, as I thought, or whether he wants the entire vendor to disappear. If it's the first of those, llRemoveInventory is the right choice.  If it's the second, llDie is.  In either case, it's a final action. Once something's gone, it's gone.  :smileywink:

Share this post


Link to post
Share on other sites


Rolig Loon wrote:

The timer you write determines when the object dies

now i understand, thanks Rolig. so just how long a span of time can one set the timer? is there some upper limit for that?

Share this post


Link to post
Share on other sites

Nope.  When you start a timer, you specify llSetTimerEvent(X), where X is a number in seconds. There's a practical limit on how big X can be, because the largest number LSL can handle is 2,147,483,647.  However, there are only 31.2 million seconds in a year, so SL isn't going to be around long enough to hit that limit.

Share this post


Link to post
Share on other sites


Rolig Loon wrote:

Nope....so SL isn't going to be around long enough to hit that limit.

Hehe, very true.  Just in case it were though - note that the timer KEEPS going off every X seconds so you can set it once and have a global variable keep a count of how many times it's been triggered.  Not too useful for measuring periods of over 60 years but it can be very handy for a multi-use timer.  IE; you may have something your script needs to do every second, so you llSetTimerEvent(1.0);  Fine, until you also need to do something every 10 seconds.  You can only have one timer per script, so what do you do?

 

timer(){   ... 1 second stuff ...   if(!(++TimerCounter % 10)){      ... 10 second stuff ...   }}

 

And so on for any other intervals you need.  (NB: it is much more efficient to always set the slowest timer you can, so don't set a 1-second timer just so it can count to 10!)

On the other hand - if you were asking about how long things survived before AUTOMATICALLY being deleted, that's TEMP_ON_REZ and you can't set it; it's "about 1 minute" until SL's garbage collector comes around and removes it.

Share this post


Link to post
Share on other sites

ty i will take it one step at a time.  i keep gettin syntax errors on the menu programing.

 

 

the timer to the killing of the object is actually going to be a little independent program that i want to run.....

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...