Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

A little problem with llInstantMessage

Alayn Erin
Registered User
Join date: 9 May 2009
Posts: 3
05-11-2009 13:34
http://pastebin.com/m488cf98c
The problem is at the very bottom in the http_response, i placed some notes.
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
05-11-2009 14:32
From: Alayn Erin
http://pastebin.com/m488cf98c
The problem is at the very bottom in the http_response, i placed some notes.


The problem is that you are trying to send the IM to the wrong key. The llHTTPRequest function generates a key for the request. THAT's the key that the dataserver event is receiving. If you want to send an IM to an avatar, you have to use the avatar's key, not that one.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Alayn Erin
Registered User
Join date: 9 May 2009
Posts: 3
05-11-2009 14:35
How can I pass the avatars key to the http_response state?
Alayn Erin
Registered User
Join date: 9 May 2009
Posts: 3
05-11-2009 14:43
I got it.

I set a key in the beginning, then I change the key when its ran. It can be used anywhere in my script now.
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
05-11-2009 14:53
From: Alayn Erin
How can I pass the avatars key to the http_response state?


When you make a llHTTPRequest call, the call creates the key. Just assign it to a variable....

key CallOne = llHTTPRequest(url ,[HTTP_METHOD,"GET"],"");

Your dataserver will receive any calls it gets from any llHTTPRequst function, so you may want to filter to be sure that it's responding to YOUR requests instead of those from another script, and you may want a different action from different calls in your own script. So you write

CODE
 
http_response(key request_ id, integer status, list data, string body)
{
if (request_id == CallOne)
{ // Do stuff}
else if (request_id == CallTwo)
{//Do different stuff}
else
{return;}
}
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
05-11-2009 15:26
From: Alayn Erin
I got it.

I set a key in the beginning, then I change the key when its ran. It can be used anywhere in my script now.


Yes, and in fact you could use a different key for each llHTTPRequest in your script if you wanted to. That way, you could tailor the actions in the dataserver event to do different things for each call (IM a different avatar, for example, or send a different piece of information). Incidentally, it's a good idea to build a test into your dataserver event to be sure that it's listening to YOUR calls, even if you use the same key for each one.

dataserver (key request_id, integer status, list data, string body)
{
if (request_id == myHTTPRequest) //myHTTPRequest is the key of your call
{//Do stuff}
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at