Change font size
It is currently Mon Nov 19, 2018 11:31 am

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 1   [ 10 posts ]
Author Message
 Post subject: Graphics Drawing on a prim
PostPosted: Thu Mar 13, 2008 10:56 pm 

Joined: Sat Feb 02, 2008 5:08 pm
Posts: 16
Grahpics drawing on a prim. This script came from Mw, I can claim no credit.

//cs
public void default_event_state_entry()
{
string drawList = "MoveTo 10,20; LineTo 240,20; ";

drawList += "MoveTo 50,100; Image 100,100,http://opensimulator.org/images/d/de/Opensim_Wright_Plaza.jpg;" ;

drawList += "PenSize 1; ";
drawList += "MoveTo 50,70; Ellipse 20,20; ";
drawList += "MoveTo 90,70; Rectangle 20,20; ";
drawList += "MoveTo 130,70; FillRectangle 20,20; ";
drawList += "FontSize 12; ";
drawList += "MoveTo 15,32; Text Hello and welcome to " + llGetRegionName() +"; ";
drawList += "FontSize 7; MoveTo 70,220; Text The End; ";

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


Top
 Profile  
 
 Post subject: Re: Graphics Drawing on a prim
PostPosted: Fri Mar 21, 2008 8:01 pm 

Joined: Sat Feb 02, 2008 5:08 pm
Posts: 16
This is an updated version of Mw's script. It comes from http://opensimulator.org/wiki/OSSL_TextureDrawing

string osMovePen(string drawList, int x, int y);
string osDrawLine(string drawList, int startX, int startY, int endX, int endY);
string osDrawLine(string drawList, int endX, int endY);
string osDrawText(string drawList, string text);
string osDrawEllipse(string drawList, int width, int height);
string osDrawRectangle(string drawList, int width, int height);
string osDrawFilledRectangle(string drawList, int width, int height);
string osSetFontSize(string drawList, int fontSize);
string osSetPenSize(string drawList, int penSize);
string osSetPenColour(string drawList, string colour);
string osDrawImage(string drawList, int width, int height, string imageUrl);

//cs
public void default_event_state_entry()
{
string drawList = "";

drawList = osDrawLine (drawList, 10,20,240,20);
drawList = osMovePen (drawList, 50,100);
drawList = osDrawImage(drawList, 100,100,"http://opensimulator.org/images/d/de/Opensim_Wright_Plaza.jpg" );
drawList = osSetPenSize (drawList, 1);
drawList = osMovePen (drawList, 50,70);
drawList = osDrawEllipse (drawList, 20,20);
drawList = osMovePen(drawList, 90,70);
drawList = osDrawRectangle (drawList, 20,20 );
drawList = osMovePen (drawList,130,70);
drawList = osDrawFilledRectangle(drawList, 20,20);
drawList = osSetFontSize (drawList, 12 );
drawList = osMovePen (drawList,15,32);

string regionName = llGetRegionName();
drawList = osDrawText (drawList, "Hello and welcome to " + regionName );

drawList = osSetFontSize (drawList, 7);
drawList = osSetPenColour (drawList, "blue");
drawList = osMovePen (drawList, 70,220);
drawList = osDrawText (drawList, "The End");
osSetDynamicTextureData("", "vector", drawList, "", 0);
}


Top
 Profile  
 
 Post subject: Re: Graphics Drawing on a prim
PostPosted: Sat Mar 22, 2008 8:22 am 
Furious Typer
User avatar

Joined: Sat Feb 02, 2008 10:02 pm
Posts: 104
Location: Romania, Bucharest
So what does this script do exactly? You can draw with the mouse pointer on the surface of a prim just like drawing in paintbrush with the painting tool on the paper? That's awesome then :)


Top
 Profile  
 
 Post subject: Re: Graphics Drawing on a prim
PostPosted: Thu Jan 15, 2009 1:45 pm 

Joined: Thu Jan 15, 2009 1:40 pm
Posts: 18
hello all,
I resident am on the new world grid.
I am new here and as all newbies I come with some questions :) .
I wanted to use ossl texture drawing to draw texts on prims that includes ";" and accentuated caracters.
Test is read from a notecard. When i draw it I get the text truncated at ";" position and ???? instead of an accentuated caracter.
Is there an issue to this problem ?

