Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Scroll of invade Creators Mind, need help

Akiros Yoshikawa
Registered User
Join date: 1 Mar 2007
Posts: 4
03-21-2007 08:06
Okay what I am trying to design is a script that when touched will message the owner through IM telling them that if they now speak the creator of the scroll that the script is dropped into will hear everything they are saying, it will light up and I am going to add simple particle effects later. Then when touched again, it will IM the owner again telling them that the scroll is nolonger active and it will go back to being unlit and stop listening. I used free scripts to make this and I intend to give it away for free once completed to those who want to add alittle something to help people they are either selling objects to or give it to a friend to hang up somewhere to pester them with it. Heres what I got so far


--------------------------------------------------------------------------------------------------
string message;
integer channel = 0;

default
{
state_entry()
{

touch_start(integer total_number);
llSetPrimitiveParams([PRIM_MATERIAL, PRIM_MATERIAL_WOOD]); state unlit;
llInstantMessage(llGetOwner(), "Speak To the Scroll if I am online, I'll be Listening if you need help.";);
llListen(0, "","","";);

}

listen(integer channel, string name, key id, string message)
{
llInstantMessage(llGetCreator(),llKey2Name(id) + " " +(string)message);

}
}

state unlit

{
touch_start(integer total_number)
{
llSetPrimitiveParams([PRIM_MATERIAL, PRIM_MATERIAL_LIGHT]); state default;
llInstantMessage(llGetOwner(), "You have deactived the Scroll, I hope I was of assistance";);
}
}
-----------------------------------------------------------------------------------------

I get a syntex error on line eight I believe. As far as I can tell the IM script works fine, I just want to make it so it doesnt listen non stop. The light script seems to be where I have the problem
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
03-21-2007 09:15
Several problems.

First you have the touch start event handler inside the state_entry method.
Secondly your code inside the touch start wont work anyway not the way you intend it.As it stands it will start a listen then switch immediately to the unlit state.
Your state unlit code is in asimilarly confused state (no pun intended)

Try this

CODE

integer Listening = 0;
key owner;

default
{
state_entry()
{
llSetPrimitiveParams([PRIM_MATERIAL, PRIM_MATERIAL_WOOD]); // Inactive parameters
if(Listening)llListenRemove(Listening);
Listening = 0;
}

touch_start(integer total_number)
{
owner = llGetOwner();
key toucher = llDetectedKey(0);
if(toucher == owner) state Listen;
}

on_rez(integer num) { llResetScript(); }

}

state Listen
{
state_entry()
{
llSetPrimitiveParams([PRIM_MATERIAL, PRIM_MATERIAL_LIGHT]); // Active parameters
llInstantMessage( owner , "Speak To the Scroll if I am online, I'll be Listening if you need help.");
Listening = llListen( 0, "", owner , "");
}

touch_start(integer total_number)
{
owner = llGetOwner();
key toucher = llDetectedKey(0);
if(toucher == owner)
{
llInstantMessage(owner, "You have deactived the Scroll, I hope I was of assistance");
state default;
}
}

listen(integer channel, string name, key id, string message)
{
llInstantMessage(llGetCreator(),llKey2Name(id) + " " +(string)message);
}

on_rez(integer num) { llResetScript(); }

}

Akiros Yoshikawa
Registered User
Join date: 1 Mar 2007
Posts: 4
03-21-2007 11:43
Still doesnt want to work, thanks anyway.
Max Pitre
Registered User
Join date: 19 Jul 2006
Posts: 370
03-21-2007 14:53
From: Akiros Yoshikawa
Still doesnt want to work, thanks anyway.


Seemed to work for me although I would add a timer to turn it off if inactive for a set amount of time.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
03-21-2007 16:48
From: Max Pitre
Seemed to work for me although I would add a timer to turn it off if inactive for a set amount of time.



Yep would be agood idea, I just wanted to code up as much as had been originally requested rathe rtahn confuse it too much.