Jump to content

Any one know whats wrong here?


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

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

Recommended Posts

Im trying to make a script that takes chat from chan 0 sends on neg chan and can also hear on that chan to send back to 0 for cross comunication. heres what i got so far and i keep getting a error idk y this script may be sloppy let me know be kind please.

 

integer inchan = -713 ; /|/ Input channel
integer bchan = -123456 ; /|/ "Secret" channel/frequency message is sent on.
integer lchan = -713
integer tchan = 0
default
{
    state_entry()
    {
        
        llListen(inchan,"","","");
        /|/ listens for just the owner, on channel 0
    }
    listen(integer chan, string name, key id, string mess)
    {
        if (id == llGetOwner())
        {
        llShout(bchan,llKey2Name(llGetOwner())+"> "+mess);
        llOwnerSay(llKey2Name(llGetOwner())+"> "+mess);
        }
        {
        
        llListen(lchan,"","","");
        /|/ listens for just the owner, on channel 0
    }
    listen(integer chan, string name, key id, string mess)
    {
        if (id == llGetOwner())
        {
        llShout(tchan,llKey2Name(llGetOwner())+"> "+mess);
        llOwnerSay(llKey2Name(llGetOwner())+"> "+mess);
        }
}*/
//end_unprocessed_text
//nfo_preprocessor_version 0
//program_version Phoenix Viewer 1.5.2.1102 - 2toe Bigboots
//mono


integer inchan = -713 ;
integer bchan = -123456 ;

default
{
    state_entry()
    {
        
        llListen(inchan,"","","");
        
    }
    listen(integer chan, string name, key id, string mess)
    {
        if (id == llGetOwner())
        {
        llShout(bchan,llKey2Name(llGetOwner())+"> "+mess);
        llOwnerSay(llKey2Name(llGetOwner())+"> "+mess);
        }
        {
        
        llListen(lchan,"","","");
        
    }
    listen(integer chan, string name, key id, string mess)
    {
        if (id == llGetOwner())
        {
        llShout(tchan,llKey2Name(llGetOwner())+"> "+mess);
        llOwnerSay(llKey2Name(llGetOwner())+"> "+mess);
        }
}

 So it listens on 0 sends on -713 listens on -123456  and sends on -713 is this posible ? or am i close


Link to post
Share on other sites

You have 2 listen handlers in the same script - that will not work (probably not even compile without an error message)

If you want to listen to 2 channels at the same time open 2 llListen(...) and in the listen event handler check on which channel it was received to forward it to the appropriate channel.

Example:

listen(integer channel, ...) {

 if (chan == 0)

    llSay(bChan,message)

 else if chan == iChan)

  llSay(cChan,message);

    :

}

Link to post
Share on other sites

Okay idk if im closer but here is what i did still a error thou

 

integer inchan = 0 ; // Input channelinteger bchan = -123456 ; // "Secret" channel/frequency message is sent on.default{    state_entry()    {                llListen(inchan,"","","");    }        if(chan == 0);(llGetOwner();        {        llShout(bchan,llKey2Name(llGetOwner())+"> "+mess);        llOwnerSay(llKey2Name(llGetOwner())+"> "+mess);    }        else if(chan == -1223456);        {        llShout(inchan,llKey2Name(llGetOwner())+"> "+mess);        llOwnerSay(llKey2Name(llGetOwner())+"> "+mess);    }    changed(integer change)    {        if (change - CHANGED_OWNER)            llResetScript();        }}    state_entry()    {        llListen(bchan,"","","",);    }        if(chan == -123456);(llGetOwner();        {        llShout(inchan,llKey2Name(llGetOwner())+"> "+mess);        llOwnerSay(llKey2Name(llGetOwner())+"> "+mess);    }        else if(chan == 0);        {        llShout(bchan,llKey2Name(llGetOwner())+"> "+mess);        llOwnerSay(llKey2Name(llGetOwner())+"> "+mess);    }}//end

 I think i may have fixed this by breaking it into 2scripts,  one to listen to owner and talk on neg chan other to listen on the neg talk on local, was hoping to put all in one script.

Link to post
Share on other sites

This time you threw away a little too much - you need a liListen function in order to listen at all and you need an listen even - what hasbeen called a handler before. You can have several llListen functions, but just one listen event per state.

Here is a working solution:

integer inchan = 0 ; // Input channelinteger bchan = -123456 ; // "Secret" channel/frequency message is sent on.default{    state_entry()    {                llListen(inchan,"","","");    }    listen(integer chan, string name, key id, string mess) {    	if (id == llGetOwner()) {	        if(chan == inchan) {		        	llShout(bchan,llKey2Name(llGetOwner())+"> "+mess);	        	llOwnerSay(llKey2Name(llGetOwner())+"> "+mess);	        }	    	        else if(chan == bchan);	        {	       		llShout(inchan,llKey2Name(llGetOwner())+"> "+mess);	        	llOwnerSay(llKey2Name(llGetOwner())+"> "+mess);	    	}    }    }    changed(integer change)    {        if (change & CHANGED_OWNER)            llResetScript();     }}

 Just some remarks:

  • you tested for the owner twice - just nest the two channel tests in the llGetOwnder test
  • since you seem to ant to the owner only, restrict the llListen to the owner - that puts less strain on the ressources and you don't need ti test for llGetOwnder in the listen event
  • there was a typo in the change event - instead of &
  • Like 1
Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 3607 days.

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...