Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

A Dating Script

Sweet Thirty
Registered User
Join date: 23 May 2005
Posts: 14
01-20-2009 20:53
Is there a script out there that will allow me to give 1 notecard to each person until its empty?

I want to do a Secret Date Event for Valentines day... but I dont want to manually match people up... so I was wondering if someone could create a script to help me.

I'll have ONE BOX for Girls... ONE BOX for Guys.

Each person clicks on the BOX and gets a CARD with a COLOR on it.

then at the PARTY the two people with the same color match up for a dance.

But like I said i dont want to manually match them... and I want to know I'll have as many guys as girls in the party... so as each person clicks the box they'll be ONE less in the BOX.

Is there a Script that will do that for me?
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
01-20-2009 21:35
From: Sweet Thirty
Is there a script out there that will allow me to give 1 notecard to each person until its empty?

I want to do a Secret Date Event for Valentines day... but I dont want to manually match people up... so I was wondering if someone could create a script to help me.

I'll have ONE BOX for Girls... ONE BOX for Guys.

Each person clicks on the BOX and gets a CARD with a COLOR on it.

then at the PARTY the two people with the same color match up for a dance.

But like I said i dont want to manually match them... and I want to know I'll have as many guys as girls in the party... so as each person clicks the box they'll be ONE less in the BOX.

Is there a Script that will do that for me?


not tried in world, some syntax errors may exist

CODE

list names;

default
{
state_entry()
{
llListen(9,"",llGetOwner(),"");
llOwnerSay("Notecard Giver Started. Say /9say list to see the names on the list, or /9clear list to delete the names");
}

touch_start(integer num)
{
string name = llDetectedName(0);
key id = llDetectedKey(0);
integer num = llGetInventoryNumber(INVENTORY_NOTECARD);
if (num >= 0)
{
if(llListFindList(names,[name]) == -1)
{
integer i = (integer)llFrand(num-1);
string notecard = llGetInventoryName(INVENTORY_NOTECARD,i);
llGiveInventory(id,notecard);
llRemoveInventory(notecard);
names += name;
}
else
{
llInstantMessage(id,"You have already gotten a notecard");
}
}
else
{
llInstantMessage(id,"Sorry, there are no more notecards");
llInstantMessage(llGetOwner(),"I have run out of notecards");
}
}

listen(integer chan, string name, key id, string str)
{
if(llToLower(str) == "say list")
{
integer len = llGetListLength(names);
integer i;
for(i = 0;i<len;++i)
{
llOwnerSay(llList2String(names,i));
}
llOwnerSay((string)len + " names.");
}
else if(llToLower(str) == "clear list")
{
names = [];
llOwnerSay("Done Clearing Names");
}
}
}
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Sweet Thirty
Registered User
Join date: 23 May 2005
Posts: 14
01-21-2009 13:32
Thank you but did I forget to mention I dont know anything about SCRIPTS. :)

What do I do stick that in a Box... Create a new Script ... then Cut & Paste what you wrote into it?

Okay off to try it and THAK YOU!!!
Sweet Thirty
Registered User
Join date: 23 May 2005
Posts: 14
01-21-2009 17:00
I tried and your right I got error messages.

Thanks anyway.... *smiles*


Guess it cant be done
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
01-21-2009 19:01
oops, i didn't finish a line. edited above
arton Rotaru
Registered User
Join date: 27 Aug 2007
Posts: 43
01-21-2009 19:36
Made some minor changes and added a little. I hope Ruthven don't mind that i used his script.

In the line 'string hover_text = "Male Cards";' you can change the text 'Male Cards' to what you would prefer. Hovertext can be turned on and off by chat commands '/9text on' or '/9text off'.

Copy all between the ////////// in a New Script.

/////////////////////////////////////////
list names;
integer num;
integer CHANNEL = 9;
string hover_text = "Male Cards";
integer text_on = TRUE;

hover_text_on(){
num = llGetInventoryNumber(INVENTORY_NOTECARD);
if (text_on)
llSetText(hover_text +"\n"+ (string)num + " Cards left",<10.,1.0,1.0>,1.0);
else
llSetText("",<1.0,1.0,1.0>,0.0);
}

