Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

One & only one landmark

Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
02-05-2008 05:07
I'd like to get people's opinions on how to best approach this. My object needs to end up in a state where it has one and only one landmark in its inventory. I want the owner to be able to manage this by just dropping a landmark onto the object IN ONE STEP. Here are my thoughts about it.

Case 1: No landmarks
Warn the owner to drop a landmark into it

Case 2: Already has a landmark in it
Owner drops in only one landmark. Remove the old one and replace it with the new one. If the two happen to be identical, remove one of them.

Owner drops more than one landmark into it. Since the object does not know which one to keep, it should reject all the new ones and keep the old one and warn the owner. If one or more of the new batch happens to be the same as the existing one, delete all the copies keeping only one.

I need to compare both the name and location of the landmark necessitating llGetInventoryName calls followed by llRequestInventoryData calls if the names are the same.

All of this is rather complicated. Since I know I have a tendency to make things more complicated than they have to be, I was wondering if anyone had any ideas on how to simplify this.
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
02-05-2008 10:57
it might be easier to just have it delete the old one and replace it with the new one. Or have it reject new landmarks, and have it only accept a new one if you delete the old one first.

if it finds 1, it records the name
if it finds more than one, it deletes all that don't have the recorded name
if it finds 0, it asks for a landmark

This could create a condition where it has no recorded name and finds several landmarks, but it's unlikely. in that stuation you could have it delete all, or have it delete all but the first one alphabetically.

Or you could do what I do, and only work with the "first" one it finds. so if there's more than one it ignores all the ones after the first.
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
02-05-2008 12:10
I don't want the owner to first have to delete the old landmark before dropping in a new one. I want this to be one simple operation.

After writing the initial post I also thought of your idea of just using the first new one if a whole batch is dropped in, and warning the owner accordingly. I'd want it to delete all the others however. That could simplify the complication of dealing with multiple drops at once.

I'd be interested in hearing how others deal with this too.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
02-05-2008 18:07
something like

check for landmarks
if landmarks == 1, store it's data, then delete it
else if landmarks > 1 either choose one, or reject them all

if there is no stored landmark data, request it.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
02-05-2008 18:14
Deleting the landmark may not be the right thing to do. What if the object is going to hand out the landmark, rather than mapping the location or outputting the data?

I'd say keep the key (and the data if you want) of the old landmark. If there are only two, delete the old. If multiple are added, select a random one to keep (if there was an old landmark, exclude it from the results).

CODE

while (llGetInventoryKey(INVENTORY_LANDMARK, 0) != keepKey)
{
llRemoveInventory(llGetInventoryName(INVENTORY_LANDMARK, 0));
}
while (llGetInventoryNumber(INVENTORY_LANDMARK) > 1)
{
llRemoveInventory(llGetInventoryName(INVENTORY_LANDMARK, 1));
}
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
02-05-2008 19:18
good point, perhaps then something more like,

if landmarks
_if landmarks < 3
__if landmarks == 1 then store
__else delete stored, store remaining
_else delete all but stored and warn
else request landmark
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
02-05-2008 19:19
Interesting ideas. I don't need the landmark after I extract its location so the "delete them all" approach would likely work. I'd have to store it persistently though an probably could use the description field for that.

I'm not sure how the landmark key would work? Does a new key get assigned when you drop it into the object or do all such instances keep the key of the landmark in your inventory. What if I give the landmark to someone else? Does the key change? When can I count on the key in the object being the same as the one from which it was derived from your personal inventory?
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
02-05-2008 21:56
Huh. I believe landmarks are read-only, so it might keep the same key. Worth experimenting with though, cause I'm really not sure.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
02-06-2008 03:36
easy enough to test, open you inventory, and try to get the uuid for a few of them.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -