Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

mousehelddown - get more from touches

Goapinoa Primeau
Addict
Join date: 29 Jun 2006
Posts: 58
12-04-2006 10:52
CODE
//Enhanced Touch Events 

// Using this simple script you can define something to happen when the prim is touched (as normal),
// Also something to happen when the mouse is held down on the prim for a period of time. : )




//global declarations

integer touchcount= 0; //set count zero
integer max = 20; //how many touches will fire before we fire mousehelddown.


mousehelddown()
{
//stuff to do when the mouse is held down on the prim
llSay(0,"someones held the mouse down on me!");
}

default
{
state_entry()
{

}

touch_start(integer total_number)
{
// you can use this event just as normal, if you wish
}
touch(integer num)
{
touchcount++; //increment touchcount
if(touchcount>max) //check if touchcount is more than our max
{
touchcount=0; //reset the count
mousehelddown(); //run the mousehelddown code, see above
}
}
touch_end(integer num_detected)
{
touchcount=0; //reset counter
}

}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
12-05-2006 08:22
/54/05/152919/1.html
_____________________
i've got nothing. ;)