Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Remote Control script not working

Sebastiaan Siegel
Registered User
Join date: 2 Feb 2007
Posts: 18
02-06-2007 01:27
I made a basic remote control script, but i cant get it to work.
I could really use some help :) It doesnt give any errors, it just doesnt do anything.

CODE

//REMOTE CONTROL

default
{
state_entry()
{
llSay(0, "Hello, Avatar!");
}


touch_start(integer total_number)
{
llSay(2, "touched");
}
}


CODE

// WINDOW SCRIPT
vector OpenRot = <90, 90, 0>;
vector ClosedRot = <45, 90, 0>;


default
{
state_entry()
{
llListen(2, "" ,NULL_KEY, "" );
state closed;

}
}


state closed
{

listen(integer channel, string name, key id, string message)
{

if (llToLower(message) == "touched")
{
state open;
//llSetRot(llEuler2Rot(ClosedRot * DEG_TO_RAD));
llSay(0, "Raam Open");

}
}
}

state open
{

listen(integer channel, string name, key id, string message)
{

if (llToLower(message) == "touched")
{
state closed;
//llSetRot(llEuler2Rot(OpenRot * DEG_TO_RAD));
llSay(0, "Raam Dicht");

}
}
}
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
02-06-2007 02:19
Listens do not persist across states, you need to add them in each state.

here is your code slightly modified.
I've made the default state the closed state.

CODE

// WINDOW SCRIPT
vector OpenRot = <90, 90, 0>;
vector ClosedRot = <45, 90, 0>;


default
{
state_entry()
{
llOwnerSay("Raam Dicht");
llListen(2, "" ,NULL_KEY, "" );
// llSetRot(llEuler2Rot(ClosedRot * DEG_TO_RAD));
}

listen(integer channel, string name, key id, string message)
{
if (llToLower(message) == "touched")
{
state open;
}
}
}

state open
{
state_entry()
{
llOwnerSay("Raam Open");
llListen(2, "" ,NULL_KEY, "" );
// llSetRot(llEuler2Rot(OpenRot * DEG_TO_RAD));
}

listen(integer channel, string name, key id, string message)
{
if (llToLower(message) == "touched")
{
state default;
}
}
}
Sebastiaan Siegel
Registered User
Join date: 2 Feb 2007
Posts: 18
02-06-2007 02:36
Hey thanks for the help :) I knew i was close, but i didnt know i needed to add them in each state. Gotta remember that.