Jump to content

Private walkie talkies, arent so private...


OddbroShillings
 Share

You are about to reply to a thread that has been inactive for 4681 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I have this walkie talkie script, and I want it to do what another one does. Here is what I have and need.

 

Ok, so i work in an rp sim. One dept. I work in is PD. We have a radio system, thats works on a certain channel. If I say "/2 Need back up!' anyone who is whereing the radio will be the ONLY ones to hear it. Like if Im standing next to a guy and get the call, he wont hear it, unless he has a radio on. Well my other Dept, is the Public works, we dont have a radio system and we need one. This script you can say what you need to say, like the one above but if you are standing next to a guy with that radio, you will hear it. I need the script edited so this DOESNT happen. Please take a look and help me asap. thanks in advance.

 

 

integer transmit_channel = 4;
integer listen_handle;
 
say_message(string message)
{
llWhisper(0, message);
llSetColor(<0, 1, 0>, ALL_SIDES);
llSleep(0.5);
llSetColor(<1, 1, 1>, ALL_SIDES);
}
 
transmit(string message)
{
llShout(transmit_channel, message);
llSetColor(<1, 0, 0>, ALL_SIDES);
llSleep(0.5);
llSetColor(<1, 1, 1>, ALL_SIDES);
}
 
show_help()
{
llOwnerSay("Walkie Talkie Directions:");
llOwnerSay("/wt on: Turn on.");
llOwnerSay("/wt off: Turn off.");
llOwnerSay("/wt channel <number>: Transmit/Receive on channel <number>.");
llOwnerSay("/wt reset: Reset.");
llOwnerSay("/wt <message>: Transmit <message>.");
llOwnerSay("/wt scan: Scan channels.");
}
 
default
{
state_entry()
{
llOwnerSay("Walkie Talkie enabled (status: ON).  Type \"wt help \" for directions.");
llSetObjectName(llKey2Name(llGetOwner()) + " (WT)");
state on;
}
}
 
state on
{
state_entry()
{
llListen(0, "", llGetOwner(), "");
listen_handle = llListen(transmit_channel, "", NULL_KEY, "");
llOwnerSay("Walkie Talkie on.");
llOwnerSay("Walkie Talkie listening on channel " + (string) transmit_channel);
}
 
attach(key attached)
{
if (attached != NULL_KEY)
{
llSetObjectName(llKey2Name(llGetOwner()) + " (WT)");
llOwnerSay("Walkie Talkie enabled (status: ON).  Type \"wt help\" for directions.");
}
}
 
changed(integer change)
{
if (change & CHANGED_OWNER)
{
llResetScript();
}
}
 
listen(integer channel, string name, key id, string message)
{
if (channel == 0 && id == llGetOwner() && llStringLength(message) > 4 && llGetSubString(llToLower(message), 0, 3) == "/wt ")
{
message = llDeleteSubString(message, 0, 3);
if (llGetSubString(llToLower(message), 0, llStringLength("channel ") - 1) == "channel " && llStringLength(message) > llStringLength("channel "))
{
message = llDeleteSubString(message, 0, llStringLength("channel ") - 1);
if ((integer) message != 0)
{
transmit_channel = (integer) message;
llListenRemove(listen_handle);
listen_handle = llListen(transmit_channel, "", NULL_KEY, "");
llOwnerSay("Walkie Talkie listening on channel " + (string) transmit_channel);
}
}
 
else if (llGetSubString(llToLower(message), 0, llStringLength("off") - 1) == "off")
{
state off;
}
 
else if (llGetSubString(llToLower(message), 0, llStringLength("help") - 1) == "help")
{
show_help();
}
 
else if (llGetSubString(llToLower(message), 0, llStringLength("scan") - 1) == "scan")
{
state scan;
}
 
else if (llGetSubString(llToLower(message), 0, llStringLength("reset") - 1) == "reset")
{
llResetScript();
}
 
else
{
transmit(message);
}
}
 
else if (channel != 0)
{
if (id == llGetOwner())
{
say_message(message);
}
 
else
{
say_message(name + ": " + message);
}
}
}   
}
 
