Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Horn script has flaw, can i get some assistence?

Khanaar Ingmann
KCC Motors Owner
Join date: 8 Nov 2005
Posts: 7
12-24-2005 17:29
Okay, i now have a new problem... the following script has a bug
From: someone
default
{
state_entry()
{
llPreloadSound("CarHorn";);
llListen(0, "", llGetOwner(), "";);
}

listen(integer channel, string name, key id, string message)
{
integer gCmdChannel = 0;
if (message == "h";)
llTriggerSound("Horn", 5.0);
{
//llResetScript();
}
}
}


It can be used by me, and others around me... im trying to make it not usable my others..

Say i have it in a car, i press H and the car honks, but then someone not in the car stands beside and says H and the car will honk too... im trying to make it not honkable from outsiders
Bertha Horton
Fat w/ Ice Cream
Join date: 19 Sep 2005
Posts: 835
12-24-2005 19:06
Use another IF statement that checks to see if key id = owner's id.
_____________________

Trapped in a world she never made!
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
12-27-2005 05:10
Very confusing... your script looks as though it should work.
The only things I can think of are that
  1. There is another horn script somewhere else in the car that doesn't have the llGetOwner() filter
  2. You only posted an extract of the script, and there is another llListen in there somewhere

Try playing with these examples and see if anything comes to mind.

Only one listen in the script:
CODE
default 
{
state_entry()
{
llPreloadSound("CarHorn");
llListen(0, "", llGetOwner(), "h");
}

listen(integer channel, string name, key id, string message)
{
llTriggerSound("Horn", 5.0);
}

on_rez(integer start_param)
{
llResetScript();
}
}

Multiple listens in the script:
CODE
	listen(integer channel, string name, key id, string message) 
{
if (id==llGetOwner() && message=="h")
llTriggerSound("Horn", 5.0);
else if (.............)
.........
if (.............)
.........
}