2toe Bigboots Posted June 1, 2011 Share Posted June 1, 2011 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 comment Share on other sites More sharing options...
BlckCobra Shikami Posted June 1, 2011 Share Posted June 1, 2011 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 comment Share on other sites More sharing options...
2toe Bigboots Posted June 1, 2011 Author Share Posted June 1, 2011 O okay as you can tell in a new to scipting so this i didnt know kool, ill give that a shot thank you. Link to comment Share on other sites More sharing options...
2toe Bigboots Posted June 1, 2011 Author Share Posted June 1, 2011 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 comment Share on other sites More sharing options...
Darkie Minotaur Posted June 1, 2011 Share Posted June 1, 2011 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 & 1 Link to comment Share on other sites More sharing options...
2toe Bigboots Posted June 1, 2011 Author Share Posted June 1, 2011 Now what do you think is the rang on this ?? Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted June 1, 2011 Share Posted June 1, 2011 I don't understand your question Link to comment Share on other sites More sharing options...
2toe Bigboots Posted June 1, 2011 Author Share Posted June 1, 2011 I will im you in SL if your on for a little easyer convorsation Link to comment Share on other sites More sharing options...
Recommended Posts
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