[Scripting] Scanning regions for scripts

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Scripting] Scanning regions for scripts

Jeff Kelley
Scripters know how to code with economy in mind. One of their
techniques is to control all child prims from a unique central
script. The average user don't. He duplicates scripts blindly, some
of them dating from the dark ages where 'a script in every prim' was
common practice.

I'm building a nice candle. I drop the "flame script" in each of two
flame prims. Plus a "smoke script" in the base. Now, I clone my
candle 8 times to get a nice chandelier. Tadam! 24 scripts.
Uninformed users do terrible things.

Another thing to know is that most properties-setting scripts are
useless if the effect is not to change over time. Particles, texture
animation, target omega, hover text, sit target, sound loops are
persistent properties. The script may be deleted once it has done its
job.

So, the 24 scripts in your chandelier are totally useless, unless if
you want to switch it on and off, then 1 script is enough. In the
end, we see regions with hundreds of useless scripts eating your RAM
for nothing. How many "hover text" lurking in these freebies boxes?

Have you ever tried to cleanup such a messy region? That's a daunting
task. The viewer beacon don't show scripts in child prims. Top
Scripts is helpless. As is the console.

It's time to dive into the database. This PHP script will nicely list
all the scripts in a region, showing root coordinates, link number,
link name, script name, and a link to the asset. Like this:

http://www.pescadoo.net/tmp/scripts.png

We guess that this Station Tesla thing is poorly scripted. Loging in
the region and typing gtp 122 225 38, I can now replace 10
llSetTextureAnim by one unique llSetLinkTextureAnim in the root prim.
Same for llLinkParticleSystem and, of course, the ubiquitous
llSetLinkPrimitiveParams. We miss a llLinkTargetOmega, though.

Get your regions slim and fast. Happy script safari!

https://github.com/jeff-kelley/opensim-utils


-- Jeff



_______________________________________________
Opensim-users mailing list
[hidden email]
http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Scripting] Scanning regions for scripts

Kay McLennan
On Sat, Dec 12, 2015 at 6:31 AM, Jeff Kelley <[hidden email]> wrote:


...Get your regions slim and fast. Happy script safari!...

Jeff,

Wow, thank you for a very useful discussion (and set of tools) to maximize sim performance (via maximizing script usage)!  Still, I have a few questions:


- [In the same way you mentioned removing particle scripts from objects…]  Doesn’t removing the script for hoover text (without removing the hoover text and accordingly, the hoover text will still be visible) mean the hoover text is still functional WITHOUT impacting region performance?

- Do NPCs impact region performance?

- Does anyone know of a CC license “chat bot” script (to enable text-based chats with NPCs)?

- Any recommendations for a CC license script library (and especially, a state-of-the-art script library)?  I mostly use the scripts in Fleep’s script library @ https://fleep.wikispaces.com/Scripts (or go back to the SL LSL wiki @ http://wiki.secondlife.com/wiki/LSL_Portal).

Finally, while we are on the topic of optimizing region performance in OpenSim, is it still true that making as many of the objects in the sim as possible phantom will increase the sim’s performance?  [This is a tip I picked up from Chris Hart when I was using the Reaction Grid to host the Tulane SCS Metaverse.  I have continued to make all objects phantom except building floors.  Further, I now depend on being able to just walk through doors (and loath having to actually find a door!).  Still, since I noticed how the very adept builders in the OSCC grid did not make many or any of the builds phantom, I wonder if my understanding -- that phantom objects helps sim performance -- is still correct?]


Again, thank you for your notes on maximizing sim performance through maximizing script performance.


Best,

Kay




_______________________________________________
Opensim-users mailing list
[hidden email]
http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Scripting] Scanning regions for scripts

tringate
Kay,
 
I can only answer one of your questions, and offer my opinion on another.
 
- Do NPCs impact region performance?
 
