|
Aniam Ingmann
llOwnage(float pwnage);
Join date: 22 Oct 2005
Posts: 206
|
10-22-2007 04:09
So I'm trying to write an Instant Message script. It won't confirm the link_message in the second script (it sends the name heard by the owner to the other script in the root prim) and then requests the names key from Name2Key database at w-hat. What exactly is going wrong? Hear name script: From: someone string NAME; string URL = "http://w-hat.com/name2key"; key reqid; default { state_entry() { llListen(2,"",llGetOwner(),""  ; } listen(integer c, string n, key id, string msg) { if (msg=="im"|msg=="instant message"  { state im; } } } state im { state_entry() { llOwnerSay("Please say the name you want to IM in channel 5."  ; llListen(5, "", llGetOwner(),""  ; } listen(integer c, string n, key id, string msg) { if (c == 5) { NAME = msg; llOwnerSay("Name: "+NAME+" confirmed"  ; llMessageLinked(LINK_ROOT,LINK_ROOT,NAME,NULL_KEY); llResetScript(); } } } Hear message/IM script: From: someone string NAME; integer listen1; key reqid; key gKey; string URL="http://w-hat.com/name2key"; default { on_rez(integer sp) { llResetScript(); } link_message(integer sn, integer n, string str, key id) { if (n ==1) { str = NAME; llOwnerSay("You want to IM "+NAME+"."  ; listen1 = llListen(5, "", llGetOwner(),""  ; reqid = llHTTPRequest( URL + "?terse=1&name="+llEscapeURL(NAME), [], "" ); } } http_response(key id, integer status, list meta, string body) { if (status==499){ llOwnerSay("Sorry, there was an error. Please start over."  ; } if ((key)body == NULL_KEY){ llOwnerSay("No key found for "+NAME); } else { gKey = body; llOwnerSay("Say your message in channel 5."  ; llOwnerSay("Instant messaging key: "+(string)gKey); } } listen(integer c, string n, key id, string msg) { if (c ==5) { llInstantMessage((key)gKey,"["+llKey2Name(llGetOwner())+"] "+msg); llOwnerSay("Instant message: '"+msg+"' sent to ["+NAME+"]."  ; llResetScript(); } } }
_____________________
From: someone Don't worry, Aniam is here! - Noob
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
10-22-2007 05:06
O I love when I make mistakes like you did here: 2nd script: "str = NAME;" should be: NAME = str 
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
Trevor Langdon
Second Life Resident
Join date: 20 Oct 2004
Posts: 149
|
10-22-2007 09:46
Besides the error pointed out by Jesse, you are also using the wrong comparision operator in the name script: From: Aniam Ingmann if (msg=="im"|msg=="instant message"  That should be: if (msg=="im"||msg=="instant message") You are using a Bitwise OR instead of a Comparison OR, so your results won't be what you expect.
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
10-22-2007 10:11
From: Trevor Langdon Besides the error pointed out by Jesse, you are also using the wrong comparision operator in the name script: That should be: if (msg=="im"||msg=="instant message") You are using a Bitwise OR instead of a Comparison OR, so your results won't be what you expect. It works as is with input of "im" OR "instant message. But Trevor is correct and the proper usage would be the logical Binary operator || but don't worry it will still work when you change it. Edit: My 3rd edit. Note to self, stay out of forums when you stay home from work and have to take a pain pill!!! Non-sensical posts may be the result!!! The bad thing is that I was finally able to finish a multi script project I had been working off and on for the last month. I just really got into the flow of it today. After testing, scripts work beautifully, are sim freindly and very fast. Unfortunately I haven't commented the work I did today yet and I am afraid it is going to take a week now just to figure out what all the heck I did 
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|