Jump to content

Desginated Rez Script. Help Please


Major Monk
 Share

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

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

Recommended Posts

I have a script that I have been working on and I am at a loss. What the script is to do is scan the area around the Main object (call it MObject) for a second object (call it Kelp). Now Kelp is an object that has a script in it to do certian things for so long and then it automaticly disapears. Then MObject comes up with a scan that shows that it is no longer present. Once it finds out it then rezzes a brand new Kelp in that scan area.

So here is the problem, I have the scan down, I can get it to rez a new Kelp. Problem is, is that when I put the multi Kelp objects into the MObject it changes the name from Kelp to Kelp 1. Well I know that either I need to have the code look for an object in inventory called Kelp*.* or I need to have an if statement that tells it to rez Kelp and if thats not in the inventory then rez Kelp 1 etc etc. 

Here is the rez line that I am using.

llRezObject("kelp", llGetPos() + <0, 0,.5>, ZERO_VECTOR, ZERO_ROTATION, 42);

Can anyone give me a means of re writing that so that it will work?

I have been reeding pages upon pages or code that looks at strings and things being said in local and I can not see how any of that can help.

Link to comment
Share on other sites

If 'Kelp' is copyable then you only need to have one of it in MObject's contents - it will rez a copy and still have the original.  Spelling and Capitalisation is VERY important though - "kelp" will not match "Kelp", so check that.

If Kelp is not copyable then, yes, you'll need to check exactly what is in contents.  The easiest situation there is if Kelp is the only (type of) object that will be in contents, then you can use:

no_sensor(){	if(llGetInventoryNumber(INVENTORY_OBJECT)){		// If there are any objects in contents (which will be Kelp*) then rez the first one		llRezObject(llGetInventoryName(INVENTORY_OBJECT, 0), llGetPos() + <0, 0,.5>, ZERO_VECTOR, ZERO_ROTATION, 42);	}}

 

Link to comment
Share on other sites

If there are other objects in MObject's contents, then you'll want a way to ignore them as you rez each no-copy "kelp".  One way to do that might be to write

 

	no_sensor()	{		integer Num = llGetInventoryNumber(INVENTORY_OBJECT);		integer count = 0;		while(Num-count)		{			if (llToLower(llGetSubString(llGetInventoryName(INVENTORY_OBJECT,count),0,3)) == "kelp")			{				llRezObject(llGetInventoryName(INVENTORY_OBJECT, count), llGetPos() + <0, 0,.5>, ZERO_VECTOR, ZERO_ROTATION, 42);				return;			}			++count;		}	}

 

 

Link to comment
Share on other sites

assuming the no-copy model

	no_sensor(){
integer vIntCnt = llGetInventoryNumber( INVENTORY_OBJECT );
do{ //-- gStrSearch will be needed to keep track of the name for the next sensor call
if (!llSubStringIndex( gStrSearch = llGetInventoryName( INVENTORY_OBJECT, --vIntCnt ), "kelp" )){
llRezObject( gStrSearch, llGetPos() + <0.0, 0.0, 0.5>, ZERO_VECTOR, ZERO_ROTATION, 42 );
//-- start the new sensor here? or use the time event to call it with gStrSearch
return;
}
}while (vIntCnt);
//-- stick a message here about being all out of kelp....
}

 

assuming of course that's the problem....

or maybe OP is looking to have MObject rez multiplecopies of "kelp" at once.... in which case, a larger object linked together named kelp with multiple prims could work, or, if those must remain separate, then rez a whole bunch, then select them all and "take" and put that coalesced object in MObjects contents to rez (so each rez is multiple pieces). copiable, Pete suggested.

if there are supposed to be multiple pieces out at once those are the best methods, but as long as the number is supposed to be below 17, you could search for "kelp" and if the sensor returns less than 16, rez one at a random position and sense aagain, so that you had a near constant number of them rezzed.

Link to comment
Share on other sites

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