Tuesday, December 02, 2008
USERLOGIN PASSWORD Remember?
You are here » Learning Center ยป Forums

Openlife Forums

 Openlife Grid Forums
Minimize
 
  Openlife Forums  Scripting  Openlife LSL Ex...  Graffitti board
Previous Previous
 
Next Next
New Post 8/10/2008 12:51 AM
Online now... Julius Volken
27 posts
Openlife Newbie


Graffitti board 

Here is the script of a white board that re-write on it what it is said on a special channel.

I have try it on another grid but not in OLG (can connect for instance), so you can leave your feedbacks!

 

 

// Grafitti board 0.0.2 for OpenSim
// By Justin Clark-Casey (justincc)
// http://justincc.wordpress.com

// This script is available under the BSD License
 
string text = "";

integer LISTENING_CHANNEL = 43;

// XXX Only putting this here as well to get around OpenSim's int -> string casting oddness
string LISTENING_CHANNEL_STRING = "43";

// FIXME: Should be dynamic!
integer CHARS_WIDTH = 42;

// Add some additional graffiti
addGraffiti(string message)
{
    while (llStringLength(message) > CHARS_WIDTH)
    {
        text += "\n\n" + llGetSubString(message, 0, CHARS_WIDTH - 1);
        message = llDeleteSubString(message, 0, CHARS_WIDTH - 1);
    }
   
    text += "\n\n" + message;
}

// Clear the existing graffiti
clearGraffiti()
{
    text = "";
}

// Actually fires the graffiti out to the dynamic texture module
draw()
{
    //llSay(0, text);
    string drawList = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text " + text + ";";

    osSetDynamicTextureData("", "vector", drawList, "1024", 0);
}

default
{
    state_entry()
    {     
        llSetText(
            "Say /" + LISTENING_CHANNEL_STRING + " <message> to add text."
            + "  Say /" + LISTENING_CHANNEL_STRING
            + " !clear to clear board",
            <0.0, 1.0, 0.0>, 1.0);
       
        llListen(LISTENING_CHANNEL, "", NULL_KEY, "");     
       
        addGraffiti("justincc's graffiti board v0.0.2");
        addGraffiti("Now with primitive word wrap!");
        draw();       
    }
   
    listen(integer channel, string name, key id, string message)
    {
        if (message == "!clear")
        {
            clearGraffiti();
        }
        else
        {
            addGraffiti(message);
        }
       
        draw();
    }
}

 
New Post 8/10/2008 8:29 AM
Online now... Julius Volken
27 posts
Openlife Newbie


Re: Graffitti board 

My own feedback : it works :)

 
New Post 8/10/2008 8:38 PM
User is offline Vivian Calibre
9 posts
Openlife Newbie


Re: Graffitti board 

On line 40:

    osSetDynamicTextureData("", "vector", drawList, "1024", 0);

 

I get the following message:

 

Error: Name not defined within scope

 
New Post 9/1/2008 12:17 AM
User is offline Soundwave
9 posts
Openlife Newbie


Re: Graffitti board 

Great work Julius,

I like it alot.

Thanks.


May U Live 2 C The Dawn
 
New Post 9/1/2008 12:30 PM
Online now... Julius Volken
27 posts
Openlife Newbie


Re: Graffitti board 

Thanks for Justin CC. It may be a microblogging tool or a way to share comments, ideas to visitors for your sim. Or a way to put jokes to another friend's board :)

 
New Post 11/28/2008 3:44 PM
Online now... Galen
69 posts
Openlife Apprentice


Re: Graffitti board 

Julius, thanks a lot for this script, i like the messageboard very much

 

I just had the idea of a great improvement for the messageboard.

If the written info on the board could be stored in a notecard inside the prim,

the info on the board would be persistent, even when the sim restarts. And right after the

state_entry, the scripts reads the info from the notecard, and displays it.

Maybe a good programmer will find this useful and can improve the script, unfortunately, at the moment i don't

have the time and mind to do it on my own.

 

Love and light

Galen

 
Previous Previous
 
Next Next
  Openlife Forums  Scripting  Openlife LSL Ex...  Graffitti board
Privacy Statement | Terms Of UseAll Rights Reserved 2007,2008 3DX - Openlifegrid.com