Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
archiv:opensim:downloads:scripts:skype [2024/01/24 16:39] – Externe Bearbeitung 127.0.0.1 | archiv:opensim:downloads:scripts:skype [Unbekanntes Datum] (aktuell) – Externe Bearbeitung (Unbekanntes Datum) 127.0.0.1 | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | ===== Skype Online Status ===== | ||
+ | < | ||
+ | string skype_handle = " | ||
+ | |||
+ | key skype_request_id = NULL_KEY; // id of http request | ||
+ | |||
+ | showStatus(string skype_status) | ||
+ | { | ||
+ | // build up our message | ||
+ | string message = " | ||
+ | message += " | ||
+ | message += " | ||
+ | | ||
+ | // write out the message as hovering text | ||
+ | llSetText(message, | ||
+ | } | ||
+ | default | ||
+ | { | ||
+ | touch_start(integer total_number) | ||
+ | { | ||
+ | // make sure owner has specified handle | ||
+ | if(skype_handle == "" | ||
+ | { | ||
+ | // send message to debugger | ||
+ | llWhisper(DEBUG_CHANNEL, | ||
+ | return; | ||
+ | } | ||
+ | | ||
+ | // prevent extra requests happening at the same time | ||
+ | if(skype_request_id != NULL_KEY) return; | ||
+ | | ||
+ | // make a request over the internet | ||
+ | skype_request_id = llHTTPRequest(" | ||
+ | | ||
+ | // set a timeout for http request | ||
+ | llSetTimerEvent(5); | ||
+ | } | ||
+ | http_response(key request_id, integer status, list metadata, string body) | ||
+ | { | ||
+ | // is this a response to our request? | ||
+ | if(request_id == skype_request_id) | ||
+ | { | ||
+ | // show status | ||
+ | showStatus(body); | ||
+ | | ||
+ | // change to view state | ||
+ | state viewing; | ||
+ | } | ||
+ | |||
+ | } | ||
+ | timer() | ||
+ | { | ||
+ | // didn't get a response in time. | ||
+ | showStatus(" | ||
+ | | ||
+ | // change to view state | ||
+ | state viewing; | ||
+ | } | ||
+ | } | ||
+ | state viewing | ||
+ | { | ||
+ | state_entry() | ||
+ | { | ||
+ | // set next timer for 3 minutes | ||
+ | llSetTimerEvent(180); | ||
+ | } | ||
+ | timer() | ||
+ | { | ||
+ | state default; | ||
+ | } | ||
+ | state_exit() | ||
+ | { | ||
+ | // stop the timer | ||
+ | llSetTimerEvent(0); | ||
+ | |||
+ | // hide the text | ||
+ | llSetText("", | ||
+ | | ||
+ | // reset the request id | ||
+ | skype_request_id = NULL_KEY; | ||
+ | } | ||
+ | } | ||
+ | </ |