Opinion, yes, slightly.  The more you have, they can affect the performance depending on what attachments etc they have on.  For instance hair can be a drag if it is poorly scripted by leaving un-needed scripts in the many prims.  I have had as many as 50 NPC’s that had no scripted items on them on my region without any noticeable performance impact with only my single avatar on the region.  Keep in mind as you increase real avatars on a region and you have many moving NPC’s all that motion information needs to be sent to each real avatars viewer, so yes, NPC’s do affect performance if they are in motion.  I have 7 persistent NPC’s on nudist island holding signs and they present no real impact to the region performance.
 
- Does anyone know of a CC license “chat bot” script (to enable text-based chats with NPCs)?
 
I guess I do not know what a “CC license” is but I have available a controller script for an NPC that works with a “program-o” set of AIML I have written for my “Genie” project.
 
You can see it in action at “Lady Island” where you can get the Genie lantern which comes with four genies and is set up to work with the chat server I have programmed.  This object contains a suite of scripts and objects for the lantern, and the controller, that work with one another.
 
Both the genies and the program-o server can be set up for your own use using your own servers.
 
It is not for the “faint of heart” user to try and set up a program-o server.  It is a project all of it’s own.  I was active back in the 2001 time frame in the A.L.I.C.E. project and wrote the 1.0 AIML manual for the project at that time.  Last year I decided to take a look at program-o since it was php and MySQL based to see if I could use it to both chat with and control an NPC.  I have written special plug-in’s for program-o to allow a single AIML brain to control multi genies and multi users.  With the controller script I wrote for the NPC you can control with chat, your NPC (genie) to do nearly anything a normal avatar can do.  The combination is far more powerful than just a chat program.
 
The project is far from being complete, but it is mature enough for others to use the “genies” as controllable companions.
 
Keep in mind, that my configuration is intended for use on OSgrid, and while it can easily be used on other grids or standalones, it will take considerable knowledge of how to set it up for such use.
 
Tom
 
Sent: Saturday, December 12, 2015 8:41 AM
Subject: Re: [Opensim-users] [Scripting] Scanning regions for scripts
 
On Sat, Dec 12, 2015 at 6:31 AM, Jeff Kelley <[hidden email]> wrote:


...Get your regions slim and fast. Happy script safari!...
 
Jeff,

Wow, thank you for a very useful discussion (and set of tools) to maximize sim performance (via maximizing script usage)!  Still, I have a few questions:

 

- [In the same way you mentioned removing particle scripts from objects…]  Doesn’t removing the script for hoover text (without removing the hoover text and accordingly, the hoover text will still be visible) mean the hoover text is still functional WITHOUT impacting region performance?

- Do NPCs impact region performance?

- Does anyone know of a CC license “chat bot” script (to enable text-based chats with NPCs)?

- Any recommendations for a CC license script library (and especially, a state-of-the-art script library)?  I mostly use the scripts in Fleep’s script library @ https://fleep.wikispaces.com/Scripts (or go back to the SL LSL wiki @ http://wiki.secondlife.com/wiki/LSL_Portal).

Finally, while we are on the topic of optimizing region performance in OpenSim, is it still true that making as many of the objects in the sim as possible phantom will increase the sim’s performance?  [This is a tip I picked up from Chris Hart when I was using the Reaction Grid to host the Tulane SCS Metaverse.  I have continued to make all objects phantom except building floors.  Further, I now depend on being able to just walk through doors (and loath having to actually find a door!).  Still, since I noticed how the very adept builders in the OSCC grid did not make many or any of the builds phantom, I wonder if my understanding -- that phantom objects helps sim performance -- is still correct?]

 

Again, thank you for your notes on maximizing sim performance through maximizing script performance.

 

Best,

Kay


 


_______________________________________________
Opensim-users mailing list
[hidden email]
http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-users

_______________________________________________
Opensim-users mailing list
[hidden email]
http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Scripting] Scanning regions for scripts

Luisillo Contepomi-2
In reply to this post by Jeff Kelley
Thank you very very very much!
Luisillo

El 12/12/2015 a las 13:31, Jeff Kelley escribió:


