User:Cow Taurog/Exchange rate
This script will say the current L$ exchange rate over public chat when touched. <lsl> // This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License // http://creativecommons.org/licenses/by-sa/3.0/ // Commercial use is allowed. // Modification and/or distribution is allowed, as long as attribution for each revision is given, and the same license is used. // // Cow Taurog's L$ exchange rate finder, v1.0 // // This script will say the current exchange rate of L$ per USD over public chat when touched by anyone // There are no options to change, but feel free to change the code, as long as you abide by the license // string gsURL="http://secondlife.com/httprequest/homepage.php"; // URL of LL's data feed list glRaw; // Storage of the entire data feed key gkReq; // Handler for the HTTP request default{
on_rez(integer param){llResetScript();} // reset when rezzed changed(integer change){if(change&CHANGED_OWNER){llResetScript();}} // reset when owner changes touch_start(integer num){ // when touched by anybody... gkReq=llHTTPRequest(gsURL,[],""); // load the URL } http_response(key req,integer status,list meta,string mess){if(req==gkReq){ // when the URL is loaded... glRaw=llParseString2List(mess,["\n"],[]); // store the entire contents into a list integer iL=(llListFindList(glRaw,["exchange_rate"]))+1; // find the entry named 'exchange_rate', the actual rate is next in the list llSay(0,"Current exchange rate: L$"+(string)llRound(llList2Float(glRaw,iL))+" per $1 USD."); // round off the data to the nearest L$, and say it over public chat }}
} </lsl>