Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Multi Notecard Vendor

Testament Languish
Tainted Soul
Join date: 18 Sep 2005
Posts: 43
10-25-2005 04:06
Was just wondering if there was a script out there that gave out different notecards that the person would select from a list tried looking but ran out of time before work :(

any help would be great :)
_____________________
One of the unforgiven roaming the land.
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
10-25-2005 04:20
CODE

// multi-notecard distributor
// Author: Jesrad Seraph
// Modify and redistribute freely as long as you permit free modification and redistribution

list cards = [];
integer channel;
integer handle;

default
{
changed(integer c)
{
if (c & CHANGED_INVENTORY) llResetScript();
}

state_entry()
{
integer max = llGetInventoryNumber(INVENTORY_NOTECARD);
if (max > 0)
{
integer n;
for(n = 0; n<max, ++n) cards += [llGetInventoryName(INVENTORY_NOTECARD, n)];
}
}

touch_start(integer c)
{
llListenRemove(handle);
channel = (integer)llFrand(4000000) + 10000;
handle = llListen(channel, "", llDetectedKey(0), "");

llSetTimerEvent(45.0);

if (llGetListLength(cards) > 12)
{
llDialog(llDetectedKey(0), "Choose a notecard:", llList2List(cards, part * 11, part * 11 + 10) + ["More..."], channel);
} else llDialog(llDetectedKey(0), "Choose a notecard:", cards, channel);
}

timer()
{
llListenRemove(handle);
llSetTimerEvent(0.0);
}

listen(integer ch, string name, key id, string msg)
{
if (msg == "More...")
{
part = (part + 1) % (llGetListLength(cards));
llSetTimerEvent(45.0);
if (llGetListLength(cards) > 11)
{
llDialog(id, "Choose a notecard:", llList2List(cards, part * 11, part * 11 + 10) + ["More..."], channel);
} else llDialog(id, "Choose a notecard:", cards, channel);
} else {
llGiveInventory(id, msg);
llSetTimerEvent(0.0);
llListenRemove(handle);
}
}
}



;)
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
Testament Languish
Tainted Soul
Join date: 18 Sep 2005
Posts: 43
10-25-2005 13:48
Tyvm :)
_____________________
One of the unforgiven roaming the land.
Testament Languish
Tainted Soul
Join date: 18 Sep 2005
Posts: 43
Help?
10-25-2005 20:06
integer n;
for(n = 0; n<max, ++n) cards += [llGetInventoryName(INVENTORY_NOTECARD, n)];
}
when I go to save the script I get a syntax error and it places the cusor right behind max and just before the comma
_____________________
One of the unforgiven roaming the land.
Rodrick Harrington
Registered User
Join date: 9 Jul 2005
Posts: 150
10-25-2005 20:09
From: Testament Languish
integer n;
for(n = 0; n<max, ++n) cards += [llGetInventoryName(INVENTORY_NOTECARD, n)];
}
when I go to save the script I get a syntax error and it places the cusor right behind max and just before the comma


make the comma a semi colon (;)

CODE
integer n;
for(n = 0; n<max; ++n) cards += [llGetInventoryName(INVENTORY_NOTECARD, n)];
}
Testament Languish
Tainted Soul
Join date: 18 Sep 2005
Posts: 43
10-25-2005 20:14
Tyvm
_____________________
One of the unforgiven roaming the land.
Den Woyseck
Registered User
Join date: 9 Sep 2005
Posts: 7
08-23-2007 09:13
mmh

(35,73) : error : Name not defined within scope.


llDialog(llDetectedKey(0), "Choose a notecard:", llList2List(cards, part * 11, part * 11 + 10) + ["More..."], channel);

It's about the part * 11

Complete ignorant here, anyone got a fix please? :)
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
08-23-2007 09:32
Gah! Thread Necromancy detected!

Besides the fact that the script posted wasn't even compiled, let alone tested, you are probably better off writing your own from scratch, or buying/otherwise obtaining one from someone else.
Den Woyseck
Registered User
Join date: 9 Sep 2005
Posts: 7
08-23-2007 09:46
hey there's cool stuff in graves!

Anyways, thanks for your answer, I am totally unable to script, thus the request here.
I'll try to find what I need.