Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Landmark Giver

3Ring Binder
always smile
Join date: 8 Mar 2007
Posts: 15,028
03-12-2008 12:06
okay, found freebie landmark givers, but they don't seem to work. read these forums and tried some posted scripts. none works for me.

i want to place a landmark giver in a prim, with the landmark (if that's how it's supposed to be done). i want the script to have a hover text stating "Landmark to main store".

or should the landmark info be in the script itself somewhere? :confused:

can someone please please please post or PM to me something that will actually work. i should not be allowed to open scripts. LOL
_____________________
it was fun while it lasted.
http://2lf.informe.com/
Avion Raymaker
Palacio del Emperador!
Join date: 18 Jun 2007
Posts: 980
03-12-2008 12:08
From: 3Ring Binder
okay, found freebie landmark givers, but they don't seem to work. read these forums and tried some posted scripts. none works for me.

i want to place a landmark giver in a prim, with the landmark. i want the script to have a hover text stating "Landmark to main store".

can someone post or PM to me something that will actually work. i should not be allowed to open scripts. LOL


3Ring, I have ones I'd be happy to send you, but I can't log in until about 6 pm. If nobody else beats me to it before then, IM me later.
Stephen Zenith
Registered User
Join date: 15 May 2006
Posts: 1,029
03-12-2008 12:12
Try this:

CODE

giveLMs (key av)
{
integer numLM = llGetInventoryNumber (INVENTORY_LANDMARK);
integer i;
for (i = 0; i < numLM; i++)
{

llGiveInventory (av, llGetInventoryName(INVENTORY_LANDMARK, i));
}
}

default
{
state_entry()
{
llSetText ("Landmark to main store", <1.0, 1.0, 1.0>, 1.0);
}

touch_start(integer total_number)
{
integer i;
for (i = 0; i < total_number; i++)
{
giveLMs (llDetectedKey (i));
}

}
}



It'll give all the landmarks in the object to everybody who clicks the prim.
_____________________
3Ring Binder
always smile
Join date: 8 Mar 2007
Posts: 15,028
03-12-2008 12:17
Stephen, trying it now.

always, i get an error on the first line
CODE
  :(
_____________________
it was fun while it lasted.
http://2lf.informe.com/
3Ring Binder
always smile
Join date: 8 Mar 2007
Posts: 15,028
03-12-2008 12:18
oh wait: i added // before the intro
CODE
 and the exiting 
CODE
 and now it works as shown below!  THANK YOU!

From: someone
//
CODE

giveLMs (key av)
{
integer numLM = llGetInventoryNumber (INVENTORY_LANDMARK);
integer i;
for (i = 0; i < numLM; i++)
{

llGiveInventory (av, llGetInventoryName(INVENTORY_LANDMARK, i));
}
}

default
{
state_entry()
{
llSetText ("Landmark to main store", <1.0, 1.0, 1.0>, 1.0);
}

touch_start(integer total_number)
{
integer i;
for (i = 0; i < total_number; i++)
{
giveLMs (llDetectedKey (i));
}

}
}

//

Avion, i got it to work! :D

thanks all, for such quick replies.
_____________________
it was fun while it lasted.
http://2lf.informe.com/
Stephen Zenith
Registered User
Join date: 15 May 2006
Posts: 1,029
03-12-2008 12:19
From: 3Ring Binder
Stephen, trying it now.

always, i get an error on the first line
CODE
  :(


Oh, you need to remove the
CODE
 and  bits - those are for the forum, so it knows that the bit inbetween is scripting (or at least it would, if the Lindens ever get around to fixing the forums...)

Just use the part inbetween.

EDIT: Or comment them out :)
_____________________
3Ring Binder
always smile
Join date: 8 Mar 2007
Posts: 15,028
03-12-2008 12:20
From: Stephen Zenith
Oh, you need to remove the
CODE
 and 
bits - those are for the forum, so it knows that the bit inbetween is scripting (or at least it would, if the Lindens ever get around to fixing the forums...)

Just use the part inbetween.

i had removed them in another script, and then it still didn't work. i have them with the // which tells the script to ignore the text, and it works, so i think i'll just leave it alone now. LOL

THANK YOU! i was going crazy!
_____________________
it was fun while it lasted.
http://2lf.informe.com/
Stephen Zenith
Registered User
Join date: 15 May 2006
Posts: 1,029
03-12-2008 12:21
No problem, glad I could help :)
_____________________
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
03-12-2008 13:00
I personally reccommend AGAINST using this approach in a retail environment to give out more than one thing per-click.

I had a similar setup that gave out a notecard and a landmark when someone clicked the prim. It worked great. Using the method listed here, it gave out the notecard, and then it gave out the landmark.

UNFORTUNATELY noobs will click anything, and very often they are just "clicking to see what it does". The first item given to them, they either accept or decline. But the second one, they mute in hopes of stopping the perceived "avalanche" of items they feel like they didn't ask for. (note: in other languages, the mute button says "ignore";)

The result.. once they've pressed mute, if they buy anything, you're going to have a customer who "paid for an item and never received it" worse, you're going to have a customer who will refuse any replacement items you send them, refuse any notecards you send them, and who will ignore (never see) any IMs you send them.

PLEASE, for your OWN SAKE.. if you're using a giver to dispense MORE THAN ONE ITEM... either embed them in a notecard, stick them all in a single "box of stuff" that you give them, or use llGiveInventoryList to give them a "folder" instead.
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
06-13-2008 11:08
From: someone
....... or use llGiveInventoryList to give them a "folder" instead.

do you have a script that uses this? :-) i'm not in world to make it, but sounds like a great idea
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
06-13-2008 15:05
Try this one. I don't recall where it came from, but I've been using it for ages.

