Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How to give notecard on touch and still allow grab?

Superkev Sellery
Registered User
Join date: 23 Jun 2006
Posts: 1
06-29-2006 11:14
I am very new to scripting, and I'm not too good at it. Can anyone tell me how to modify my script to do the following:

1) Allow ctrl-click and drag to move the object.
2) Right click brings up pie menu, and "touch" gives note card.

alternately...

2) Add a menu item to the pie that says "Info..." that gives out note card.

Right now it just automatically gives the note as soon as I try to grab it. I am unable to move the object without choosing edit.

CODE

default
{

touch_start(integer total_number)
{
// Find out who clicked, and give them a note card
key giver;
giver = llDetectedKey(0);
string name = llDetectedName(0);
if (giver != NULL_KEY)
{

llGiveInventory(giver, llGetInventoryName(INVENTORY_NOTECARD, 0));
}
}

}
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
06-29-2006 11:23
Maybe something like this?

touch_start - Reset time
touch_end - get time, and see how long the object was 'touched' for. Use some reasonable limit, say, if it was held for more than 0.5 seconds, it was probably a drag and not someone looking for the notecard. Less than 0.5 seconds, give them the notecard.

Just an idea, I don't know how well it'll work in practice. I've never used touch_end myself. And it may get complicated if multiple people are clicking/dragging the object simultaneously.