Jump to content
  • 0

A basic scripting question


Deltango Vale
 Share

You are about to reply to a thread that has been inactive for 4731 days.

Please take a moment to consider if this thread is worth bumping.

Question

There is a script command called llGetRegionName() that gets the name of a region.

There is no script command called llGetParcelName() that gets the name of a parcel.

There is a script command called llGetParcelDetails that gets a bunch of information about a parcel, including the name.

I have looked at: http://wiki.secondlife.com/wiki/LlGetParcelDetails

I tried llGetParcelDetails(0), which means get the parcel name, but it does not work. That's the best I can understand things.

What is the correct command to get the name of a parcel?

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

The syntax is llGetParcelDetails(vector pos, list params);

 

So something like this should do the trick.  

 

default{	state_entry()	{		//llSay(0, "Hello, Avatar!");	}	touch_start(integer total_number)	{		llOwnerSay(llList2String(llGetParcelDetails(llGetPos(),[PARCEL_DETAILS_NAME]),0));	}}

 

ETA -- what this means is that llGetParcelDetails takes two arguments -- the vector location of the parcel whose details you want and a list of the various possible details you want it to tell you.  

It returns a list of what those details are -- it has to be a list, because you might be asking for the parcel description, or its owner or area or whatever as part of the same call.   In this example, you're only asking for the description, which is a string and is the first (and only) item in the list that's returned, so you change it into a usable string with llList2String(list, 0) -- "find the first item in the list and return it as a string".

Link to comment
Share on other sites

  • 0

This does the trick for me :matte-motes-bashful-cute:

list a =llGetParcelDetails(llGetPos(),[PARCEL_DETAILS_NAME]);
        
llSay(0, (string)a);

My first line grabs the parcel details list from the position of the object, specifying you want to grab the name detail.

The position grab could be changed to grab the location of an avatar or anything else within limits of LSL.

The second line converts the list to a string and outputs it to local chat, useful to verify the variable has been grabbed correctly.

Once you have grabbed that variable list a, you can do anything you wish with it of course :matte-motes-sunglasses-3:

  • Like 1
Link to comment
Share on other sites

  • 0

Reading. Trying to understand... K, let me try to explain better what I want to do.

There is a line in a script:

llInstantMessage(llGetOwner(), "LandMark giver at " + llGetRegionName() + " has just been used by " +  llKey2Name(llDetectedKey(0)) + "");

of which I understand only:

llGetRegionName()

I wish to change the line to:

llInstantMessage(llGetOwner(), "LandMark giver at " + llGetParcelName() + " has just been used by " +  llKey2Name(llDetectedKey(0)) + "");

But there is no such thing as llGetParcelName()

I tried llGetParceDetails(0)...

llInstantMessage(llGetOwner(), "LandMark giver at " + llGetParcelDetails(0) + " has just been used by " +  llKey2Name(llDetectedKey(0)) + "");

...without success.

I tried llGetParcelDetails(PARCEL_DETAILS_NAME)...

llInstantMessage(llGetOwner(), "LandMark giver at " + llGetParcelDetails(PARCEL_DETAILS_NAME) + " has just been used by " +  llKey2Name(llDetectedKey(0)) + "");

...without success.

Do you see where I'm coming from? I only want the parcel name in the simplest possible way to plug it into the existing line.

Link to comment
Share on other sites

  • 0

Let me take a wild guess at deciphering this...

 

llGetParcelDetails ( llGetPos(), PARCEL_DETAILS_NAME )

 

Which, in English says:

 

Get parcel details ( send the specific location of this script on the parcel , get back the name of the parcel )

 

And the line would therefore be:

 

llGetParcelDetails(llGetPos(),PARCEL_DETAILS_NAME)

 

Am I anywhere close?

Link to comment
Share on other sites

  • 0

Thanks. I never would have looked for a scripting forum under content creation. I looked for it in the main list. Technical was all I could find.

 

It might be clever to move the scripting forum up a level considering it is relevant to a far wider range of uses than content creation.

Link to comment
Share on other sites

  • 0

The line is as I posted it -- llGetParcelDetails(llGetPos(),[PARCEL_DETAILS_NAME]);

 

Note the [ square brackets ] round [PARCEL_DETAILS_NAME].

 

They are there because lsl uses them to enclose lists, and, as you will see if you look more closely at the wiki article, llGetParcelDetails requests a list of details about the parcel -- you're using it to request a list with only one item, but you could just as easily be asking for details of the description, owner, size, and stuff at the same time, so the request has to be presented as a list, and lsl knows something's a list if it's enclosed in square brackets.

 

Since you've asked for a list of details about the parcel, you get a list in reply, albeit one with just one item, so you will need to decode the list, using the format llList2String(my_list,0); That means "find the first item in the list (lsl starts counting at 0, not 1) and turn it into a string so you can say it, or display in hovertext or whatever.

 

Tl;dr -- you need the [ ] round PARCEL_DETAILS_NAME or it won't compile, and you need to turn the results of the call into a string so the script can do something with the parcel name when it knows what it is.

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4731 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...