Change font size
It is currently Mon Nov 19, 2018 10:44 am

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 2   [ 15 posts ]
Go to page 1, 2  Next
Author Message
 Post subject: Graffiti board script
PostPosted: Fri May 09, 2008 5:26 pm 

Joined: Fri May 09, 2008 5:13 pm
Posts: 1
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 :)

{L_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);
}


Top
 Profile  
 
 Post subject: Re: Graffiti board script
PostPosted: Fri May 09, 2008 7:51 pm 

Joined: Fri Mar 14, 2008 4:29 am
Posts: 17
:D awesome..a script with 1,000s of uses..thank you


Top
 Profile  
 
 Post subject: Re: Graffiti board script
PostPosted: Thu Sep 11, 2008 10:57 pm 

Joined: Mon Jul 28, 2008 8:40 pm
Posts: 7
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!


Top
 Profile  
 
 Post subject: Re: Graffiti board script
PostPosted: Fri Sep 12, 2008 2:59 am 
Site Admin
User avatar

Joined: Sat Feb 02, 2008 5:27 pm
Posts: 843
here is the new version recent changes to the compiler required this script be updated slightly.
{L_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();
    }
}


Top
 Profile  
 
 Post subject: Re: Graffiti board script
PostPosted: Mon Nov 10, 2008 3:54 am 
Furious Typer

Joined: Sun Nov 09, 2008 10:14 pm
Posts: 59
Thanks

_________________
[Kane_Hart] on IRC!


Top
 Profile  
 
 Post subject: Re: Graffiti board script
PostPosted: Mon Nov 10, 2008 7:31 pm 
User avatar

Joined: Sun Oct 05, 2008 8:31 am
Posts: 22
Location: Tampabay, Fl
awsome

_________________
{L_IMAGE}


Top
 Profile  
 
 Post subject: Re: Graffiti board script
PostPosted: Wed Mar 04, 2009 7:41 pm 

Joined: Wed Mar 04, 2009 7:39 pm
Posts: 1
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?


Top
 Profile  
 
 Post subject: Re: Graffiti board script
PostPosted: Wed Feb 10, 2010 10:11 pm 
User avatar

Joined: Thu Aug 06, 2009 9:11 pm
Posts: 43
Location: NYC
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!


Top
 Profile  
 
 Post subject: Re: Graffiti board script
PostPosted: Mon Dec 19, 2011 7:35 pm 

Joined: Fri Oct 14, 2011 5:09 pm
Posts: 6
I began having this same error on the console ( and similar ones after the first one) after enabling the ossl functions required for graffitti board. My Opensim install is Diva's most recent version using a win'08-R2 server, mySQL. In the viewer- the inventory shows 'clocking' mouse cursor when this occurs.

This installation was working with no problems for several days after i activated the ossl commands. It was not until several days later that i began using the graffitti scripts thereby precipitating these errors. Even when i stop editing the specific prim with these script commands, the server continues to throw similar errors while trying to update or create other items (with no graffitti-esque statements in them). The only way to stop these console errors is to not only restart opensim.exe but also stop and restart the mysql service.

Any suggestions on how to troubleshoot this?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 2   [ 15 posts ]
Go to page 1, 2  Next


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net