osgrid.org
http://osgrid.org/forums/

Graffiti board script
http://osgrid.org/forums/viewtopic.php?f=5&t=89
Page 1 of 1

Author:  Nitsuj Yesac-Kralc [ Fri May 09, 2008 5:26 pm ]
Post subject:  Graffiti board script

When I saw a demonstration by sdague of MW's excellent dynamic texture module, I decided to knock up a quick 'graffiti board'. This listens for text on a channel, adds received text to existing text, and dynamically generates a texture to display everything. As you can see, it's small, primitive and aching to be enhanced :)

Code:
// 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 = "";

int 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!
int CHARS_WIDTH = 42;

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();
    }
}

// Add some additional graffiti
void 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
void clearGraffiti()
{
    text = "";
}

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

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

Author:  Monk Zymurgy [ Fri May 09, 2008 7:51 pm ]
Post subject:  Re: Graffiti board script

:D awesome..a script with 1,000s of uses..thank you

Author:  Vivian Calibre [ Thu Sep 11, 2008 10:57 pm ]
Post subject:  Re: Graffiti board script

Ok, this one is killing me. I figured out that INT should be INTEGER but now I am getting syntax errors on the VOID statements towards the end.

Help please!

Author:  Nebadon Izumi [ Fri Sep 12, 2008 2:59 am ]
Post subject:  Re: Graffiti board script

here is the new version recent changes to the compiler required this script be updated slightly.
Code:
// 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();
    }
}

Author:  kane hart [ Mon Nov 10, 2008 3:54 am ]
Post subject:  Re: Graffiti board script

Thanks

Author:  George Taggart [ Mon Nov 10, 2008 7:31 pm ]
Post subject:  Re: Graffiti board script

awsome

Author:  legacy_htaedfororreteht [ Wed Mar 04, 2009 7:41 pm ]
Post subject:  Re: Graffiti board script

I keep getting the Name not defined within scope error. on any scripts I try to use in here. Can someone inform me on what I should do?

Author:  erik nauman [ Wed Feb 10, 2010 10:11 pm ]
Post subject:  Re: Graffiti board script

I love this, but I keep getting an error. It will work once, then next time OpenSim will give an "assertion failed" alert with the option to abort, retry, or ignore. If I ignore I can use the graffiti board successfully but if I abort OpenSim crashes. The assertion failed message is "Allocated element is not free." and below many lines of "at..." with different script commands. I know that part is probably the most important but I couldn't copy it off the alert. I think it has to do with the osDynamicTexture function.
Any suggestions I would appreciate it!

Author:  Kahn Khalim [ Mon Aug 02, 2010 4:53 am ]
Post subject:  Re: Graffiti board script

I get same thing.. not with this script, but another I use that uses the function osDynamicTexture.

mine is on a timer, and everytime it executes, I get a popup :( (see attached Pics)

It is a real nusiance when it pops up on the server (windows 2003) and halts opensim until you respond.

I am running a standalone megaregion(5x5) using Diva install.

Is there a way to eliminate the popups at least?

NOTE: I run the same object w/same script on another instance on a different server connected to OSGrid with no problems..(Eureka regions)

Exa1
Attachment:
File comment: First Example
exa1.JPG
exa1.JPG [ 49.11 KiB | Viewed 185 times ]

Exa2
Attachment:
File comment: Second Example
exa2.JPG
exa2.JPG [ 51.3 KiB | Viewed 185 times ]

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/