Jump to content

Help for a script I really can't find


Recommended Posts

Hello everyone,

I'm looking for a script that shows the number of prim on a sim with the maxium with only text above a prim (it's to put in a hud).

Example : Prims : 154/689

gpx6.png

 

a big thank you if anyone has this in their inventory

 

Link to post
Share on other sites

This is not my best script but it should do what you want!

 

default
{
    touch_start(integer total_number)
    {
        vector currentPosition = llGetPos();
        vector color = <0.1,0.2,0.8> ;
        
        integer count = llGetParcelPrimCount(currentPosition, PARCEL_COUNT_TOTAL, FALSE);
        integer max = llGetParcelMaxPrims(currentPosition, FALSE) ;
        string title = (string)count + "/"  + (string)max ;
        //llSetText(title, color, 1.0) ;
          llOwnerSay(title) ;
        }
}

 

For a HUD you will need llOwnerSay() rather than llSetText()

Edited by Sabrina Tamerlane
added llOwnerSay
Link to post
Share on other sites

a big thank you for your sharing

 

on the other hand I am obliged to click on the cube to update the new number of prim in the field when I rez a cube or other prim

 

do you think there is a way to have the same thing with the text but without having to click on the prim to update the new number of prim present on the sim

 

big thx Sabrina

Link to post
Share on other sites

I would just like the prim counter to update automatically when I rez or delete a prim

without anything indicated in the chat just indicate it in the numbers on my prim

example : 16/677

i rez on prim 

exemple : 17/677

just that the text above my prim changes automatically without indicating any information in the chat room

 

I hope my English is not too bad. I apologize.  ^^

Link to post
Share on other sites
integer Running = FALSE;
integer delay = 60 ;

integer lastCount = 0;

default
{
    touch_start(integer total_number)
    {
        if (Running) {
            Running = FALSE;
            llSetTimerEvent(0) ;
        }
        else {
            llSetTimerEvent(delay) ;
            Running = TRUE;
        }
    }
    timer()
    {
        
        vector currentPosition = llGetPos();        
        integer count = llGetParcelPrimCount(currentPosition, PARCEL_COUNT_TOTAL, FALSE);
        integer max = llGetParcelMaxPrims(currentPosition, FALSE) ;
        if (count != lastCount) {
            lastCount = count ;
            llOwnerSay( (string)count + "/"  + (string)max) ;
        }
    }
}

You can do it like so.. it will check every minute if the prim count is different and then update you...

Edited by Sabrina Tamerlane
code
  • Like 1
Link to post
Share on other sites

in fact I've seen a hud like this, when you go to a sim or a sandbox it updates automatically without IM or writing in the chat, it only changes the numbers on the prim porter in the hud. 

 

as in the picture example

gpx6.png

 

thanks for your patience

Link to post
Share on other sites
display_land_impact()
{
    vector here = llGetPos();

    integer current = llGetParcelPrimCount(here, PARCEL_COUNT_TOTAL, FALSE);
    integer max = llGetParcelMaxPrims(here, FALSE);

    llSetText((string)["Prims: ", current, "/", max], <1,1,1>, 1);
}

default
{
    state_entry()
    {
        display_land_impact();
        llSetTimerEvent(60);
    }

    timer()
    {
        display_land_impact();
    }
}

That'll give you the current/maximum land-impact use for the current parcel as a hovertext, and it updates every minute.

Edited by Wulfie Reanimator
  • Like 1
Link to post
Share on other sites
8 hours ago, Wulfie Reanimator said:

display_land_impact()
{
    vector here = llGetPos();

    integer current = llGetParcelPrimCount(here, PARCEL_COUNT_TOTAL, FALSE);
    integer max = llGetParcelMaxPrims(here, FALSE);

    llSetText((string)["Prims: ", current, "/", max], <1,1,1>, 1);
}

default
{
    state_entry()
    {
        display_land_impact();
        llSetTimerEvent(60);
    }

    timer()
    {
        display_land_impact();
    }
}

That'll give you the current/maximum land-impact use for the current parcel as a hovertext, and it updates every minute.

Just thought I'd mention there is still a bug that affects llGetParcelMaxPrims() when SimWide is FALSE and a region bonus is present.

  • Like 1
  • Thanks 2
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...