>
> Get your regions slim and fast. Happy script safari!
>
> https://github.com/jeff-kelley/opensim-utils
>
>
> -- Jeff
>
>
>
> _______________________________________________
> Opensim-users mailing list
> [hidden email]
> http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-users
>
_______________________________________________
Opensim-users mailing list
[hidden email]
http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Scripting] Scanning regions for scripts

Jeff Kelley
In reply to this post by Kay McLennan
At 7:41 AM -0600 12/12/15, Kay McLennan wrote:

>  Doesn't removing the script for hoover text (without removing the
>hoover text and
>  accordingly, the hoover text will still be visible) mean the hoover
>text is still functional
>  WITHOUT impacting region performance?

Yes.

>  Do NPCs impact region performance?

Very lightly. I rezed 400 of them without lag.
Their attachments may create lag, however.


>   is it still true that making as many of the objects in the sim as
>possible phantom
>   will increase the sim's performance?

Yes. It reduces collisions.


-- Jeff
_______________________________________________
Opensim-users mailing list
[hidden email]
http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Scripting] Scanning regions for scripts

tringate
In reply to this post by Jeff Kelley
Jeff,

What is the environment your tool was written for?

I am on OSgrid and tried to use your script and can not make it do anything
other than give me the message "Region Sanctuary not found".

My region name is "Sanctuary" and it's database is "OS-Sanctuary-Home"

I have edited db_access.php to have the necessary values for the database
access.

I tried several different changes to this function, but they all return the
same message when running the tool.

function DatabaseForRegion($region) {
//        return 'opensim';
        return 'OS-Sanctuary-Home';
//        $serverPort = $region['serverHttpPort'];
//        return sprintf ("sim%02d", $serverPort-9000);
    }

I did see a reference to "robust" in the database access so tried using just
the region database name there, but I suspect that is a table reference.

$query  = "SELECT * FROM robust.regions WHERE regionName='$region';";

Your instructions do not say what environment this tool is for.

Looks like a very nice tool to track down horrible scripts, can it be used
on OSgrid?

Tom



-----Original Message-----
From: Jeff Kelley
Sent: Saturday, December 12, 2015 7:31 AM
To: [hidden email]
Subject: [Opensim-users] [Scripting] Scanning regions for scripts

Scripters know how to code with economy in mind. One of their
techniques is to control all child prims from a unique central
script. The average user don't. He duplicates scripts blindly, some
of them dating from the dark ages where 'a script in every prim' was
common practice.

I'm building a nice candle. I drop the "flame script" in each of two
flame prims. Plus a "smoke script" in the base. Now, I clone my
candle 8 times to get a nice chandelier. Tadam! 24 scripts.
Uninformed users do terrible things.

Another thing to know is that most properties-setting scripts are
useless if the effect is not to change over time. Particles, texture
animation, target omega, hover text, sit target, sound loops are
persistent properties. The script may be deleted once it has done its
job.

So, the 24 scripts in your chandelier are totally useless, unless if
you want to switch it on and off, then 1 script is enough. In the
end, we see regions with hundreds of useless scripts eating your RAM
for nothing. How many "hover text" lurking in these freebies boxes?

Have you ever tried to cleanup such a messy region? That's a daunting
task. The viewer beacon don't show scripts in child prims. Top
Scripts is helpless. As is the console.

It's time to dive into the database. This PHP script will nicely list
all the scripts in a region, showing root coordinates, link number,
link name, script name, and a link to the asset. Like this:

http://www.pescadoo.net/tmp/scripts.png

We guess that this Station Tesla thing is poorly scripted. Loging in
the region and typing gtp 122 225 38, I can now replace 10
llSetTextureAnim by one unique llSetLinkTextureAnim in the root prim.
Same for llLinkParticleSystem and, of course, the ubiquitous
llSetLinkPrimitiveParams. We miss a llLinkTargetOmega, though.

Get your regions slim and fast. Happy script safari!

https://github.com/jeff-kelley/opensim-utils


-- Jeff



_______________________________________________
Opensim-users mailing list
[hidden email]
http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-users 

_______________________________________________
Opensim-users mailing list
[hidden email]
http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Scripting] Scanning regions for scripts

