Difference between revisions of "User:Cow Taurog/Sim map texture"

From Second Life Wiki
Jump to navigation Jump to search
(fixing arguments. script had bug for faces 0 and 1 otherwise)
(revert, my bugfix beat the other bugfix, resulting in a double bugfix, which unfixed the bugfix)
Line 11: Line 11:
     state_entry(){gkReq=llHTTPRequest("http://www.subnova.com/secondlife/api/map.php?sim="+llEscapeURL(llGetRegionName()),[],"");}
     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){
     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]);}}
         if(id==gkReq){if(status==200){llSetPrimitiveParams([PRIM_COLOR,giFace,<1,1,1>,1,PRIM_TEXGEN,giFace,PRIM_TEXGEN_DEFAULT,PRIM_TEXTURE,giFace,(key)body,<1,1,0>,ZERO_VECTOR,0]);}}
         llRemoveInventory(llGetScriptName());
         llRemoveInventory(llGetScriptName());
     }
     }
}
}
</lsl>
</lsl>

Revision as of 13:24, 13 March 2009

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,PRIM_TEXGEN,giFace,PRIM_TEXGEN_DEFAULT,PRIM_TEXTURE,giFace,(key)body,<1,1,0>,ZERO_VECTOR,0]);}}
       llRemoveInventory(llGetScriptName());
   }

} </lsl>