Jump to content
Sign in to follow this  
ZachMatheson

Disallowing two (or more) of the same object

Recommended Posts

Hi Team,

 

I wonder if someone could point me in the right direction here.

I have an object that avatars are supposed to attach to their skull.

If they attach multiple of these objects across their body, what is the easiest way for me to detect the extra objects so I can call a llDetachFromAvatar to remove them?

Share this post


Link to post
Share on other sites

I would decide on a specific word, outside of any other commands you might use for it, and have it say it on attach/rez.

It would also listen for the same word. If one is attached, and hears the word from a second one, it can respond with another word to let it know it was there first

  • Like 1

Share this post


Link to post
Share on other sites

Or it could detach the moment it hears the word. Only one attachment would remain.

If it is the one attached to the skull is another question:smileyhappy:

:smileysurprised::):smileyvery-happy:

 

Share this post


Link to post
Share on other sites

Was thinking like a "Marco"-"Polo" type game

 

llGetAttachedList could work too if the object is no mod to where the name/description can't/won't be changed.

In that case I would put some identifying name/number to look for in the description field

You could use llGetObjectDetails and run through the list of attachments and get their descriptions. If one or more has the same identifying string, then it's a match and they already have the attachment attached

 

Share this post


Link to post
Share on other sites

How about the item, on attaching, opens a listener and asks "Am I the first?"     If it receives a reply, it detaches itself.   If it doesn't, when it receives the question "Am I the first" from an item belonging to its owner, it replies "Nope!"..

integer iItemChannel;key kOwner;default{	attach(key id)	{		if(id){			kOwner = id;			iItemChannel = (integer)("0xF" + llGetSubString(kOwner,0,6)) - 150;			llListen(iItemChannel,"","","");			llRegionSayTo(kOwner, iItemChannel, "Am I the first?");		}	}	listen(integer channel, string name, key id, string message)	{		if(llGetOwnerKey(id)==kOwner){			if("Am I the first?" == message){				llRegionSayTo(id, iItemChannel, "Nope!");			}			else if ("Nope!" == message){				llRequestPermissions(kOwner, PERMISSION_ATTACH);			}		}	}	run_time_permissions(integer perm)	{		//etc	}}
  • Like 1

Share this post


Link to post
Share on other sites


wherorangi wrote:

i would probably look at using llGetAttachedList on attach

then read some unique property of any attachments with the same name 

 

I would try wherorangi's approach first personally. Even as basic as the same name. The first one will never find a duplicate. The second one would. The only time I can figure we'd have more than two is an Add race. They only need to find one other to detach.

Share this post


Link to post
Share on other sites

Yes, of course.  If you're in a no-scripts area, all sorts of schemes fail.  Nothing else in the script will work either.

Share this post


Link to post
Share on other sites

anti-gamification measures are a pretty deep subject and lots depends on how the game is constructed

anti-gamification measures are pretty much all about non-trust

the game server never accepts/trusts what a player tells it without a independent way of verifying what it is told. Typically by monitoring the players actions as they play to earn the gameplay points/tokens/etc

  • Like 1

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...