default
{
state_entry()
{
llListen(CHANNEL,"",llGetOwner(),"";);llOwnerSay("Notecard Giver Started. Say /9say list to see the names on the list, or /9clear list to delete the names\n
, or /9text on (off) to show or hide hovertext";);
hover_text_on();
}
touch_start(integer num)
{
string name = llDetectedName(0);
key id = llDetectedKey(0);
num = llGetInventoryNumber(INVENTORY_NOTECARD);
hover_text_on();
if(~llListFindList(names,[name]))
{
llInstantMessage(id,"You have already gotten a notecard";);
}
else if (num == 0)
{
llInstantMessage(id,"Sorry, there are no more notecards";);
llInstantMessage(llGetOwner(),"I have run out of notecards";);
}
else if (num > 0)
{
integer i = (integer)llFrand(num-1);
string notecard = llGetInventoryName(INVENTORY_NOTECARD,i);
llGiveInventory(id,notecard);
llRemoveInventory(notecard);
names += name;
hover_text_on();
}
}
listen(integer chan, string name, key id, string str)
{
if(llToLower(str) == "say list";)
{
integer len = llGetListLength(names);
integer i;
for(i = 0;i<len;++i){
llOwnerSay(llList2String(names,i));
}
llOwnerSay((string)len + " names.";);
}
else if(llToLower(str) == "clear list";)
{
names = [];
llOwnerSay("Done Clearing Names";);
}
else if(llToLower(str) == "text on";)
{
text_on = TRUE;
hover_text_on();
}
else if(llToLower(str) == "text off";)
{
text_on = FALSE;
hover_text_on();
}
}
changed(integer change)
{
if (change & CHANGED_INVENTORY){
hover_text_on();
}
}
}
//////////////////////////////////////////////////
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
01-21-2009 19:48
No same sex date option?
_____________________
-

So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.

I can be found on the web by searching for "SuezanneC Baskerville", or go to

http://www.google.com/profiles/suezanne

-

http://lindenlab.tribe.net/ created on 11/19/03.

Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard,
Robin, and Ryan

-
arton Rotaru
Registered User
Join date: 27 Aug 2007
Posts: 43
01-21-2009 19:52
From: SuezanneC Baskerville
No same sex date option?


Looks like this is a hetero party. lol
Zoey Helgerud
Overqualified
Join date: 13 Jun 2007
Posts: 44
01-21-2009 20:08
From: Sweet Thirty
Thank you but did I forget to mention I dont know anything about SCRIPTS. :)


-_-
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
01-21-2009 20:13
From: SuezanneC Baskerville
No same sex date option?


lol, i guess you could use it for whatever gender combo you want. i just whipped up a quick script based on what they asked for. it was fairly simple, otherwise i would have referred them to the products wanted forum
Osprey Therian
I want capslocklock
Join date: 6 Jul 2004
Posts: 5,049
01-22-2009 01:15
You could do it by having a give-random-inventory script and no-copy contents - for instance a buttoniere and corsage in different colors for men and women. They could wear the flowers and then look for their matching dates :-D
Sweet Thirty
Registered User
Join date: 23 May 2005
Posts: 14
01-22-2009 08:27
From: SuezanneC Baskerville
No same sex date option?



We have a LOT of pose balls, they dont have to have the same sex... they can do different ones. :D

JUST KIDDING.... doesnt matter... if I can set it up for boy-girl... it shouldnt be too hard for it to be boy-boy or girl-girl.... right?


Thank you SO much for your help.. and suggestions. I like the flower idea

okay off to try what I got... can I bring back any error messages I get here?

-_- <-- is that a good thing? ?_?
Sweet Thirty
Registered User
Join date: 23 May 2005
Posts: 14
01-22-2009 09:14
THANK YOU THANK YOU Ruthven Willenov & arton Rotaru for your help... it works GREAT.

Just ONE little thing. Is there a way I can make sure they card/flowers or whatever is giving out in a specific order... like if I number the items will it give out... 1-1 2-2 3-3 so that I can be sure that if only 3 people participate they'll be a matching 3 out as well?

