Change font size
It is currently Thu Sep 02, 2010 3:05 pm

Forum rules


Image



Post a new topicPost a reply Page 1 of 1   [ 9 posts ]
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 :)

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: 643
Location: Scottsdale, AZ
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();
    }
}

_________________
Image


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: 55
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

_________________
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: 35
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 Aug 02, 2010 4:53 am 

Joined: Mon Jul 12, 2010 4:43 am
Posts: 12
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 139 times ]

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 9 posts ]


Who is online

Users browsing this forum: legacy_google [bot] and 2 guests


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