Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Can someone add to raffle script for me?

Ross McCoy
Junior Member
Join date: 23 May 2004
Posts: 16
07-14-2004 13:34
Its the raffle script from the script library, I want it to always listen to my command, which it does. But I also want it to listen to someone elses command , which I can specify in the script by adding or removing the name. And if possible, have an in chanel command to reset script.....

Thanks
Heres the script.....


list names;
integer i;
integer j;
integer count;
string name;

integer find(string name)
{
for (i=0;i<count;i++)
if (llList2String(names,i) == name)
return i;
return -1;
}

default
{
state_entry()
{
llListen(0,"",llGetOwner(),"Find Winner";);
count = 0;
}

touch_start(integer total_number)
{
for (j=0;j<total_number;j++)
{
if (find(llDetectedName(j)) == -1)
{
name = llDetectedName(j);
names += name;
llSay(0,name + " has been entered.";);
count++;
}
}
}

listen(integer chan, string name, key id, string mes)
{
names = llListRandomize(names,1);
i = llFloor(llFrand(llGetListLength(names)));
llWhisper(0,"And the Winner is " + llList2String(names,i) +
"! There were " + (string)count + " participants.";);
llDeleteSubList(names,i,i);
}
}
Wednesday Grimm
Ex Libris
Join date: 9 Jan 2003
Posts: 934
07-14-2004 13:58
This isn't really a "Please write me a script" forum, but here's a list of people who are willing to help people out, either just for thanks or for money, look for them in-world

/54/ba/17223/1.html
_____________________
Sarcasm meter:
0 |-----------------------*-| 10
Rating: Awww Jeeze!
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
07-14-2004 15:22
If you want a raffle script, I sell one at my store in Chartreuse. It does everything you requested and more.

Contact me if you want more details.
_____________________
Need scripting help? Visit the LSL Wiki!
Omega Point - Catherine Omega's Blog
Jack Lambert
Registered User
Join date: 4 Jun 2004
Posts: 265
07-15-2004 14:42
I won't write your script for you but generally speaking....



At the moment you have it doing:

llListen(0,"",llGetOwner(),"Find Winner";);

If you were to rewrite the line to say:

llListen(0,"","","Find Winner";);

It would listen for "Find Winner" from anyone.
Ross McCoy
Junior Member
Join date: 23 May 2004
Posts: 16
07-15-2004 15:39
I dont need one now....
But some questions


in the line
llListen(0,"","","Find Winner";);

What are the "" with nothing in them for?
Hank Ramos
Lifetime Scripter
Join date: 15 Nov 2003
Posts: 2,328
07-15-2004 16:20
The four parameters of llListen are...

1. Channel Number
2. Name of Avatar/Object to Listen To
3. Key/UUID of Avatar/Object to Listen To
4. Word to Listen to

If you specify "" for Parameter 2 or 4, or NULL_KEY for Parameter 3, then you are instructing the listen to ignore those values. (Note: "" can be used in place of NULL_KEY, but you should use NULL_KEY when specifying no key, just to be correct).
_____________________
Ross McCoy
Junior Member
Join date: 23 May 2004
Posts: 16
07-15-2004 16:42
So each function has a specified number of parameters,and if you are not using some of them. you cant just leave them out, or change amount of parameters. you have to use "", or NULL_KEY.

So the types of parameters a function can do are set, and can't be changed?
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
07-15-2004 18:58
Right, you have to specify an empty value for every parameter. They can be 0, 0.0, "", NULL_KEY, ZERO_VECTOR, ZERO_ROTATION, or [], depending upon the type.

And yes, you can't attempt to do "llListen("mike";)" and hope that it figures out what you mean. It doesn't matter if it's a Linden function or a custom one, every function call must have a complete set of parameters passed to it.
_____________________
Need scripting help? Visit the LSL Wiki!
Omega Point - Catherine Omega's Blog