Know what I mean... it will still be secret, unless the two people are standing there clicking the box at the same time and talk, which would be silly. But I wouldnt want a party where NONE of the colors match.
arton Rotaru
Registered User
Join date: 27 Aug 2007
Posts: 43
01-22-2009 15:48
Inventory Items are listed alphabetically. You can do it like this:
a notecard color red
b notecard color blue
c notecard color green
and so on.

To give always the first item on the list, look for the line


string notecard = llGetInventoryName(INVENTORY_NOTECARD,i);

in the script. Change the "i" after the comma to "0".
List indexing starts at zero.

Then you can comment out, by using 2 slashes // or simply delete the line.

integer i = (integer)llFrand(num-1);

llFrand return random numbers. It's not needed anymore.
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
01-22-2009 17:39
From: Sweet Thirty
THANK YOU THANK YOU Ruthven Willenov & arton Rotaru for your help... it works GREAT.

Just ONE little thing. Is there a way I can make sure they card/flowers or whatever is giving out in a specific order... like if I number the items will it give out... 1-1 2-2 3-3 so that I can be sure that if only 3 people participate they'll be a matching 3 out as well?

Know what I mean... it will still be secret, unless the two people are standing there clicking the box at the same time and talk, which would be silly. But I wouldnt want a party where NONE of the colors match.


lol, for some reason i got it in my head that you wanted them to receive a random one. guess it wouldn't really matter if they don't know who receives the matching color until the party anyways.

later on i might re-write the script to check how many notecards are left after ther person receives one. the changed inventory event doesn't get triggered if it's deleted by the script
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-22-2009 17:43
That's the trick with such games. You pretty much have to know exactly how many people are going to play in the end. You might be able to get away with doing a batch of 5 colors at once (randomly arranged), so at most three are unmatched in the end. Then there can be an announcement at the beginning of the unveiling: "If you have blue or green cards, please exchange them for a new card," or something like that (or, alternately, just announce that the odd colors will be matched together, and have a male and a female guest/helper, each of whom will dance only if there are an odd number of participants).
arton Rotaru
Registered User
Join date: 27 Aug 2007
Posts: 43
01-22-2009 19:50
From: Ruthven Willenov
... the changed inventory event doesn't get triggered if it's deleted by the script


Yes, but it,s triggered when adding notecards to the object. That's why I threw it in.
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
01-22-2009 19:56
From: arton Rotaru
Yes, but it,s triggered when adding notecards to the object. That's why I threw it in.


nevermind, i read too fast and didn't see that you were updating the hovertext after they received the notecard.

the only thing i would add is to instant message the owner when it runs out, rather than when someone clicks it after it has run out. because they probably won't know to click it if there's no text telling them to
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
arton Rotaru
Registered User
Join date: 27 Aug 2007
Posts: 43
01-22-2009 20:24
Yes, this could be pretty annoying for the owner. ^^
updated the function

Sweet,
copy this in the script and instead of the old function and delete the line llInstantMessage(llGetOwner(),"I have run out of notecards";);

in the default state. Now you get some practice in script editing. :-)

CODE

integer empty_msg = FALSE;

hover_text_on(){
num = llGetInventoryNumber(INVENTORY_NOTECARD);
if (text_on)
llSetText(hover_text +"\n"+ (string)num + " Cards left",<10.,1.0,1.0>,1.0);
else
llSetText("",<1.0,1.0,1.0>,0.0);
if (num == 0 && !empty_msg){
llInstantMessage(llGetOwner(),"I have run out of notecards");
empty_msg = TRUE;
}else if (num > 0){
empty_msg = FALSE;
}
}
Sweet Thirty
Registered User
Join date: 23 May 2005
Posts: 14
01-22-2009 20:26
From: Ruthven Willenov
the only thing i would add is to instant message the owner when it runs out, rather than when someone clicks it after it has run out. because they probably won't know to click it if there's no text telling them to



Oh can I get that? I was going to just put up a sign that said click box for a color card... if box show 0 Cards left, please IM me....

