Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

I'm new to scripting, Need to know how to Reset a script through Chat

Candy Hinkle
Registered User
Join date: 15 Jul 2006
Posts: 14
08-20-2006 11:35
What ll Command do i use to make a Script reset by Chat?
Baron Hauptmann
Just Designs / Scripter
Join date: 29 Oct 2005
Posts: 358
08-20-2006 11:46
You'll need to set up a llListen() call to listen for a particular command. I would recommend listening on a channel other than 0, and perhaps filtering out everything but owner.

CODE

llListen(1234, "", llGetOwner(), "");


Then, in the listen event, upon hearing the right command, call llResetScript();

CODE

listen( integer channel, string name, key id, string message )
{
if (message == "reset script")
{
llResetScript();
}
}


Then, when you want to reset the script, you would say "/1234 reset script"


That should take care of things.

Baron
Jack Gelfand
Registered User
Join date: 31 Jul 2006
Posts: 3
Help
08-21-2006 09:58
ok, I would like to use this script

vector down;
vector up = <31.392,199.123,354.092>;
float time = 5.0;
default
{
state_entry()
{
down = llGetPos();
llSetPos(down);
}

listen( integer channel, string name, key id, string message )
{
if (message == "move to level 1";) //but where do i say what channel I want to say move to level 1?
{
llSetPos(up);
llSleep(time);
llSetPos(down);
}
}
}
Baron Hauptmann
Just Designs / Scripter
Join date: 29 Oct 2005
Posts: 358
08-21-2006 11:21
Jack: This would be better started as a new thread, as it is not directly related to resetting a script. However, I'll answer it here.

First, you need to do a llListen() call. Check the wiki for the syntax . . . when you open up a listener, you define what channel you want to listen to. So, if you want to listen on 54321, you would include a call like the following in (for your case at least) the state_entry() event.

CODE

llListen(54321, "", NULL_KEY, "");


which would listen to anything SAYd on channel 54321. To issue that command to the script, you would type in regular chat

CODE

/54321 move to level 1


Your script would then hear that you said "move to level 1" on channel 54321, and would activate the listen(....) event and satisfy the IF condition.

Hope that helps
Baron H.