// (C) 2008 Leben Schnabel - not for commercial purposes without written consent integer Line; string NCName; list Datas; vector TempScale; default { on_rez(integer Dummy) {llResetScript();} state_entry() { llWhisper(0, "Maya Sculpt Importer"); llWhisper(0, "Please drop a notecard with the Maya script in me and the textures i need. Click me to start."); } touch_start(integer total_number) { if (llDetectedKey(0) == llGetOwner()) { NCName = llGetInventoryName(INVENTORY_NOTECARD, 0); if (NCName == "") {llWhisper(0, "Cannot start import, missing Maya script in notecard.");} else {state Start;} } } } state Start { on_rez(integer Dummy) {llResetScript();} state_entry() { llWhisper(0, "Beginning..."); llGetNotecardLine(NCName, Line); } dataserver(key Dummy, string Data) { if (Data != EOF) { if (llToLower(Data) == "newprim") { if (llGetListLength(Datas) > 0) { integer TempChan = llRound(llFrand(100000)) + 100; llRezAtRoot(llGetInventoryName(INVENTORY_OBJECT, 0), llGetPos() + <1, 0, 1>, ZERO_VECTOR, ZERO_ROTATION, TempChan); llSay(TempChan, llDumpList2String(Datas, "^")); Datas = []; } } else { list Temp = llParseString2List(Data, [" "], []); integer i; for (i = 0; i < llGetListLength(Temp); ++i) { if (llList2String(Temp, i) == "-setObjectName") { Datas = (Datas=[]) + Datas + [".Name;" + llList2String(Temp, i + 1)]; i = i + 1; } if (llList2String(Temp, i) == "-setSculpt") { key TextureKey = llGetInventoryKey(llList2String(Temp, i + 1)); if (TextureKey == NULL_KEY) {llWhisper(0, "WARNING: Missing texture " + llList2String(Temp, i + 1));} else { string SculptType = "Spheric"; if (llSubStringIndex(llToLower(llList2String(Temp, i + 1)), "planesculpt") != -1) {SculptType = "Plane";} if (llSubStringIndex(llToLower(llList2String(Temp, i + 1)), "cylindersculpt") != -1) {SculptType = "Cylinder";} Datas = (Datas=[]) + Datas + [".Sculpt;" + (string)TextureKey + ";" + SculptType]; i = i + 1; } } if (llList2String(Temp, i) == "-setTexture") { key TextureKey = llGetInventoryKey(llList2String(Temp, i + 1)); if (TextureKey == NULL_KEY) {llWhisper(0, "WARNING: Missing texture " + llList2String(Temp, i + 1));} else { Datas = (Datas=[]) + Datas + [".Texture;" + (string)TextureKey]; i = i + 1; } } if (llList2String(Temp, i) == "-setScale") { TempScale = <llList2Float(Temp, i + 1), llList2Float(Temp, i + 2), llList2Float(Temp, i + 3)>; Datas = (Datas=[]) + Datas + [".Scale;<" + llList2String(Temp, i + 1) + "," + llList2String(Temp, i + 2) + "," + llList2String(Temp, i + 3) + ">"]; i = i + 3; } if (llList2String(Temp, i) == "-gotoRelativePos") { Datas = (Datas=[]) + Datas + [".Pos;<" + (string)(llList2Float(Temp, i + 1) * TempScale.x) + "," + (string)(llList2Float(Temp, i + 2) * TempScale.y) + "," + (string)(llList2Float(Temp, i + 3) * TempScale.z) + ">"]; i = i + 3; } } } Line = Line + 1; llGetNotecardLine(NCName, Line); } else { if (llGetListLength(Datas) > 0) { integer TempChan = llRound(llFrand(100000)) + 100; llRezAtRoot(llGetInventoryName(INVENTORY_OBJECT, 0), llGetPos() + <1, 0, 1>, ZERO_VECTOR, ZERO_ROTATION, TempChan); llSay(TempChan, llDumpList2String(Datas, "^")); } llWhisper(0, "Done."); llResetScript(); } } }