Thanks for your answers


Top
 Profile  
 
 Post subject: Re: Graphics Drawing on a prim
PostPosted: Sun Jan 25, 2009 10:16 am 
OSG Elite
User avatar

Joined: Wed Nov 19, 2008 6:22 pm
Posts: 592
Hi there,


i can´t get beyond a

Primitive: Error compiling script:
Line (-1,33) syntax error

even with cs as optional compiler in OpenSim.ini

if i change it to
//c#
string osMovePen(string drawList, int x, int y);
string osDrawLine(string drawList, int startX, int startY, int endX, int endY);
...

i get an error
//c#
string osMovePen(string drawList, int x, int y);
string osDrawLine(string drawList, int startX, int startY, int endX, int endY);


anything futher i have to to ??

cheers
Ralf

_________________
visit me:

osgrid: Sharkland Tropical 1 SL: Great white shark

German opensim HowTo: http://www.ralf-haifisch.biz/Opensim%20HowTo.shtml
Mapxing - 3D web magazine devotet to opensource: http://opensim.maxping.org/


Top
 Profile  
 
 Post subject: Re: Graphics Drawing on a prim
PostPosted: Tue Feb 10, 2009 10:16 pm 
Furious Typer
User avatar

Joined: Fri Jan 16, 2009 12:19 am
Posts: 58
Location: Orlando, FL - USA
Hi Ralf,

I am to understand that XEngine is the compiler that recognizes osDraw* functions and should be set to the default compiler in opensim.ini... perhaps my source on the wiki is outdated though I know it has mentioned the allowance of multiple compilers, but I'm not sure of the settings for using that configuration. Also the //c# as the first line in your script is telling the compiler to read your script as c#'d code not LSL... for that purpose the script should be written in c# and naming conventions for variable types are different e.g. 'string' type in LSL would require the 'LSL_Types.LSLString' equivalent in c#. To that end I am no further help as I know nothing about c# :)... sorry about that, but I hope the basic explanation helps.

The following config works fine for me:

[XEngine]
Enabled = true
MinThreads = 2
MaxThreads = 100
IdleTimeout = 60
Priority = "BelowNormal"
MaxScriptEventQueue = 300
ThreadStackSize = 262144
AsyncLLCommandLoopms = 50
WriteScriptSourceToDebugFile = false
DefaultCompileLanguage = lsl
AllowedCompilers=lsl
CompileWithDebugInformation = true
AllowOSFunctions = true
OSFunctionThreatLevel = VeryHigh
SaveInterval = 120
MaintenanceInterval = 10
EventLimit = 30
KillTimedOutScripts = false
ScriptDelayFactor = 1.0
ScriptDistanceLimitFactor = 1.0

and here's a script that I've gotten to work:

// this is because I'm too lazy to type the quoted texts repeatedly...
string _m = "MoveTo ";
string _l = "LineTo ";
string _b = "Rectangle ";
string _x = "FillRectangle ";
string _e = "Ellipse ";
//string _o = "FillEllipse "; // invalid parameter - not implemented
string _t = "Text ";
string _f = "FontName ";
string _c = "PenColour ";
string _s = "FontSize ";
string _p = "PenSize ";

string dump_draw(list draw)
{
// and this is because I'm too lazy to type ";" 50 times :)
return llDumpList2String(draw, ";");
}

default
{
state_entry()
{
// draw an arbitrary line across the top
list drawList = [_c + "green", _m + "99,99", _l + "923,99"];
// with endless tweaking this comes very close to drawing a filled elipse
// perhapse this can be used to write a get_ellipse_filled() funtion... but at a later time
drawList += [_p + "50", _c + "red", _m + "541,274", _e + "139,50"]; // adjust for major axis
drawList += [_p + "40", _c + "red", _m + "531,273", _e + "160,52"]; // adjust for minor axis
// outline the ellipse that we filled in
//the previous fill pattern (major axis, minor axis) is derived from the following line
drawList += [_p + "0", _c + "lightblue", _m + "511,249", _e + "200,100"];
// draws a box
drawList += [_c + "red", _m + "100,511", _x + "80, 22"];
// precursor for drawing a rotated box
drawList += [_p + "100", _c + "lightgreen", _m + "200,400", _l + "300,600"];
// puts text inside the first box
drawList += [_f + "courier", _s + "14", _c + "blue", _m + "100,511", _t + "It Works!"];
// take my list of junk and format it for osSetDynamic*
string draw = dump_draw(drawList);
osSetDynamicTextureData("", "vector", draw, "1024", 0);
}
}


