Jump to content

lldie() ? for a noob


varrich Steamweaver
 Share

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

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

Recommended Posts

I am new to scripting but i am wanting to create something specific.  I want an object to be deleted with ||die after is has given a set number of things to anyone that touches it.

 

ie.  Avatar A touches the object and gets sample c

and then avatar b touches the object and gets sample q

then the object deletes along with the inventory contents

How would one get it set up to tdo that.  I can do the object givers from the inventory in the object.  I am just not sure how to get it to delete after a set number of objects have been given out.  Can anyone help me?

 

Link to comment
Share on other sites

I would recommend defing a global integer (one defined at the very beginning of the script) for the total number of llGiveInventory functions.  Then each time you you give someone a sample, you increment that variable. 

 

At the end of the event handler that triggers the inventory transfers ( in this case touch) place a simple if statement that will trigger the llDie() once the limit has been reached.  Be sure to place this statement at the end of the event so that the final inventory transfer will be completed.

Example

// really basic cause I'm feeling a bit lazy

integer maxtouch = 5 ; // this sets the total number of touches at 5

integer touchcount = 0;

default

{

     state entry ()

     {

     //blah blah blah... code and stuff...

     }

     touch_start (integer num_detected)

     {

           touchcount ++;  //this increases the integer touchcount by 1

            //  This is where you do all the inventory transfers and whatnot... once you are finished

            if (touchcount == maxtouch) 

            llDie();

       }

}

 

Something like that would work.  Once touchcount = maxtouch, the llDie() will be performed and the item and everything in it will go poof.

Link to comment
Share on other sites

i thought about that...but....i want to limit the number of stuff taken then kill the prim. I am worried htat someone might accidentally touch the prim and not take something and bring up the interger count

 

then the prim would be killed before all that is suppose to come from it comes from it....so i need a way to track the number of times it has given out something....or....because of the nature of the limit of what is in the prim that is being given out. based on the number of stuff left in the inventory...

 

when the inventory is empty in most cases i want the prim killed, but there is a couple of times i want only 1 or 2 things takend then the prim killed.

 

 

Link to comment
Share on other sites

Oh, I see.

In that case you could increment the touchcount integer at the same time you perform the inventory give

ie.

/blah blah blah

 {

       llGiveInventory (stuff...);

       touchcount++;

}

 

That way, it only increases the value of the integer when something is given.   You could still have the same if/then at the bottom of the entire event to clean things up once the proper number of inventory gives was accomplished.

 

 

  • Like 1
Link to comment
Share on other sites

Ok i am still feeling very very frustrated.  from what i am reading it does not sound that hard to put it out, but i am still so new to sl scripting that i am not quite seeing it.  I am getting a lot of the points...but, and forgive my hideous ability to map , this is the map that i basically want.

 

Give inventory from the prim.

the effect would be that when those items are gone the prim is delted into the ether sphere

if 5 objects were given from the inventory

then the object is deleted.

the 3 biggest problems i seem to be having is the beginning the middle and the end.  chuckles...

i know i want a specific number of things to give out.  i have been scouring the web for dialogue menues and i keep coming up wtih syntax error when i code them.  I fear that i am really really lost.  Can anyplease help me work this out...i would really appreciate it....

 

:smileymad: <---------- Frustrated newbie scriptor with a prehistoric brain

Link to comment
Share on other sites

Hello again!

Sorry to hear of your troubles.  Don't feel too bad.  I often wind up screaming "Why wont you work?!?!" at my screen still.

You want to make a script that when touched, puts up a dialog menu that hands out samples?  Do you want the script to hand out only one of each sample or do you want it to hand out a certain number (five) of samples total and then derez?

 

Link to comment
Share on other sites


varrich Steamweaver wrote:

keep coming up wtih syntax error when i code them.  I fear that i am really really lost.  Can anyplease help me work this out...i would really appreciate it....

Right, "syntax error" is better than "can't get it to work".  It means you've typed something wrongly or missed something out and the compiler just can't understand the script.  To work it out ... correct the mistake on the line it tells you.

Now ... if you want some more specific advice - POST THE CODE you have so we can see what is wrong!

Link to comment
Share on other sites

You want to learn how to create a dialog menu?  Take a look at THIS TUTORIAL.  It's about the best one I've seen.

As Peter says, we can't help much without seeing your script.  Off the top of my head, though, the things that most commonly lead to a syntax error are

  1. Forgetting to open and close the scope of an event or condition test with { curly brackets }. It helps to indent each scope cleanly so that you can see where the brackets ought to be.
  2. Having unmatched parentheses (same problem as curly brackets).
  3. Having unmatched quotes around a string (same thing,...).
  4. Using the wrong variable type in a function (an integer where there should be a string, for example).

There are others too, but those four are at the top of my D'uh list. I trip over at least one every day, despite best intentions. The best way to beat them is to be neat and consistent, and to use a good script editor that explains what your mistake was.

 

Link to comment
Share on other sites

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