state off
{
state_entry()
{
llListen(0, "", llGetOwner(), "");
llOwnerSay("Walkie Talkie off.");
}
 
attach(key attached)
{
if (attached != NULL_KEY)
{
llSetObjectName(llKey2Name(llGetOwner()) + " (WT)");
llOwnerSay("Walkie Talkie enabled (status: OFF).  Type \"wt help\" for directions.");
}
}
 
changed(integer change)
{
if (change & CHANGED_OWNER)
{
llResetScript();
}
}
 
listen(integer channel, string name, key id, string message)
{
if (channel == 0 && id == llGetOwner() && llStringLength(message) > 4 && llGetSubString(llToLower(message), 0, 3) == "/wt ")
{
message = llDeleteSubString(message, 0, 3);
 
if (llGetSubString(llToLower(message), 0, llStringLength("on") - 1) == "on")
{
state on;
}
 
else if (llGetSubString(llToLower(message), 0, llStringLength("help") - 1) == "help")
{
show_help();
}
 
else if (llGetSubString(llToLower(message), 0, llStringLength("scan") - 1) == "scan")
{
state scan;
}
 
else if (llGetSubString(llToLower(message), 0, llStringLength("reset") - 1) == "reset")
{
llResetScript();
}
}
}   
}
 
 
state scan
{
state_entry()
{
llListen(0, "", llGetOwner(), "");
listen_handle = llListen(transmit_channel, "", NULL_KEY, "");
llSetTimerEvent(5);
llOwnerSay("Channel Scanning...say \"wt stop\" to stop.");
}
 
attach(key attached)
{
if (attached != NULL_KEY)
{
llSetObjectName(llKey2Name(llGetOwner()) + " (WT)");
llOwnerSay("Walkie Talkie enabled (status: SCANNING).  Type \"wt help\" for directions.");
}
}
 
changed(integer change)
{
if (change & CHANGED_OWNER)
{
llResetScript();
}
}
 
timer()
{
transmit_channel++;
llListenRemove(listen_handle);
listen_handle = llListen(transmit_channel, "", NULL_KEY, "");
llOwnerSay("Walkie Talkie listening on channel " + (string) transmit_channel);
}
 
listen(integer channel, string name, key id, string message)
{
if (channel == 0 && id == llGetOwner() && llStringLength(message) > 4 && llGetSubString(llToLower(message), 0, 3) == "/wt ")
{
message = llDeleteSubString(message, 0, 3);
 
if (llGetSubString(llToLower(message), 0, llStringLength("channel ") - 1) == "channel " && llStringLength(message) > llStringLength("channel "))
{
message = llDeleteSubString(message, 0, llStringLength("channel ") - 1);
 
if ((integer) message != 0)
{
transmit_channel = (integer) message;
llListenRemove(listen_handle);
listen_handle = llListen(transmit_channel, "", NULL_KEY, "");
llOwnerSay("Walkie Talkie listening on channel " + (string) transmit_channel);
}
}
 
else if (llGetSubString(llToLower(message), 0, llStringLength("on") - 1) == "on")
{
state on;
}
 
else if (llGetSubString(llToLower(message), 0, llStringLength("stop") - 1) == "stop")
{
state on;
}
 
else if (llGetSubString(llToLower(message), 0, llStringLength("off") - 1) == "off")
{
state off;
}
 
else if (llGetSubString(llToLower(message), 0, llStringLength("help") - 1) == "help")
{
show_help();
}
 
else if (llGetSubString(llToLower(message), 0, llStringLength("reset") - 1) == "reset")
 
{
llResetScript();
}
 
else
{
transmit(message);
}
}
 
else if (channel != 0)
{
if (id == llGetOwner())
{
say_message(message);
}
 
else
{
say_message(name + ": " + message);
}
state on;
}
}
}

 

Link to comment
Share on other sites

That's quite easy. This script uses llOwnerSay() everywhere... except in the function say_message() where it reverts to --the ugly-- llWhisper(). Change that line and your leak is plugged

 

say_message(string message){    llOwnerSay(message);    llSetColor(<0, 1, 0>, ALL_SIDES);    llSleep(0.5);    llSetColor(<1, 1, 1>, ALL_SIDES);}

 

btw, I would also change the llShout() into llRegionSay() in the function transmit(). That would greatly improve the range of the walkie-talkie.

 

transmit(string message){    llRegionSay(transmit_channel, message);    llSetColor(<1, 0, 0>, ALL_SIDES);    llSleep(0.5);    llSetColor(<1, 1, 1>, ALL_SIDES);}

 

Link to comment
Share on other sites

Oh, ok, I see, but after it say llOwnerSay(message)can I put in the channel it should send and recieve on. I want the channel to be, 5 so should it be llOwnerSay (5, message) and have both the sender and reciver get the message privatly, like in reg chat but it pops up in the yellow.

Link to comment
Share on other sites

