Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Touch to give.. NO FOLDER?

Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
11-29-2006 20:57
Okay, simple fact is, I'm trying to make a script that "goives contents on touch". but the scripts I have handy all do it one of tw ways.
  1. The Notecard Giver.

    This script is ultra simple, and gives the one notecard in contents. But in order to change the notecard name, you have to edit the script. I could easily set it up to give "the first notecard found".. but then if someone puts 2 notecards in it.. Then they have to learn scripting to add it. Same thing happens if they add a landmark into the device.

  2. The Contents Giver.

    This script is smarter. Designed to be put in a "boxed item" box, touch it and it dumps all the contents into a folder in the user's inventory. Problem is.. this delivery method sucks big time for notecards and landmarks. WHo wants to go looking for a folder named "We've moved"?


Thing is.. when you "give" a notecard or landmark.. it auto-opens on the screen.. but if you give a folder.. the notecards and landmarks stay closed.

Here's that second script.

CODE

default
{
touch_start(integer total_number)
{
key toucherKey = llDetectedKey(0);
list contents_list;
string contents_name;
integer contents_num = llGetInventoryNumber(INVENTORY_ALL);
string folderName = llGetObjectName();
integer i;
for (i = 0; i < contents_num; ++i)
{
contents_name = llGetInventoryName(INVENTORY_ALL, i);
contents_list += contents_name;
}
i = llListFindList(contents_list, [llGetScriptName()]); // Delete this script
contents_list = llDeleteSubList(contents_list, i, i);

if (llGetListLength(contents_list) < 1)
{
llWhisper(0, "Sorry.. there appears to be a problem.");
}
else
{
llGiveInventoryList(toucherKey, "", contents_list);
llInstantMessage(toucherKey, "Look in your inventory for a folder called: "
+ folderName + ". This folder contains your items."); // Alert the user.
}
}
}


I tried putting a "" into the destination folder slot in llGiveInventoryList... But I just end up with a null-named folder with the items in it.

Can anyone help?
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
11-30-2006 06:42
I must be low on chesse or something because I'm not 100% sure what your question is?
Did you want to give all without creating a folder? or with a folder?

The original script used the object name as a folder name, which is what you have changed to "". You could use the description field of the object to hold the name your new folder?
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
11-30-2006 06:48
Well you could have the script scan content of item at the beginning and put all items that aren't landmark or notecard into a list, so they can be delivered to user's folder with llGiveInventoryList()... and keep separate list of landmarks/notecards so they can be handed directly one by one with llGiveInventory() and auto-open when received. o.O
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
11-30-2006 07:25
So is the problem that landmarks wouldnt open or that they do?
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
11-30-2006 08:04
Not sure, i think the problem is landmarks and notecards don't open on their own when handed as part of box content into a folder to person's directory ^^;

am hoping the issue isn't, how to give *everything* in the box right to person't directory rather than single folder... because while it's doable with simple loop that passes items one by one, getting content of the box sprawled across dozen separate folders (they are placed automatically in 'basic' folders based on item type) well, it would be quite annoying o.O;
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
11-30-2006 12:38
The problem is.. it's a landmark giver.. which I'll be giving to a non-technically-minded person. She's gonna throw a huge fit if she has to edit the script. You'd think that a "give landmark 0" would work.. but she might (and probably will) add a notecard too. So you'd think that I could get away with a "give notecard 0" and "give landmark 0"... But this person... I just know it.. will add a second landmark... or a second notecard.. at some point down the line.

I don't have a major issue with limiting this giver to JUST landmarks and notecards.. but it needs to be able to scale.

I DON'T want to give these items in a folder.. because of the way that notecards and landmarks behave when given directly. They auto open. Giving them in a folder disables the auto opening feature.
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
11-30-2006 12:49
Ahh... well, some simple loop through the items which meet the conditions could probably work, i guess o.O
CODE

list types = [ INVENTORY_LANDMARK, INVENTORY_NOTECARD ];

default {

touch_start( integer Contacts ) {

key contact = llDetectedKey(0);
integer type; integer type_count = llGetListLength( types );
for( type = 0; type < type_count; ++type ) {

integer current_type = llList2Integer( types, type );
integer idx;
integer count = llGetInventoryNumber( current_type );
for( idx = 0; idx < count; ++idx ) llGiveInventory( contact, llGetInventoryName( current_type, idx ) );
}
}
}
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
11-30-2006 13:09
Thanks!

I assumed it would be a "for" loop solution.. but me and "FOR" haven't gotten along since BASIC.
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Thaleenin Sydney
Registered User
Join date: 20 Nov 2006
Posts: 10
single item
11-30-2006 13:47
I had thought this tread was about getting a single item out of a box rather then all contents. I store stuff in Prims and would really like a script that would just let me take out what I want rather then dump the whole thing each time. I bet others would to some one must have done it along time ago and it's been lost under dust somewhere in here.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
11-30-2006 16:54
From: Thaleenin Sydney
I had thought this tread was about getting a single item out of a box rather then all contents. I store stuff in Prims and would really like a script that would just let me take out what I want rather then dump the whole thing each time. I bet others would to some one must have done it along time ago and it's been lost under dust somewhere in here.


I assume you mean you would like to touch the object and then have it ask you what it is you want to have and then have the script/prim either rez or give via inventory?
Straight forward enough and we have covered something similar in a previous topic quite recently about fridges of all things. you can find it here