Jump to content

chalk board script


Tyhe
 Share

You are about to reply to a thread that has been inactive for 3534 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

  • 3 weeks later...

That was one of my first scrips! =D

I have a simple "chalk board" that has a color pallete at the side, just select your color and draw.

The lines are temp prims so they disapear after about a min, but it doesn't take up all the prims on your land =P

 

One sec while I go fine those scripts..

EDIT:

 This most likly isn't the "best" way to do this, but it works.

 

The Board Drawing Script:

Place in same prim as Line object

 

vector s;vector f;vector r;vector last;rotation n;float dist;vector color;list parts;line(){    s = llDetectedTouchPos(0);            r = (s+f)/2;            n = llEuler2Rot®;            dist = llVecDist(s,f);        llRezObject("line",r,ZERO_VECTOR,n,0);        llSleep(.02);        llSay(5,(string)llGetOwner() + "|<.05,.05," + (string)dist + ">");llSleep(.02);        llSay(4,(string)llGetOwner() + "|" + (string)color);        llSleep(.02);        llSay(6,(string)llGetOwner() + "|"+ (string)s);        f = s;    }default{    changed(integer change)    {        if(change & CHANGED_OWNER)        {            llResetScript();        }    }    state_entry()    {        llMessageLinked(LINK_SET,1,"reset",NULL_KEY);    llListen(0,"",llGetOwner(),"");}link_message(integer sender, integer channel, string message, key id)    {        if(channel == 1)        {          color = (vector)message;        }    }    listen(integer channel, string name, key id, string message)     {          parts = llParseString2List(message,["."],[]);            string cmd = llToLower(llList2String(parts,0));            string cmd1 = llToLower(llList2String(parts,1));            if(cmd == "set")            {         color = (vector)cmd1;                  llSay(0,"new color " + (string)color);        }    }    touch(integer mum)    {                line();    }        touch_end(integer num)    {        llResetScript();    }}

 

The "Line" Script:

Place it in a small prim named "Line" and make it a temp prim and place that in the board with the Drawing script

 

list parts;default{    state_entry()    {        llListen(5,"","","");        llListen(4,"","","");        llListen(6,"","","");    }listen(integer channel, string name, key id, string message)     {          parts = llParseString2List(message,["|"],[]);            string cmd = llToLower(llList2String(parts,0));            string cmd1 = llToLower(llList2String(parts,1));         if(cmd == llGetOwner())         {            if(channel == 5)         {             llSetScale((vector)cmd1);        }        if(channel == 4)         {             llSetColor((vector)cmd1,ALL_SIDES);        }        if(channel == 6)        {            llLookAt((vector)cmd1,20,.1);            state lock;        }    }    }}state lock{    state_entry()    {        llListen(0,"",llGetOwner(),"");    }    listen(integer channel, string name, key id, string message)     {         if(message == "clean")         {             llDie();            }        }}

 

Color selector script:

place in a colored prim and link it to the board (may be used multiple times in multiple colored prims)

vector c;default{    touch_start(integer total_number)    {        c = llGetColor(ALL_SIDES);        llMessageLinked(LINK_SET,1,(string)c,NULL_KEY);    }}

 

Current Color script Visual:

Put in any prim and link it to the Board, this script shows your currently selected color

vector c;default{    link_message(integer sender, integer channel, string message, key id)    {        if(channel == 1)        {             if(message == "reset")            {                 c = llGetColor(ALL_SIDES);        llMessageLinked(LINK_SET,1,(string)c,NULL_KEY);            }            else            {                llSetColor((vector)message,ALL_SIDES);            }        }                        }}

 

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...
You are about to reply to a thread that has been inactive for 3534 days.

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
 Share

×
×
  • Create New...