There are 3 parts to a system like this:

  1. WT listening to the sender <== yours listens on channel 0 (open chat) for a message starting "wt".  Not great, but ok.
  2. Transmit/receive <== yours llShout()s the message on the channel defined in the first line of the script "integer transmit_channel = 4;", change this for a different 'network', like police, fire, works. etc.  llRegionSay() has a greater range (within a single sim)
  3. Displaying the message to the receiver <== yours currently llWhisper()s the message, which can be heard by people nearby.  llOwnerSay() ONLY displays the message to the owner, so no-one else will be able to hear it.  Because llOwnerSay() ALWAYS displays a message ONLY to the owner it does not have/need a channel number.
Link to comment
Share on other sites

Maybe you got something wrong - this should work - I hope so at least, I couldn't test it.

integer transmit_channel = -234233456; //should be a low, negative numberinteger listen_handle;say_message(string message){	//llWhisper(0, message);	llOwnerSay(message);	llSetColor(<0, 1, 0>, ALL_SIDES);	llSleep(0.5);	llSetColor(<1, 1, 1>, ALL_SIDES);}transmit(string message){	//llShout(transmit_channel, message);	llRegionSay(transmit_channel, message);	llSetColor(<1, 0, 0>, ALL_SIDES);	llSleep(0.5);	llSetColor(<1, 1, 1>, ALL_SIDES);}show_help(){	llOwnerSay("Walkie Talkie Directions:");	llOwnerSay("/wt on: Turn on.");	llOwnerSay("/wt off: Turn off.");	llOwnerSay("/wt channel <number>: Transmit/Receive on channel <number>.");	llOwnerSay("/wt reset: Reset.");	llOwnerSay("/wt <message>: Transmit <message>.");	llOwnerSay("/wt scan: Scan channels.");}default{	state_entry()	{		llOwnerSay("Walkie Talkie enabled (status: ON).  Type \"wt help \" for directions.");		llSetObjectName(llKey2Name(llGetOwner()) + " (WT)");		state on;	}}state on{	state_entry()	{		llListen(0, "", llGetOwner(), "");		listen_handle = llListen(transmit_channel, "", NULL_KEY, "");		llOwnerSay("Walkie Talkie on.");		llOwnerSay("Walkie Talkie listening on channel " + (string) transmit_channel);	}	attach(key attached)	{		if (attached != NULL_KEY)		{			llSetObjectName(llKey2Name(llGetOwner()) + " (WT)");			llOwnerSay("Walkie Talkie enabled (status: ON).  Type \"wt help\" for directions.");		}	}	changed(integer change)	{		if (change & CHANGED_OWNER)		{			llResetScript();		}	}	listen(integer channel, string name, key id, string message)	{		if (channel == 0 && id == llGetOwner() && llStringLength(message) > 4 && llGetSubString(llToLower(message), 0, 3) == "/wt ")		{			message = llDeleteSubString(message, 0, 3);			if (llGetSubString(llToLower(message), 0, llStringLength("channel ") - 1) == "channel " && llStringLength(message) > llStringLength("channel "))			{				message = llDeleteSubString(message, 0, llStringLength("channel ") - 1);				if ((integer) message != 0)				{					transmit_channel = (integer) message;					llListenRemove(listen_handle);					listen_handle = llListen(transmit_channel, "", NULL_KEY, "");					llOwnerSay("Walkie Talkie listening on channel " + (string) transmit_channel);				}			}			else if (llGetSubString(llToLower(message), 0, llStringLength("off") - 1) == "off")			{				state off;			}			else if (llGetSubString(llToLower(message), 0, llStringLength("help") - 1) == "help")			{				show_help();			}			else if (llGetSubString(llToLower(message), 0, llStringLength("scan") - 1) == "scan")			{				state scan;			}			else if (llGetSubString(llToLower(message), 0, llStringLength("reset") - 1) == "reset")			{				llResetScript();			}			else			{				transmit(message);			}		}		else if (channel != 0)		{			if (id == llGetOwner())			{				say_message(message);			}			else			{				say_message(name + ": " + message);			}		}	}}state off{	state_entry()	{		llListen(0, "", llGetOwner(), "");		llOwnerSay("Walkie Talkie off.");	}	attach(key attached)	{		if (attached != NULL_KEY)		{			llSetObjectName(llKey2Name(llGetOwner()) + " (WT)");			llOwnerSay("Walkie Talkie enabled (status: OFF).  Type \"wt help\" for directions.");		}	}	changed(integer change)	{		if (change & CHANGED_OWNER)		{			llResetScript();		}	}	listen(integer channel, string name, key id, string message)	{		if (channel == 0 && id == llGetOwner() && llStringLength(message) > 4 && llGetSubString(llToLower(message), 0, 3) == "/wt ")		{			message = llDeleteSubString(message, 0, 3);			if (llGetSubString(llToLower(message), 0, llStringLength("on") - 1) == "on")			{				state on;			}			else if (llGetSubString(llToLower(message), 0, llStringLength("help") - 1) == "help")			{				show_help();			}			else if (llGetSubString(llToLower(message), 0, llStringLength("scan") - 1) == "scan")			{				state scan;			}			else if (llGetSubString(llToLower(message), 0, llStringLength("reset") - 1) == "reset")			{				llResetScript();			}		}	}}state scan{	state_entry()	{		llListen(0, "", llGetOwner(), "");		listen_handle = llListen(transmit_channel, "", NULL_KEY, "");		llSetTimerEvent(5);		llOwnerSay("Channel Scanning...say \"wt stop\" to stop.");	}	attach(key attached)	{		if (attached != NULL_KEY)		{			llSetObjectName(llKey2Name(llGetOwner()) + " (WT)");			llOwnerSay("Walkie Talkie enabled (status: SCANNING).  Type \"wt help\" for directions.");		}	}	changed(integer change)	{		if (change & CHANGED_OWNER)		{			llResetScript();		}	}	timer()	{		transmit_channel++;		llListenRemove(listen_handle);		listen_handle = llListen(transmit_channel, "", NULL_KEY, "");		llOwnerSay("Walkie Talkie listening on channel " + (string) transmit_channel);	}	listen(integer channel, string name, key id, string message)	{		if (channel == 0 && id == llGetOwner() && llStringLength(message) > 4 && llGetSubString(llToLower(message), 0, 3) == "/wt ")		{			message = llDeleteSubString(message, 0, 3);			if (llGetSubString(llToLower(message), 0, llStringLength("channel ") - 1) == "channel " && llStringLength(message) > llStringLength("channel "))			{				message = llDeleteSubString(message, 0, llStringLength("channel ") - 1);				if ((integer) message != 0)				{					transmit_channel = (integer) message;					llListenRemove(listen_handle);					listen_handle = llListen(transmit_channel, "", NULL_KEY, "");					llOwnerSay("Walkie Talkie listening on channel " + (string) transmit_channel);				}			}			else if (llGetSubString(llToLower(message), 0, llStringLength("on") - 1) == "on")			{				state on;			}			else if (llGetSubString(llToLower(message), 0, llStringLength("stop") - 1) == "stop")			{				state on;			}			else if (llGetSubString(llToLower(message), 0, llStringLength("off") - 1) == "off")			{				state off;			}			else if (llGetSubString(llToLower(message), 0, llStringLength("help") - 1) == "help")			{				show_help();			}			else if (llGetSubString(llToLower(message), 0, llStringLength("reset") - 1) == "reset")			{				llResetScript();			}			else			{				transmit(message);			}		}		else if (channel != 0)		{			if (id == llGetOwner())			{				say_message(message);			}			else			{				say_message(name + ": " + message);			}			state on;		}	}}

 

