User:Cow Taurog/Sim map texture

From Second Life Wiki
< User:Cow Taurog
Revision as of 14:14, 13 March 2009 by Zai Lynch (talk | contribs) (fixing arguments. script had bug for faces 0 and 1 otherwise)
Jump to navigation Jump to search

Create a cube, and resize it to the dimensions you would like your map to be. Texture and color the whole thing as you would want the faces that aren't the map to look. Drop this script in, and click the face you would like to put the map on. It will overwrite the color and texture for that face, and make it a map of the sim instead. The script will then delete itself after it is done.

<lsl> integer giFace; key gkReq; default{

   on_rez(integer params){llResetScript();}
   touch_start(integer num){if(llDetectedKey(num-1)==llGetOwner()){giFace=llDetectedTouchFace(num-1);state grab;}}

} state grab{

   state_entry(){gkReq=llHTTPRequest("http://www.subnova.com/secondlife/api/map.php?sim="+llEscapeURL(llGetRegionName()),[],"");}
   http_response(key id,integer status,list meta,string body){
       if(id==gkReq){if(status==200){llSetPrimitiveParams([PRIM_COLOR,giFace,<1,1,1>,1,1.0,PRIM_TEXGEN,giFace,PRIM_TEXGEN_DEFAULT,PRIM_TEXTURE,giFace,(key)body,<1,1,0>,ZERO_VECTOR,0]);}}
       llRemoveInventory(llGetScriptName());
   }

} </lsl>