Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Multi Pose script problem. mistaken identity?

Blaze Nielsen
Registered User
Join date: 24 May 2005
Posts: 276
08-02-2008 09:27
MLPv2 by Lear Cale has some nice new functionality. One problem is, when a customer clicks on furniture using this multi pose script, and buys a copy, the original thinks its being sold and requires a restart. So, the original sits in store with no poseballs until it gets restarted, which can take a while with all the poses I'm using.

The big problem is, customers clik, they get no pose balls, they think the item is busted and walk away. Eventually it loads, but its too late.

Included here is the ownership scripting, anybody have a thought on how to fix it? thanks



integer RetryCount;

setScript(string script, integer st) {

// if we've already timed out, forget it
if (RetryCount == 0) {
return;
}

// give object contents time to appear in inventory after shift-copy
for (; RetryCount; --RetryCount) {
if (llGetInventoryType(script) == INVENTORY_SCRIPT) {
llSetScriptState(script, st);
return;
}
llSleep(0.1);
}
llOwnerSay("Scripts missing. Add scripts and use 'Tools -> Reset Scripts in Selection'.";);
}

setRunning(integer st) {
RetryCount = 200;
setScript("~menu", st);
setScript("~menucfg", st);
setScript("~pos", st);
setScript("~pose", st);
setScript("~poser", st);
setScript("~poser 1", st);
setScript("~poser 2", st);
setScript("~poser 3", st);
setScript("~memory", st);
if (llGetInventoryType("~tch_passer";) == INVENTORY_SCRIPT) {
llSetScriptState("~tch_passer", FALSE); // if it's in same prim, turn it off because it's no use
}
if (RetryCount) {
llResetOtherScript("~memory";);
llResetOtherScript("~menu";);
}
}

default {
state_entry() {
setRunning(FALSE);
llOwnerSay("OFF (touch to switch on)";);
}

touch_start(integer i) {
if (llDetectedKey(0) == llGetOwner()) state run;
}

// Waits for another script to send a link message.
link_message(integer sender_num, integer num, string str, key id)
{
if (str == "PRIMTOUCH";){
if (id == llGetOwner()){
state run;
}
}
}

changed(integer change) {
if (change & CHANGED_OWNER) {
llResetScript();
}
}
}

state run {
state_entry() {
llOwnerSay("MLPV2: MULTI-LOVE-POSE (version 2.0)";);
setRunning(TRUE);
}

changed(integer change) {
if (change & CHANGED_OWNER) {
llResetScript();
}
}
}
_____________________
Visit Bartlett & Nielsen furniture - two full sims of elegant furniture, prefab homes and more. Plus, Virgin Isle Marina - sl's largest luxury yacht and boat marina.
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
08-02-2008 11:01
Blaze you missed Lear by 1 day: he just left for RL holiday for 2 weeks.

You write "when a customer clicks on furniture using this multi pose script, and buys a copy, the original thinks its being sold."

I've never sold anything direct like that, only through vendors. Wonder why the original thinks it is being sold when you have it set to copy? (Others will be able to answer this; I have no experience as I say with this type of vending.)

p.s. Is that MLP 2.0 you're talking about, or 2.1?
_____________________
Thread attempting to compile a list of which animations are freebies, and which are not:

http://forums.secondlife.com/showthread.php?t=265609
Desiree Bisiani
Furniture Designer
Join date: 25 Nov 2006
Posts: 189
08-02-2008 11:37
I had the same issue with MLPv2.0 but MLPv2.1 seems to be fine.
Blaze Nielsen
Registered User
Join date: 24 May 2005
Posts: 276
Version 2.0
08-02-2008 11:37
going to look for 2.1, see if it is coded the same.
_____________________
Visit Bartlett & Nielsen furniture - two full sims of elegant furniture, prefab homes and more. Plus, Virgin Isle Marina - sl's largest luxury yacht and boat marina.
Blaze Nielsen
Registered User
Join date: 24 May 2005
Posts: 276
mlpv2.1 ?
08-02-2008 11:42
From: Desiree Bisiani
I had the same issue with MLPv2.0 but MLPv2.1 seems to be fine.