Jeff Kelley
At 11:57 AM -0500 12/12/15, Thomas Ringate wrote:

>What is the environment your tool was written for?

PHP 5.5.9, PHP 5.5.11, mysqli  (apt-get install php5-mysqlnd)

>  I am on OSgrid and tried to use your script and can not make it do
>anything other
>  than give me the message "Region Sanctuary not found".

I query robust's database to get the region UUID. You can't talk to
OSGrid's database.

Comment lines 63-67 and edit 68 and 69 for region UUID and database
name. For multiple regions, you may try to query gridservice
http://opensimulator.org/wiki/GridService or (simpler) hard-code the
UUID or an associative array of UUIDs for your regions.

getasset.php won't work for the same reason. It's a query to robust"s db.

In db_access sqlBase(), make sure to put a dabatase you can actually
access e.g. OS-Sanctuary-Home.



-- Jeff
_______________________________________________
Opensim-users mailing list
[hidden email]
http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Scripting] Scanning regions for scripts

tringate
Jeff,

I made some progress, but now get this error:

PHP Fatal error:  Call to a member function fetch_all() on boolean in
/var/www/tsim/admin/regionscrits.php on line 87

This is what I modified:

    // Get region data
//    $query  = "SELECT * FROM robust.regions WHERE regionName='$region';";
//    $answer = $link->query($query);
//    if (!$answer->num_rows) die ("Region $region not found\n");

//    $region = $answer->fetch_assoc();
//    $regionUuid = $region['uuid'];
    $regionUuid = '3b15c050-1fe4-11df-8a39-0800200c9a66';
//    $regionDB = DatabaseForRegion ($region);
    $regionDB = 'OS-Sanctuary-Home';


this is my line 87:

$prims  = $answer->fetch_all(MYSQLI_ASSOC);

Looking at my database with phpMyadmin I see the UUID matching what I have
hard coded.

Tom



-----Original Message-----
From: Jeff Kelley
Sent: Saturday, December 12, 2015 2:48 PM
To: [hidden email]
Subject: Re: [Opensim-users] [Scripting] Scanning regions for scripts

At 11:57 AM -0500 12/12/15, Thomas Ringate wrote:

>What is the environment your tool was written for?

PHP 5.5.9, PHP 5.5.11, mysqli  (apt-get install php5-mysqlnd)

>  I am on OSgrid and tried to use your script and can not make it do
> anything other
>  than give me the message "Region Sanctuary not found".

I query robust's database to get the region UUID. You can't talk to
OSGrid's database.

Comment lines 63-67 and edit 68 and 69 for region UUID and database
name. For multiple regions, you may try to query gridservice
http://opensimulator.org/wiki/GridService or (simpler) hard-code the
UUID or an associative array of UUIDs for your regions.

getasset.php won't work for the same reason. It's a query to robust"s db.

In db_access sqlBase(), make sure to put a dabatase you can actually
access e.g. OS-Sanctuary-Home.



-- Jeff
_______________________________________________
Opensim-users mailing list
[hidden email]
http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-users 

_______________________________________________
Opensim-users mailing list
[hidden email]
http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Scripting] Scanning regions for scripts

Jeff Kelley
At 3:56 PM -0500 12/12/15, Thomas Ringate wrote:

>  PHP Fatal error:  Call to a member function fetch_all() on boolean
>  in /var/www/tsim/admin/regionscrits.php on line 87

The query returned an empty set.

Have you mysqlnd installed? There are three php mysql API :

   MySQL (Original)
   MySQLi ("Improved")
   Mysqlnd ("native driver")

http://php.net/manual/en/mysql.php

I have the latter on my servers:
   apt-get install php5-mysqlnd



Run the query (simplified) from the command line :

USE `OS-Sanctuary-Home`;

SELECT Name, LinkNumber, SceneGroupID FROM prims
        WHERE RegionUUID = '3b15c050-1fe4-11df-8a39-0800200c9a66';

and see what happens.


-- Jeff
_______________________________________________
Opensim-users mailing list
[hidden email]
http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-users
Loading...