CODE


// When a user clicks this object, this script will give a folder containing everything in the objects inventory
// This can serve as a unpacker script for boxed objects
string HoverText = " ";

default {

state_entry()
{
llSetText(HoverText, <1,1,1>, 1.0);
}

touch_start(integer total_number) {

list inventory;
string name;
integer num = llGetInventoryNumber(INVENTORY_ALL);
integer i;

for (i = 0; i < num; ++i) {
name = llGetInventoryName(INVENTORY_ALL, i);
if(llGetInventoryPermMask(name, MASK_NEXT) & PERM_COPY)
inventory += name;
else
llSay(0, "Don't have permissions to give you \""+name+"\".");
}

//we don't want to give them this script
i = llListFindList(inventory, [llGetScriptName()]);
inventory = llDeleteSubList(inventory, i, i);

if (llGetListLength(inventory) < 1) {
llSay(0, "No items to offer.");
} else {
// give folder to agent, use name of object as name of folder we are giving
llGiveInventoryList(llDetectedKey(0), llGetObjectName(), inventory);
}

}

}

Kat1981 Dragonfly
Registered User
Join date: 4 Sep 2004
Posts: 40
01-22-2009 18:50
I am trying to get this script to give folder but I keep getting syntax error. Below is how I using the script:

CODE


// When a user clicks this object, this script will give a folder containing everything in the objects inventory
// This can serve as a unpacker script for boxed objects
string HoverText = "K&K Design";

default {

state_entry()
{
llSetText(HoverText, <1,1,1>, 1.0);
}

touch_start(integer total_number) {

list inventory;
string name;
integer num = llGetInventoryNumber(INVENTORY_ALL);
integer i;

for (i = 0; i < num; ++i) {
name = llGetInventoryName(INVENTORY_ALL, i);
if(llGetInventoryPermMask(name, MASK_NEXT) & PERM_COPY)
inventory += name;
else
llSay(0, "Don't have permissions to give you \""+name+"\".");
}

//we don't want to give them this script
i = llListFindList(inventory, [llGetScriptName()]);
inventory = llDeleteSubList(inventory, i, i);

if (llGetListLength(inventory) < 1) {
llSay(0, "No items to offer.");
} else {
// give folder to agent, use name of object as name of folder we are giving
llGiveInventoryList(llDetectedKey(0), llGetObjectName(K&K Design), inventory);
}

}

}



The syntax error is on 34, 58:
llGiveInventoryList(llDetectedKey(0), llGetObjectName(K&K Design), inventory);
in the Get Object Name. I am trying to get items in the prim to be place in folder when someone clicks on it. I am new at this and am thinking that I might have left something out, but what it is I am not sure. Any help is greatly appreciated. Thanks much.
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
01-22-2009 19:52
From: Kat1981 Dragonfly


The syntax error is on 34, 58:
llGiveInventoryList(llDetectedKey(0), llGetObjectName(K&K Design), inventory);
in the Get Object Name. I am trying to get items in the prim to be place in folder when someone clicks on it. I am new at this and am thinking that I might have left something out, but what it is I am not sure. Any help is greatly appreciated. Thanks much.


you can't put anything into llGetObjectName(), you would need to name the object K&K Design. or this:

llGiveInventoryList(llDetectedKey(0), "K&K Design", inventory);
Kat1981 Dragonfly
Registered User
Join date: 4 Sep 2004
Posts: 40
01-23-2009 05:59
Thanks Ruthven, I am at work now but will make that correction when I get home later today. There are so many things that can and cannot go into a script that my head is spinning at time and yet I still want to learn as much as I can. Have a great day.
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
01-23-2009 07:08
From: Kat1981 Dragonfly


The syntax error is on 34, 58:
llGiveInventoryList(llDetectedKey(0), llGetObjectName(K&K Design), inventory);
in the Get Object Name. I am trying to get items in the prim to be place in folder when someone clicks on it. I am new at this and am thinking that I might have left something out, but what it is I am not sure. Any help is greatly appreciated. Thanks much.
What Ruthven said.

Just to explain how this works, llGetObjectName() never needs anything in the parentheses; they're just there, I think, because all LSL functions end in (). This particular function is a sort of shorthand that LSL can understand for "whatever the object containing this script is called".

The way it's used here makes the script particularly useful as an unpacker, since you don't have to alter the script for use with different products -- just give the box the name of whatever product line it contains, and that's the name of the folder that will be created in the customer's inventory.

When you're working on scripts, I think it's a good idea to remember that any literal value -- words -- that you can alter will be contained in "double quotes" -- if they're not, leave them alone unless you know what you're doing.

If you do need to alter literal values, they're frequently defined at the very start of the script, before it says default, as is the hovertext in this example. So a variation on this script, if you didn't want to have to give the prim the same name as the folder the script creates, might be to put
CODE

string HoverText = "K&K Design";
string FolderName = "A present from K&K Design";

default
{ state_entry()
{ etc....
right at the top of the script and then change the line we've been discussing to
CODE
llGiveInventoryList(llDetectedKey(0), FolderName, inventory);
Then the script would know that whenever it came across folder_name you're using it as a place-holder and would fill it in with the appropriate text.
Kat1981 Dragonfly
Registered User
Join date: 4 Sep 2004
Posts: 40
01-23-2009 10:18
Thanks Innula, that makes much sense to me. While I have read much about scripts and how they work, for me, the best way to learn is hands on, playing around and seeing what does and does not work. To be honest, sometimes I get lost reading the manuals that have been written for SL. Once again, thanks to you and everyone that has given me information to help me along the way.