Hi Desiree, Lear Cale has the 2.0 version on slex, where did you get the 2.1 version
_____________________
Visit Bartlett & Nielsen furniture - two full sims of elegant furniture, prefab homes and more. Plus, Virgin Isle Marina - sl's largest luxury yacht and boat marina.
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
08-02-2008 11:56
From: Chaz Longstaff
Wonder why the original thinks it is being sold when you have it set to copy?
Because changed( CHANGED_OWNER ) is raised in an original object when a copy is sold (and in the copy the first time it's rezzed.)



The reset of the showroom model can be avoided by saving the "original" owner's key to a global variable in default state_entry, then in the changed event handler, test if llGetOwner() actually differs from this saved value before resetting.
Blaze Nielsen
Registered User
Join date: 24 May 2005
Posts: 276
2.1 is the winner
08-02-2008 13:05
the new version 2.1 fixes the problem it works fantastic, thanks Chaz
_____________________
Visit Bartlett & Nielsen furniture - two full sims of elegant furniture, prefab homes and more. Plus, Virgin Isle Marina - sl's largest luxury yacht and boat marina.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-02-2008 14:09
From: Deanna Trollop
Because changed( CHANGED_OWNER ) is raised in an original object when a copy is sold (and in the copy the first time it's rezzed.)



The reset of the showroom model can be avoided by saving the "original" owner's key to a global variable in default state_entry, then in the changed event handler, test if llGetOwner() actually differs from this saved value before resetting.

Interesting. However, that page is utterly wrong on at least one point: "CHANGED_OWNER...is triggered...in the original object when a user takes the object or a copy of the object." I can absolutely guarantee you that when you take an object into inventory it does not get a changed/CHANGED_OWNER event.
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
08-02-2008 15:06
From: Hewee Zetkin
Interesting. However, that page is utterly wrong on at least one point: "CHANGED_OWNER...is triggered...in the original object when a user takes the object or a copy of the object." I can absolutely guarantee you that when you take an object into inventory it does not get a changed/CHANGED_OWNER event.


the official wiki is more circumspect about the matter : https://wiki.secondlife.com/wiki/Changed "The owner of the object has changed."

So what exactly will cause the event to trigger then?
_____________________
Thread attempting to compile a list of which animations are freebies, and which are not:

http://forums.secondlife.com/showthread.php?t=265609
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-02-2008 15:18
From: Chaz Longstaff
the official wiki is more circumspect about the matter : https://wiki.secondlife.com/wiki/Changed "The owner of the object has changed."

So what exactly will cause the event to trigger then?

Well, AT LEAST buying the original object in-world should do it. Also buying, taking a copy, and being given an instance from inventory should cause it to trigger as soon as the object is rezzed. Certainly a COPY of the object being taken/bought does not fall under that description for the original object that retains its owner in-world. But the actuality of it I don't know about; this may deserve a JIRA bug if CHANGED_OWNER fires when the owner of the object the script is in DOESN'T change, though I know a lot of people might be up in arms if they've made their applications dependent upon buggy behavior. Always love that. :rolleyes:
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
08-02-2008 15:39
From: Hewee Zetkin
Well, AT LEAST buying the original object in-world should do it. Also buying, taking a copy, and being given an instance from inventory should cause it to trigger as soon as the object is rezzed. Certainly a COPY of the object being taken/bought does not fall under that description for the original object that retains its owner in-world. But the actuality of it I don't know about; this may deserve a JIRA bug if CHANGED_OWNER fires when the owner of the object the script is in DOESN'T change, though I know a lot of people might be up in arms if they've made their applications dependent upon buggy behavior. Always love that. :rolleyes:


I'll try to test it sometime this weekend in world; thank god for the long weekend and the extra time!
_____________________
Thread attempting to compile a list of which animations are freebies, and which are not:

http://forums.secondlife.com/showthread.php?t=265609
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
08-02-2008 16:19
Well here's what I found in 3 minutes of testing. Greater minds than mine will understand it. Point 11 makes sense to me.

The others don't, as it appears the original object (which I isolated by UUID) is telling you that its ownership changed, which it has not.

1. Plop this test Script into a prim:

CODE

default{
state_entry(){
llSay(0, "For object: " + (string)llGetKey() + " the owner at start is " + llKey2Name(llGetOwner()) );
}


changed(integer change) {
if (change & CHANGED_OWNER) {
llShout(0, "Owner has apparently changed and is now " + llKey2Name(llGetOwner()) + " for object: " + (string)llGetKey() );
}
}
}


2. Object says: "For object: 67e066e8-0836-ac37-829f-e8a71a811004 the owner at start is Chaz Longstaff"

3. Set it for sale, copy, 0 Lindens.

4. Have someone buy it.

5. Object says: "For object: 67e066e8-0836-ac37-829f-e8a71a811004 the owner has apparently changed and is now Chaz Longstaff."

Yet, the owner for 67e066e8-0836-ac37-829f-e8a71a811004 did *not* change.


6. Set the object to allow anyone to copy.

7. Have someone take a copy

8. Object says: "For object: 67e066e8-0836-ac37-829f-e8a71a811004 the owner has apparently changed and is now Chaz Longstaff"

9. If you as the owner take a copy into your inventory, the object says nothing; it remains silent.

10. Pass that copy to someone else; have him/her rez it.

11. Object says: "For object: e485a566-b666-f3c7-2a3e-81abb50d5ee4 the owner has apparently changed and is now Maria Pigglywink."
_____________________
Thread attempting to compile a list of which animations are freebies, and which are not:

http://forums.secondlife.com/showthread.php?t=265609
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
08-02-2008 16:32
From: Hewee Zetkin
"CHANGED_OWNER...is triggered...in the original object when a user takes the object or a copy of the object." I can absolutely guarantee you that when you take an object into inventory it does not get a changed/CHANGED_OWNER event.
That line is probably just badly worded, referring to group-owned objects being taken/copied by members of the group. (I'm assuming, since only avatar->group ownership change is explicitly addressed in that table, and it does work the other way as well.)
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
08-02-2008 18:13
From: Hewee Zetkin
Interesting. However, that page is utterly wrong on at least one point: "CHANGED_OWNER...is triggered...in the original object when a user takes the object or a copy of the object." I can absolutely guarantee you that when you take an object into inventory it does not get a changed/CHANGED_OWNER event.


http://www.lslwiki.net/lslwiki/wakka.php?wakka=changed

It would appear that the page may be right about this: "CHANGED_OWNER...is triggered...in the original object when a user takes the object or a copy of the object." That's what happened to me, in any event.

I can't see, though, where you say you saw this: "when you take an object into inventory it does not get a changed / CHANGED_OWNER event."
_____________________
Thread attempting to compile a list of which animations are freebies, and which are not:

http://forums.secondlife.com/showthread.php?t=265609
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
08-02-2008 18:35
From: Chaz Longstaff
I can't see, though, where you say you saw this: "when you take an object into inventory it does not get a changed / CHANGED_OWNER event."
That was his own comment, not a quote from the page.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-02-2008 23:21
Right. I was saying that at LEAST that part of the documentation on the page is wrong. And your #9 confirms it. Maybe it is just badly worded. I don't know.

I think some of the other behavior you see should be considered a defect, though lslwiki.net has successfully described that defective behavior as it exists. If a changed/CHANGED_OWNER event happens on an object, it should be that THAT OBJECT'S owner has changed, not that there might be another copy of the object with a different owner now (the new object should get the changed event at some point, of course). The following should always print "Yes":

CODE

key owner = NULL_KEY;

default
{
state_entry()
{
owner = llGetOwner();
}

changed(integer changes)
{
if (changes & CHANGED_OWNER)
{
key newOwner = llGetOwner();

string ownerHasChanged;
if (newOwner != owner)
{
ownerHasChanged = "Yes.";
} else
{
ownerHasChanged = "NO!";
}

llSay(0,
"changed/CHANGED_OWNER; has owner really changed? "+
ownerHasChanged);

owner = newOwner;
}
}
}