commit justin's grafitti board to the base OpenSim script

library.
0.6.0-stable
Sean Dague 2008-06-18 22:56:04 +00:00
parent 6dea8f3435
commit 6753578465
3 changed files with 96 additions and 1 deletions

View File

@ -0,0 +1,74 @@
// 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);
}

View File

@ -146,4 +146,12 @@
<Key Name="inventoryType" Value="10" /> <Key Name="inventoryType" Value="10" />
<Key Name="fileName" Value="osWeatherMap.lsl" /> <Key Name="fileName" Value="osWeatherMap.lsl" />
</Section> </Section>
<Section Name="GraffitiBoard">
<Key Name="assetID" Value="fdb637ae-e4fe-f220-62f0-9f9b5c0c2cdb" />
<Key Name="name" Value="GraffitiBoard" />
<Key Name="assetType" Value="10" />
<Key Name="inventoryType" Value="10" />
<Key Name="fileName" Value="GraffitiBoard.lsl" />
</Section>
</Nini> </Nini>

View File

@ -313,4 +313,17 @@
<Key Name="everyonePermissions" Value="257487132" /> <Key Name="everyonePermissions" Value="257487132" />
<Key Name="basePermissions" Value="257487132" /> <Key Name="basePermissions" Value="257487132" />
</Section> </Section>
<Section Name="GrafittiBoard">
<Key Name="inventoryID" Value="fdb637ae-e4fe-f220-62f0-9f9b5c0c2cdb" />
<Key Name="assetID" Value="fdb637ae-e4fe-f220-62f0-9f9b5c0c2cdb" />
<Key Name="folderID" Value="284858c8-9391-6bf1-ddf5-b936f73de853" />
<Key Name="description" Value="A text board that records what you say - contributed by Justin Clarke Casey" />
<Key Name="name" Value="GrafittiBoard" />
<Key Name="assetType" Value="10" />
<Key Name="inventoryType" Value="10" />
<Key Name="currentPermissions" Value="257487132" />
<Key Name="nextPermissions" Value="257487132" />
<Key Name="everyonePermissions" Value="257487132" />
<Key Name="basePermissions" Value="257487132" />
</Section>
</Nini> </Nini>