Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Ways Around attaching

Zeta Eizenstark
Registered User
Join date: 20 Aug 2008
Posts: 79
04-22-2009 13:23
Good new everyone, I need help again. :)

I was violently stopped on a script that is used for a point system that attaches to an avatar and shows thier score on top of their head. It also uses a scoreboard but that's beside the point. When i tested it it worked great and thought I was done but when my friend tried it, it wouldn't attack to him. I looked for info and found that you can't attach items to OTHER avatars, sad panda. So wats a good way to get around this...I posted the scripts I have right now. Thank you.

this is the item that WOULD attach:
[/php]
key person;
string name;
integer score = 0;

default
{
state_entry()
{
llListen(0, "","Reset", "";);
llVolumeDetect(TRUE);
}

collision_start(integer totalNumber)
{
integer i = 0;
person = llDetectedKey(i);
name = llDetectedName(i);
llRequestPermissions((key)person, PERMISSION_ATTACH);
}
run_time_permissions(integer perm)
{
if (perm & PERMISSION_ATTACH)
{
llSay(-5, "reset";);
llAttachToAvatar(ATTACH_NOSE);
state count;
}
}
on_rez(integer start)
{
llResetScript();
}
}

state count
{
state_entry()
{
llListen(-4, "","","";);
llSetText((string)score,<0,0,1>,1);
}
listen(integer channel, string s, key k, string msg)
{
if(msg == "plus";)
{
llSay(0, "Got point msg";);
++score;
llSetText((string)score,<0,0,1>,1);
}
else if(msg == "die";)
{
llSay(0, "Got die msg";);
llSay(-5, name + "," + (string)score);
llDetachFromAvatar();
llDie();
}
}
}
[/php]

and this is too welcome them and reset stuff:
[/php]
key person = NULL_KEY;
string name = "";
integer counter = 0;
integer i = 0;
default
{
state_entry()
{
llListen(0, "","Reset", "";);
llVolumeDetect(TRUE);
}

collision_end(integer totalNumber)
{
if( person == NULL_KEY)
{
person = llDetectedKey(i);
name = llDetectedName(i);
llSay(0, "Welcome to House 2 " + name);
}
else if(person == llDetectedKey(i))
{
llSay(-4, "die";);
llSay(0, "Hope you enjoyed your visit " + name);
person = NULL_KEY;
llRezObject("counter", llGetPos(), <0,0,0>, <0,0,0,1>, 0);
}
}
}
[/php]

I hope that one day my children will be able to attach things freely to your or other peoples children.
One day.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
04-22-2009 23:30
objects may only attach to their owners... the only solution is to give a copy to the person you want it to attach to, and they can either aattach it rez it with a scripted attach... this is to prevent griefing.
_____________________
|
| . "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...
| -
Zeta Eizenstark
Registered User
Join date: 20 Aug 2008
Posts: 79
04-23-2009 08:46
so it would be best to:

1.Ask Permission
2.Give them the item with llGiveInventory
3.Ask them to attach it them selfs

and after that just have the item die when it's taken off?
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
04-23-2009 17:21
unfortunetly objects can't die when it's detached, it just sits in your inventory.

you can vote for this jira, and the ones related if you'd like

https://jira.secondlife.com/browse/SVC-2281
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
04-24-2009 07:24
From: Ruthven Willenov
unfortunetly objects can't die when it's detached, it just sits in your inventory.

you can vote for this jira, and the ones related if you'd like

https://jira.secondlife.com/browse/SVC-2281

when it's un-worn.... yes.... but you can disable the code on re-wear in the on_rez event, checking against time, date, number of times rez, hidden variables (prim properties, server checks, etc)... all of that can used to kill scripts. I really wish you could just llDie an attachment.. save a lot of effort.
_____________________
|
| . "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...
| -