llToLower
|
|
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
|
12-12-2007 18:01
im having a bit of trouble with my one script, i heard from someone that llToLower would allow you to use eather caps or lowercase letters and still allow you to use the command, i did this script and it dosrent respond to it atall
integer open; default { state_entry() { open = FALSE; llListen(0,"",llGetOwner(),""); } link_message(integer sender_num, integer num, string msg, key id) { if(msg == "open") { open = TRUE; } else if(msg == "close") { open = FALSE; } } listen(integer channel, string name, key id, string message) { if((llToLower(message) == "@sl") && (open == TRUE)) { llLoadURL(llGetOwner(),"Go to Second Life Website.","http://www.2ndlife.com"); } } }
|
|
Wyatt Burton
Registered User
Join date: 11 Jan 2007
Posts: 49
|
12-12-2007 18:38
From: Mrc Homewood im having a bit of trouble with my one script, i heard from someone that llToLower would allow you to use eather caps or lowercase letters and still allow you to use the command, i did this script and it dosrent respond to it atall
integer open; default { state_entry() { open = FALSE; llListen(0,"",llGetOwner(),""); } link_message(integer sender_num, integer num, string msg, key id) { if(msg == "open") { open = TRUE; } else if(msg == "close") { open = FALSE; } } listen(integer channel, string name, key id, string message) { if((llToLower(message) == "@sl") && (open == TRUE)) { llLoadURL(llGetOwner(),"Go to Second Life Website.","http://www.2ndlife.com"); } } }
Thas because your open in the listen method is always FALSE.
|
|
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
|
12-12-2007 18:47
You need to do a llListen if you want things to trigger the listen event..
See https://wiki.secondlife.com/wiki/LlListen
|
|
Kahiro Watanabe
Registered User
Join date: 28 Sep 2007
Posts: 572
|
12-12-2007 19:03
You are using "link_message" event...so I suppose you must have other script in the same object, sending messages to it. Can you post that script? Maybe there's the mistake.
|
|
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
|
12-12-2007 19:19
here is the script in the other part of the object(atleast all you need rest is just coords related stuff on the top part of script and the integers) default { state_entry() { if (close_on_rez) { close(); } else { open(); } } on_rez(integer rez) { llResetScript(); opend == FALSE; } touch_start(integer touched) { if(llDetectedKey(0) == llGetOwner()) { if(opend == FALSE) { open(); llMessageLinked(LINK_ROOT, 0,"open", ""); opend = TRUE; } else if(opend == TRUE) { close(); llMessageLinked(LINK_ROOT, 0,"close", ""); opend = FALSE; } } } }
|
|
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
|
12-12-2007 19:43
You still need to call llListen or the code in your 'listen' event won't ever run...
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
12-12-2007 21:07
to addres the orignal question (ignoring for a moment the code presented).... in your code, make all your commands lower case (or all uppercase if using llToUpper) then in your listen event listen( integer vIntChannel, string vStrSpeaker, key vKeySpeaker, string vStrHeard ){ vStrHeard = llToLower( vStrHeard ); if ("our command here" == vStrHeard){ //-- do command stuff } }
for even better results use llToLower( llStringTrim( vStrHeard, STRING_TRIM ) ) to get rid of leading trailing spaces (also good for reading from notecards) if testing for chained commands, or commands followed by a variable you can test for if (!(llSubStringIndex( vStrHeard, "our command here" ))){ //-- test to make sure our command starts the string or if (~llSubStringIndex( vStrHeard, "our command here" )){ //-- test to see if our command was in the string
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Day Oh
Registered User
Join date: 3 Feb 2007
Posts: 1,257
|
12-12-2007 22:20
Ooooooohh.... oops, LINK_ROOT won't for single-prim objects, because LINK_ROOT == 1 Try 0 instead 
|
|
MCM Villiers
Registered User
Join date: 7 Oct 2007
Posts: 39
|
12-12-2007 23:18
From: Day Oh Ooooooohh.... oops, LINK_ROOT won't for single-prim objects, because LINK_ROOT == 1 Try 0 instead  I have seen it, I think its actually 3 prims edit: I told you in world to reset the script....I did it with mine AFTER setting everything to its default settings and it works fine....If it still doesnt work contact me in world Mrc and I'll show you exactly what I did 
|
|
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
|
12-13-2007 08:06
i reseted the script and it didnt work for me lol ill retest it then, and voids worked
|