Syngravez Posted May 1, 2015 Share Posted May 1, 2015 Hello Forum!, Hi guys i'm back yet again! , a came across something which anyone one of you could possibly help me on with?Anywho i was trying to help a friend out with a Typer and then"Saving" the prim's colour on all faces! , but the thing is that it has multiple faces which all the faces on that one prime are being "Saved". There are mutiple of face as this is a mesh object i'm trying script has two sides as it is a Font. The faces(In one mesh):0, 1, 2, 3 (The middle part of the Font)4, 5 (The sides of the Font) Anyway to which i'm stuck on, I've managed to get the colour saver to save the entire prim's colour but whenever i set the sides faces to a different colour and then add my script in it doesn't seem to save the sides but only the entire prim.The functionality of this script is to pretty much put this in anything saving all the faces of that one prim and then when changed back to normal colour as it was before. Heres my work so far:vector SavedColour; float GlowSize = 0.10; SaveEverything() { SavedColour = llGetColor(0); } SetSavedThings() { llSetLinkAlpha(LINK_SET,1.0,ALL_SIDES); llSetLinkPrimitiveParamsFast(LINK_SET, [18,-1,SavedColour,1]); llSetLinkPrimitiveParamsFast(LINK_SET, [25,-1,GlowSize]); } BackToNorm() { llSetLinkPrimitiveParamsFast(LINK_SET, [18,-1,SavedColour,1]); llSetLinkPrimitiveParamsFast(LINK_SET, [25,-1,0]); llSetLinkAlpha(LINK_SET,0.0,ALL_SIDES); } default { state_entry() { SaveEverything(); state SetThis; // llSay(0, "state_entry can **bleep** off for the moment!"); } attach(key attached) { if(attached == llGetOwner()) { llResetScript(); //llSetLinkAlpha(LINK_SET,0.0,ALL_SIDES); }}} /////////////////////[Where the fun beings]//////////////////// state SetThis { state_entry() { llSetTimerEvent(0.0000001); } attach(key attached) { if(attached == llGetOwner()) { llResetScript(); }} timer() { if (llGetAgentInfo(llGetOwner()) & AGENT_TYPING) { SetSavedThings(); } else { BackToNorm(); } } }If anyone can help me out me with this problem i would be truly greatful. Yet it will be helpful to me and the forum if anyone else has encountered this problem before.Thanks in advanaced =] Link to comment Share on other sites More sharing options...
Ron Khondji Posted May 1, 2015 Share Posted May 1, 2015 llSetLinkPrimitiveParamsFast(LINK_SET, [ PRIM_COLOR, integer face, vector color, float alpha ]); In your case integer face = -1 which is ALL_SIDES. What you should do is first get the face colors of each face with llGetLinkPrimitiveParams() in a loop and save those numbers in a list. Then you can allways restore the colors later. 1 Link to comment Share on other sites More sharing options...
Syngravez Posted May 1, 2015 Author Share Posted May 1, 2015 Would you please give me a example of looping those in a list and restoring ?, as i'm truly stuck on this. Well to be honest i haven't really worked with faces and colour saving at all so it's all new to me. P.S - I also tried your method and i wouldn't know to return the value of the list and reset the different colour on the sides. Link to comment Share on other sites More sharing options...
Ron Khondji Posted May 1, 2015 Share Posted May 1, 2015 Here ya go: list Colors; // strided list [linknumber, facenumber, color, alpha, linknumber, facenumber, color, alpha, etc]SaveColors() { Colors = []; integer i; integer links = llGetNumberOfPrims(); integer faces; if (links == 1) links = 0; else i = 1; do { faces = llGetLinkNumberOfSides(i); integer j; do { list temp = llGetLinkPrimitiveParams(i, [PRIM_COLOR, j]); Colors += [i, j, llList2Vector(temp, 0), llList2Float(temp, 1)]; } while (++j < faces); } while(++i <= links);}RestoreColors() { if (Colors) { integer i; integer end = llGetListLength(Colors); do { integer link = llList2Integer(Colors, i); integer face = llList2Integer(Colors, i + 1); vector color = llList2Vector(Colors, i + 2); float alpha = llList2Float(Colors, i + 3); llSetLinkPrimitiveParamsFast(link, [PRIM_COLOR, face, color, alpha]); } while ((i += 4) < end); }} default { state_entry() { SaveColors(); } touch_start(integer total_number) { RestoreColors(); } changed(integer c) { if (c & CHANGED_LINK) llResetScript(); }} Link to comment Share on other sites More sharing options...
Syngravez Posted May 1, 2015 Author Share Posted May 1, 2015 Oh you're totally awesome! thank you very much, give's me more insight of how to save prims colours and such now. Yet it will help everyone else out if encountering the same problem. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now