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
}
}