|
shenanigan Oh
Registered User
Join date: 28 Apr 2007
Posts: 13
|
01-12-2009 23:48
Hello everyone. I'm working on a security system where it has a code password on it, like a door or safe. Well I'm trying set it up where when you click on object a dialog comes up and your able to change the security code on it and it will change a "string code" like string code = "1234"; but I'm having problem trying figure where to start this is what I end up with. string code = "1234";
if(llGetSubString(message,0,0) == "code") { llOwnerSay("To add a new security code Type the New code with the input c 1234 , Need more help please look at help menu Thank you!"); llSetTimerEvent(35); } if(llGetSubString(message,0,0) == "c") { string code = llGetSubString(message,1,-1);. code = message; llOwnerSay("message changed to " +message); } }
Thanks for the help 
|
|
ab Vanmoer
Registered User
Join date: 28 Nov 2006
Posts: 131
|
01-13-2009 00:59
Hi shenanigan, Note quite sure what you are trying to accomplish, but I noticed a couple of errors in your script The line: if(llGetSubString(message,0,0) == "code"  can never evaluate to true, you are trying to compare the first character of message with a four char string. Lower down you have: string code = llGetSubString(message,1,-1);. code = message; you assign part of the message string to the code string and then in the next line assign the complete message to code.
|
|
shenanigan Oh
Registered User
Join date: 28 Apr 2007
Posts: 13
|
01-13-2009 01:16
Ignore that code ;P I figured it out
string Newcode = message; code = (code="") + code + Newcode;
that right there will change the string at being of the script to a new code 
|
|
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
|
Or you could do something like this:
01-13-2009 02:34
llOwnerSay("To add a new security code Type Old code followed by the New code with a space between them, Need more help please look at help menu Thank you!"); llSetTimerEvent(35);
list temp = llParseString2List(message,[" "],[]); if (llList2String(temp, 0) == code) code = llList2String(temp, 1); else llOwnerSay(0, "Wrong code. Try again.");
|