Link to comment
Share on other sites

Good and bad news.....Good news is that the help menu is back and running, bad news is I dont understand what channel everyone needs to transmit on.

 

Let me clarify what I need. I think we are almost there xD.

I would like this script to be able to do this: (lets say our transmit channel is 5)

I want to say: Lets get a tow truck out to the corner.

So this is what Id do: /5 Lets get a tow truck out to the corner.

Anyone who has a walkie takie on would here this in owner say: OddbroShillings: Lets get a tow truck out to the corner.

And noew they can say: /5 Copy that, doing it now.

And anyone who has the walkie talkie on would hear in owner say: A. Random Dude: Copy that, doing it now.

 

Does this help any?

Link to comment
Share on other sites

  • 2 weeks later...

There is a (nearly) free script you can use in your own walki talkie or use the freebie radios supplied.  Copy, transfer, Xmod.

They communicate SL wide and have about 90 channels.  Its like a SL wide CB radio and you can select the public channel 16 or switch to other channels.  Only radios set to the same channel will hear the transmission.  If you have a large number of people, you can get private channels and only those you enable can communicate.  Those ones have an "all call" channel that everyone that is enrolled will hear even if they are working on another channel.

You can find them at http://slurl.com/secondlife/Whanganui/173/154/66.  Go to the Radio Shack behind the transmitter tower.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4681 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...