Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: NoteCard Giver V 1.0 by Russ Allen

Russ Allen
scripter
Join date: 22 Mar 2007
Posts: 22
06-13-2007 08:39
This is a free script I made just for learning. Please tell me what you think of it and more ideas of what to make would be appreciated.

By the way: the scripts format may not be so good because the Vb code is not working...

CODE

//------------------- NoteCard Giver V 1.0 by Russ Allen -------------------//
//--------------------------------------------------------------------------//
//-------------- Thanks to LSLEditor 2.4 and www.lslwiki.net ---------------//
//--------------------------------------------------------------------------//
//--------------------------------------------------------------------------//
//----- I hope my comments have given enough information on configuring ----//
//-------- this script. If you still need help contact me inworld. ---------//
//--------------------------------------------------------------------------//
//------ If you are looking to hire a scripter send me an IM I may be ------//
//------ Available ;) ------//
//--------------------------------------------------------------------------//


list given_to;
integer range = 50; // Range form the object in which it will give the notecard.
float rate = 5; // Rate in seconds of scan for people to give notecard too. Should increase with range.
// NOTE: the lower it is the more laggy it is so think before you put it on 0.1.

string notecard = "MyNotecard"; // The notecard to give (must be in objects inventory)

integer time_or_length = TRUE; // Defines whether it resets the list specific amount of time (which you define in
// reset_list_every) or when it reaches a certain length.
// TRUE = time
// FALSE = length
// NOTE: The reason for reseting is so it does not use alot of memory and become
// very laggy.

float reset_list_every = 600; // Time in seconds before reseting the list. Only used if time_or_length is set
// to TRUE

integer max_length = 100; // Maximum length the list can reach before reseting. Only used if time_or_length is
// set to FALSE

integer progress = TRUE; // If set to TRUE it will talk more often saying what its doing like when it resets
// the list etc. if its annoying just set it to FALSE

integer current_number = 0;

default
{
state_entry()
{
llSay(0, "Activated.");
llSensorRepeat("","","",range,PI,rate);
llListen(0, "", llGetOwner(), "");
if(time_or_length == TRUE)
{
llSetTimerEvent(reset_list_every);
}
}

sensor(integer total_number)
{
while(current_number < total_number)
{ if(llListFindList(given_to, [llDetectedKey(current_number)] != -1)
{
llGiveInventory(llDetectedKey(current_number),notecard);
given_to += [llDetectedKey(current_number)];
}
}
current_number = 0;

if(time_or_length == FALSE)
{
if(llGetListLength(given_to) >= max_length)
{
if(progress)
{
llSay(0, "Reseting list...");
}

given_to = [];
}
}
}

timer()
{
if(progress)
{
llSay(0, "Reseting list...");
}

given_to = [];
}

listen(integer channel, string name, key id, string message)
{
if(message == "help")
{
llOwnerSay("Here are a list of commands:");
llOwnerSay("help");
llOwnerSay("reset");
}

if(message == "reset")
{
given_to = [];
}
}
}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
06-17-2007 07:03
/15/b6/190513/1.html
_____________________
i've got nothing. ;)
Cemiess Villota
Registered User
Join date: 12 Apr 2007
Posts: 13
06-18-2007 10:15
I'll get it working, but DAMN the VBscript for not laying it out right, I think I have a problem with the braces. I just gotta tab it all to sort it out.
Oldspice Beresford
Registered User
Join date: 23 Apr 2007
Posts: 5
08-26-2007 22:46
I'm unfortunately unable to get this script running - has llscript been changed, or am I missing something?

The debugger is having issues with the opening bracket right after
"if(llListFindList(given_to, [llDetectedKey(current_number)] != -1)"


Thanks...
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
08-27-2007 01:38
Hint: count your ()'s.