** Take Note ** - I highly recommend reading the section pertaining to osThreatLevel before enabling the os functions in /grid mode/. I am using OSFunctionThreatLevel=VeryHigh because I'm developing scripts that use the osMessageObject function on my /stand alone/. That information can be found in the far right column on this page - http://opensimulator.org/wiki/OSSL_Implemented

Any one else who has a link to a deeper discussion on the subject of OSFuncitonThreatLevel I would be happy to refer to it :)

Yours,
-Nolo

_________________
Within the great calm exists an even greater fury waiting to be unleashed with effortless intent.


Top
 Profile  
 
 Post subject: Re: Graphics Drawing on a prim
PostPosted: Tue Feb 10, 2009 10:50 pm 
Furious Typer
User avatar

Joined: Fri Jan 16, 2009 12:19 am
Posts: 58
Location: Orlando, FL - USA
The above post needs correction for the following to get XEngine up in opensim.ini:

DefaultScriptEngine = XEngine

[XEngine]
Enabled = true
MinThreads = 2
MaxThreads = 100
IdleTimeout = 60
Priority = "BelowNormal"
MaxScriptEventQueue = 300
ThreadStackSize = 262144
AsyncLLCommandLoopms = 50
WriteScriptSourceToDebugFile = false
DefaultCompileLanguage = lsl
AllowedCompilers=lsl
CompileWithDebugInformation = true
AllowOSFunctions = true
OSFunctionThreatLevel = VeryHigh
SaveInterval = 120
MaintenanceInterval = 10
EventLimit = 30
KillTimedOutScripts = false
ScriptDelayFactor = 1.0
ScriptDistanceLimitFactor = 1.0

... and in mentioning XEngine as a compiler I was wrong - XEngine vs. ScriptEngine.DotNetEngine are script engines where compilers are lsl, cs, vb, yp, etc.

So for compiling C# scripts with //cs, the lines above would read:

...
DefaultCompileLanguage = lsl
AllowedCompilers = lsl, cs
...

My apologies!

Best Regards,
Nolo

_________________
Within the great calm exists an even greater fury waiting to be unleashed with effortless intent.


Top
 Profile  
 
 Post subject: Re: Graphics Drawing on a prim
PostPosted: Mon Feb 23, 2009 7:37 am 

Joined: Wed Jan 07, 2009 8:39 am
Posts: 1
Where should the script be put in to?
And how does 'Graphics Drawing on a prim' work?


Top
 Profile  
 
 Post subject: Re: Graphics Drawing on a prim
PostPosted: Mon Mar 23, 2009 8:12 am 

Joined: Fri Mar 13, 2009 10:27 am
Posts: 4
I'm trying to write text with a different font. I've uploaded lcars.ttf to my server and installed it as a font, but when I use "FontName lcars; " in my drawlist, it won't use that font. I can get it to use Arial, Courier New, but not lcars... Any ideas why?

Lyn


Top
 Profile  
 
 Post subject: Re: Graphics Drawing on a prim
PostPosted: Mon Mar 23, 2009 9:14 am 
Site Admin
User avatar

Joined: Wed Jul 16, 2008 7:22 pm
Posts: 186
Lyn Mimistrobell {L_WROTE}:
I'm trying to write text with a different font. I've uploaded lcars.ttf to my server and installed it as a font, but when I use "FontName lcars; " in my drawlist, it won't use that font. I can get it to use Arial, Courier New, but not lcars... Any ideas why?


Make sure you're using the name of the font as reported by the operating system, not the filename of the TrueType font (and double-check to make sure the font is installed for the user running OpenSim).


Attachments:
Dynamic Text with Fonts.jpg
Dynamic Text with Fonts.jpg [ 43.36 KiB | Viewed 7977 times ]
Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 10 posts ]


Who is online

Users browsing this forum: No registered users 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