Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Script for a novelty cannon

Olivar Gausman
Registered User
Join date: 30 Apr 2007
Posts: 2
06-05-2007 17:57
I'm having trouble writing a script that will "launch" (push) the avatar when touching the cannon. This is what I have right now (incomplete, and poorly done, its my first script though)

default
{
touch_start(integer total_number)
{
integer local = FALSE;
vector angular_impulse = <1,1,1>;
vector impulse = <10,10,10>;
key value = llGetPermissionsKey();
llPushObject(value, impulse, angular_impulse, local);
}
}

It doesn't even highlight the touch option when right clicked. I also need to include some method of positioning the character in the chamber, but I was going to research that after I sort this part out (any help on that would be awesome, though).
Simnelia Petrichor
Registered User
Join date: 10 Feb 2006
Posts: 35
06-06-2007 06:33
It looks ok to me, except value should be calculated as:

key value = llDetectedKey(0);

... so that it identifies the avatar who touched the cannon.

I built a similar thing once. I found I had to set the impulse vectors very high to propel the person any distance. Depends how big your cannon is, of course (stop sniggering).
Olivar Gausman
Registered User
Join date: 30 Apr 2007
Posts: 2
06-06-2007 15:27
Woo thanks much, it works now. It only seems to work for me, though. This is what I have for code:

default
{
state_entry()
{
llSay(0, "Hop your ass on in, then click anywhere on the cannon! It Fyuhn!";);
}

touch(integer total_number)
{
integer local = FALSE;
vector angular_impulse = <1,1,1>;
vector impulse = <0,50,50>;
key value = llDetectedKey(0);
llPushObject(value, impulse, angular_impulse, local);
}
}

I'm thinking I need a loop? Or is there a break command that will restart the code for a new agent?
Simnelia Petrichor
Registered User
Join date: 10 Feb 2006
Posts: 35
06-07-2007 02:04
Sounds like you might be using it on land where pushing isn't allowed (you're still allowed to push yourself).