Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Raffle Ticket Script

Avonley Mills
Ley-Mitz Designer
Join date: 17 Mar 2007
Posts: 12
04-15-2007 23:01
I'm currently planning a type of raffle system for my products in a store as a way to wash out old stock and introduce new stock. I cant seem to find the correct wording to find a script that would work for this. More or less I want it to take a notecard "ticket", then when I am ready to draw a name, it randomizes one card it was given, and that would be the winner. Does that make sense? Anyone know where I could get my hands on something like this?

Thanks in advance!!
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-15-2007 23:23
From: Avonley Mills
I'm currently planning a type of raffle system for my products in a store as a way to wash out old stock and introduce new stock. I cant seem to find the correct wording to find a script that would work for this. More or less I want it to take a notecard "ticket", then when I am ready to draw a name, it randomizes one card it was given, and that would be the winner. Does that make sense? Anyone know where I could get my hands on something like this?

Thanks in advance!!


It would depend upon when/how you want to trigger it and what the contents of a the notecard was going to be, i.e. how it relates to the draw.

However the basic's of drawinga random notecard would be:
CODE

integer number = llGetInventoryType(INVENTORY_NOTECARD);
integer winner = (integer)llFrand(number);
Avonley Mills
Ley-Mitz Designer
Join date: 17 Mar 2007
Posts: 12
04-16-2007 19:05
I'm not familliar with scripting at all. Mostly, I just want to know if one is out there that does that. I dont want it to be totally computer controlled.. I want it so that through-out the day, people can add raffle tickets.. and at a set time I click it to pull a name out. Is that possible with our scripting system?
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
04-16-2007 19:19
It is possible. It is also very easy. However...this forum is for helping each other in self-creation of scripts. If you're looking for a product, try "Products Wanted" or contact a scripter that does custom work in-world.

But basically...the code would be along the lines of what Newgate said. In fact, I would imagine it wouldn't take much more than 10 lines total to make what you're lookin' for.
_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-16-2007 23:45
As Kenn said its a pretty simple script although thats a relative term.
The major portion of the code will be setting up the object to allow inventory dropping by others and 'security' code to stop people from dropping bogus material in to the object.
Making it so that it draws only when you want isn't a problem, just put the selection code into a touch_start event keyed only to work for you.

To allow for reuse you'd also want an auto clear function, so it deletes all the notecards in its inventory when a winner has been picked.

I'd also be inclined to add tracking/logging functionality to see see if anyone was trying to circumvent the system at any point.