Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

touch_start() not working with CLICK_ACTION_SIT

Kayaker Magic
low carbonated footprint
Join date: 11 Sep 2008
Posts: 109
12-05-2008 16:11
I’m writing a local teleporter that uses touch_start() to detect multiple destinations off a single texture. I want to use CLICK_ACTION_SIT to teleport you as soon as you touch your destination icon. Unfortunately CLICK_ACTION_SIT takes priority, gobbles up the event and does not pass it on to touch_start().
Once he avatar is seated, the next touch_start() works correctly. If I double click really fast, the avatar doesn’t have time to rotate and move into the sit position and things work as I wish. However, if I take to long with the second click the view rotates until the prim with the texture may no longer be visible and you have to cam around to select the teleport destination a second time.
This is all rather cumbersome, does anyone have a better way to do this? (Besides going back to a separate prim for each teleport destination). Ideally I’d like to have a single touch generate both the touch_start() event and also sit the avatar.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
12-05-2008 16:36
You can not do it. Over time there have been a few schemes to get around it but none work well.

Once an avatar is sitting, the sit target does not change even if it is redefined. In other words, you need to have the target defined BEFORE they sit.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Kayaker Magic
low carbonated footprint
Join date: 11 Sep 2008
Posts: 109
12-05-2008 17:04
I'm not using the sit position to do the teleport, I'm using the warpPos, unsit, warpPos trick. So I can get the target on the second click and still teleport to the destination. It works great if I double-click fast enough, I'm trying to find a way to change the order that the click is processed so I only have to single-click the destination icon.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
12-05-2008 17:22
From: Kayaker Magic
I'm not using the sit position to do the teleport, I'm using the warpPos, unsit, warpPos trick.

That is still using the sit position to do the teleport. warpPos, posJump, or just plain ol sit target, they are all hacks that use the defined sit target to move the avatar. All of them need to target to be defined BEFORE the av sits.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
12-05-2008 17:51
are you trying to use the touch start to choose a destination? basically clicking to cycle thru the choices and then they sit after they choose? sounds impossible to me. i have used a menu controlled tp with the warp pos. (click the rezzer, choose a destination, the rezzer rezzes a ball for the user to sit on, the ball dies at the destination)
_____________________
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
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
12-05-2008 18:13
Hang on, I am cogitating something.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
12-05-2008 19:04
Okay finished cogitating :p

Was thinking you were talking about single click action instead of with two clicks. Sorry if I confused you even more. Two clicks are no problem but you have to remember to move stuff to the changed event instead of the touch event because of course when CLICK_ACTION_SIT is active, touches don't register. Here's a little test script to demo:

CODE

vector infVec = <1.304382E+19, 1.304382E+19, 0.0 >;
vector destPos;

default {
state_entry() {
llSitTarget(<0, 0, .5 >, ZERO_ROTATION);
destPos = llGetPos();
llSetClickAction(CLICK_ACTION_TOUCH);
}
touch_start(integer num) {
llOwnerSay("Do touch stuff here");
llSetClickAction(CLICK_ACTION_SIT);
destPos.z += 1;
}
changed(integer change) {
if (change & CHANGED_LINK) {
key av = llAvatarOnSitTarget();
if (av) {
llSetPrimitiveParams([PRIM_POSITION, infVec, PRIM_POSITION, destPos]);
llSetClickAction(CLICK_ACTION_TOUCH);
llUnSit(av);
destPos.z -= 1;
llSetPrimitiveParams([PRIM_POSITION, infVec, PRIM_POSITION, destPos]);
}
}
}
}
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Kayaker Magic
low carbonated footprint
Join date: 11 Sep 2008
Posts: 109
It's not impossible! I have most features working.
12-05-2008 23:24
From: Ruthven Willenov
are you trying to use the touch start to choose a destination? basically clicking to cycle thru the choices and then they sit after they choose? sounds impossible to me. i have used a menu controlled tp with the warp pos.

In the touch_start event I use llDetectedTouchST(i).x and y to get the position on the texture where you touched. I encode those into a destination number. Right now I have 9 numerals painted on the texture and double clicking on one teleports you to the corresponding receiver. No menu required. The eventual goal is a single prim that will have icons for the bedroom, front door, living room, etc. Double-clicking (I wish it was single clicking) on the icon will take you to the corresponding room. (The rooms are not connected and won't even have doors).
It's not impossible! I have it working (just wish it didn't require a double-click). I'd post a copy of my test script here, but it is a work in progress and keeps getting longer...
If anyone would like to play with the script de jour, IM me and I'll send you a copy.
Couldn't have gotten this far without all your help! Thanks everyone!