but if you can have the box email me when the cards run out... that would be better.

Hewee - thanks for the suggestions... I can do that... just IM those with a color card that's still in the other box tell them to just come click the box for a new card... I can have then do that 1 hour before the event so its still a surprise.

You guys are very helpful hope you come to the event its going to be at Club Epic.... not sure when yet but sometime close to Cupid Day... (cant spell Valentine)
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
01-22-2009 20:29
looks like you spelled it pretty well to me :-p
Sweet Thirty
Registered User
Join date: 23 May 2005
Posts: 14
01-22-2009 21:31
I think I got the other edit you wanted me to do, but the one above... I'm like HUH?

:( sorry... DID I do it right?

Deleted the line " integer i = (integer)llFrand(num-1) " and
Replaced the line " llInstantMessage(llGetOwner(),"I have run out of notecards";); " with what you had posted in the other script...so now I have what's below... did I do it right?

______________________________________________________

list names;
integer num;
integer CHANNEL = 9;
string hover_text = "Male Cards";
integer text_on = TRUE;

hover_text_on(){
num = llGetInventoryNumber(INVENTORY_NOTECARD);
if (text_on)
llSetText(hover_text +"\n"+ (string)num + " Cards left",<10.,1.0,1.0>,1.0);
else
llSetText("",<1.0,1.0,1.0>,0.0);
}

default
{
state_entry()
{
llListen(CHANNEL,"",llGetOwner(),"";);llOwnerSay("Notecard Giver Started. Say /9say list to see the names on the list, or /9clear list to delete the names\n
, or /9text on (off) to show or hide hovertext";);
hover_text_on();
}
touch_start(integer num)
{
string name = llDetectedName(0);
key id = llDetectedKey(0);
num = llGetInventoryNumber(INVENTORY_NOTECARD);
hover_text_on();
if(~llListFindList(names,[name]))
{
llInstantMessage(id,"You have already gotten a notecard";);
}
else if (num == 0)
{
llInstantMessage(id,"Sorry, there are no more notecards";);
CODE

integer empty_msg = FALSE;

hover_text_on(){
num = llGetInventoryNumber(INVENTORY_NOTECARD);
if (text_on)
llSetText(hover_text +"\n"+ (string)num + " Cards left",<10.,1.0,1.0>,1.0);
else
llSetText("",<1.0,1.0,1.0>,0.0);
if (num == 0 && !empty_msg){
llInstantMessage(llGetOwner(),"I have run out of notecards");
empty_msg = TRUE;
}else if (num > 0){
empty_msg = FALSE;
}
}

}
else if (num > 0)
{
string notecard = llGetInventoryName(INVENTORY_NOTECARD,i);
llGiveInventory(id,notecard);
llRemoveInventory(notecard);
names += name;
hover_text_on();
}
}
listen(integer chan, string name, key id, string str)
{
if(llToLower(str) == "say list";)
{
integer len = llGetListLength(names);
integer i;
for(i = 0;i<len;++i){
llOwnerSay(llList2String(names,i));
}
llOwnerSay((string)len + " names.";);
}
else if(llToLower(str) == "clear list";)
{
names = [];
llOwnerSay("Done Clearing Names";);
}
else if(llToLower(str) == "text on";)
{
text_on = TRUE;
hover_text_on();
}
else if(llToLower(str) == "text off";)
{
text_on = FALSE;
hover_text_on();
}
}
changed(integer change)
{
if (change & CHANGED_INVENTORY){
hover_text_on();
}
}
}
arton Rotaru
Registered User
Join date: 27 Aug 2007
Posts: 43
01-22-2009 21:42
From: Sweet Thirty


but if you can have the box email me when the cards run out... that would be better.



Ok, because this is the scripting tips forum you have to do a little by yourself, otherwise you should better try your luck in the products wanted forum.

llEmail sleeps the script for 20.0 seconds, so usually it is executed from a second script and triggered via llMessageLinked from the first script.

To achieve this you can add this line to the hover_text_on function below the llIstantMessage Line.

From: someone
llMessageLinked(LINK_SET, 0, "empty", "";);



And this goes in a second script.



From: someone
string email_address = "youremailaddress";

default
{
link_message(integer sender_num, integer num, string str, key id)
{
if (str == "empty";){
llEmail(email_address, "Dating Male Box is empty", "Dating Male Box ran out of notecards.";);
}
}
}


Edit: Ok , wait a second. I put it together for you. I know myself, that it is importend to get some working scripts in the beginning, to keep learning scripting. Otherwise it can be very frustrating. I was very lucky to find some working scripts here when i started building. Because, first of all you want your build working and don't want to learn LSL before you can do anything else.
Next post the script with email notification.
arton Rotaru
Registered User
Join date: 27 Aug 2007
Posts: 43
01-22-2009 21:45
From: someone
list names;
integer num;
integer CHANNEL = 9;
string hover_text = "Male Cards";
integer text_on = TRUE;
integer empty_msg = FALSE;

hover_text_on(){
num = llGetInventoryNumber(INVENTORY_NOTECARD);
if (text_on)
llSetText(hover_text +"\n"+ (string)num + " Cards left",<10.,1.0,1.0>,1.0);
else
llSetText("",<1.0,1.0,1.0>,0.0);
if (num == 0 && !empty_msg){
llInstantMessage(llGetOwner(),"I have run out of notecards";);
llMessageLinked(LINK_SET, 0, "empty", "";);
empty_msg = TRUE;
}else if (num > 0){
empty_msg = FALSE;
}
}

default
{
state_entry()
{
llListen(CHANNEL,"",llGetOwner(),"";);llOwnerSay("Notecard Giver Started. Say /9say list to see the names on the list, or /9clear list to delete the names\n
, or /9text on (off) to show or hide hovertext";);
hover_text_on();
}
touch_start(integer num)
{
string name = llDetectedName(0);
key id = llDetectedKey(0);
num = llGetInventoryNumber(INVENTORY_NOTECARD);
if(~llListFindList(names,[name]))
{
llInstantMessage(id,"You have already gotten a notecard";);
}
else if (num == 0)
{
llInstantMessage(id,"Sorry, there are no more notecards";);
}
else if (num > 0)
{
string notecard = llGetInventoryName(INVENTORY_NOTECARD,0);
llGiveInventory(id,notecard);
llRemoveInventory(notecard);
names += name;
hover_text_on();
}
}
listen(integer chan, string name, key id, string str)
{
if(llToLower(str) == "say list";)
{
integer len = llGetListLength(names);
integer i;
for(i = 0;i<len;++i){
llOwnerSay(llList2String(names,i));
}
llOwnerSay((string)len + " names.";);
}
else if(llToLower(str) == "clear list";)
{
names = [];
llOwnerSay("Done Clearing Names";);
}
else if(llToLower(str) == "text on";)
{
text_on = TRUE;
hover_text_on();
}
else if(llToLower(str) == "text off";)
{
text_on = FALSE;
hover_text_on();
}
}
changed(integer change)
{
if (change & CHANGED_INVENTORY){
hover_text_on();
}
}
}



Second Script

From: someone
string email_address = "youremailaddress";

default
{
link_message(integer sender_num, integer num, string str, key id)
{
if (str == "empty";){
llEmail(email_address, "Dating Male Box is empty", "Dating Male Box ran out of notecards.";);
}
}
}


llEmail(email_address, "Subject", "Message";);

Edit: posted the one with random numbers, edited it to the list order one.
Sweet Thirty
Registered User
Join date: 23 May 2005
Posts: 14
01-23-2009 08:57
From: arton Rotaru
Ok, because this is the scripting tips forum you have to do a little by yourself, otherwise you should better try your luck in the products wanted forum.


I'm sorry... guess your right, but I didnt need the product just the script. I can build the product I just couldnt find the script to do what I wanted... Usually I can find the script I need for what want.... then cut & paste it... just couldnt find one this time... should I have said that on the product board?

I dont know anything about scripts... except to cut & past and edit a word or two.

I totally beyond totally appreciate your help... I mean beyond thank you. :)
1 2