Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Need help with a script

JustinMichael Torok
Old builder, new scripter
Join date: 29 Jul 2008
Posts: 23
11-20-2008 16:20
Every time I run the lsleditor debugger for the above code, it messes up.

Sometimes it'll reset, sometimes it won't; but it never does it on time :\
_____________________
Error 407: Unhandled exception in Galaxy 9.
Reboot Universe? Y/N
JustinMichael Torok
Old builder, new scripter
Join date: 29 Jul 2008
Posts: 23
11-20-2008 19:16
I also need to be able to set the panels up so that the username or uuid of the renters is saved somewhere. If they touch a panel and click "Like", I need it to change the panel they rented to add one more to the "ilike" variable. And finally, if the user clicks "like" on a panel, and the person who rented that panel clicks "like" on the other user's panel, I need it to send a message to both users saying the other user is a potential match.

Thanks :D
_____________________
Error 407: Unhandled exception in Galaxy 9.
Reboot Universe? Y/N
JustinMichael Torok
Old builder, new scripter
Join date: 29 Jul 2008
Posts: 23
11-20-2008 20:19
I got the timer working! I was stupid -_-* I just used the set timer event and it worked ^^

I still need help with the above question, though :\

Thanks :)
_____________________
Error 407: Unhandled exception in Galaxy 9.
Reboot Universe? Y/N
JustinMichael Torok
Old builder, new scripter
Join date: 29 Jul 2008
Posts: 23
11-20-2008 23:51
Sorry about the amount of posts. I just wanted to clarify some things:

I need the script below to somehow remember people who have rented the panels. If a man rents a panel, let's call him A, and clicks on a woman's (B) panel and selects "like", A's panel should add one to the "ilike" variable, and B's panel should add one to the "likedby" variable. If B clicks on A's panel and selects "like", I want the same to occur, but now I want a message sent to both A and B saying that a match has been made and giving them the other's username.

If possible, I would like to be able to set the script up so only a man can like a woman and a woman can only like a man. By like, I mean select the like option from the dialog.

Here's my script so far:

CODE

integer PRICE = 50; //Minimum price to rent the panel
integer CHANNEL = 7; //Channel to operate dialog boxes on
integer ilike = 0; //Number of people the renter likes
integer likedby = 0; //Number of people who like the renter
integer weeks = 0; //Number of weeks panel is being rented
list MENU_MAIN = ["OK"]; //Main dialog box
list MENU_PAID = ["Card", "Like"]; //Paid dialog box
list MENU_RENTER = ["Card", "Terminate"]; //Renter dialog box
list MENU_SURE = ["Yes", "No"]; //Sure? dialog box
string avatar_name; //Name of renter
string notecard; //Name of notecard
string texture; //Name of texture
key renter_id; //Renter UUID
key toucher; //Toucher UUID

text(string name, integer ilike2, integer likedby2)
{
llSetText("Name: " + avatar_name + "\nI like: " + ilike + "\nLiked By: "+ likedby, <1,1,0>, 1.0); //Change floating text on panel
}

default
{
state_entry()
{
llSetStatus(STATUS_BLOCK_GRAB, TRUE); //Prevent grabbing to prevent object drift
llSetPayPrice(PRICE, [PRICE, PRICE + PRICE, PRICE + (PRICE * 2), PRICE + (PRICE * 3)]); //Set the price to rent this panel
}
touch_start(integer total_number)
{
llSay(0, "Please right click and select pay. Each week costs 50L$");
}
money(key id, integer amount)
{
renter_id = id;
if(amount < PRICE & amount > 20) //If less than the minimum price is paid, but more than 20L is paid
llGiveMoney(renter_id, amount); //Then give the money back
else if(amount % PRICE != 0 & amount % PRICE > 20) //If the amount paid is higher than the minimum price and the mod of the two is greater than 20L
{
llGiveMoney(renter_id, amount % PRICE); //Then give the extra money back
weeks = amount / PRICE; //Set the number of weeks to the amount divided by price
state pay; //and enter state pay
}
else if(amount % PRICE != 0 & amount % PRICE <= 20) //if the amount paid is higher than the minimum price and the mod of the two is less than or equal to 20L
{
weeks = amount / PRICE; //set number of weeks to amount divided by price
state pay;//and enter state pay
if(amount % PRICE == 0) //if the amount paid is a multiple of the minimum price
{
weeks = amount / PRICE; //then set number of weeks to amount divided by price
state pay; //and enter state pay
}
}
state_exit()
{
llSay(0, "Processing Payment...");
}
}

state pay
{
state_entry()
{
llSay(0, "Payment received!");
llAllowInventoryDrop(TRUE); //Allow avatars to drag and drop items into the panel
llListen(CHANNEL, "", NULL_KEY, "");
llDialog(llDetectedKey(0), "Please hold CTRL while dragging your picture and application, at the same time, onto this panel.", MENU_MAIN, CHANNEL);
llSetTimerEvent(604800 * weeks); //Seconds in one week * number of weeks
}
changed(integer mask)//Try to detect if a notecard AND texture have been added to prevent mishaps*****
{
if(mask & (CHANGED_ALLOWED_DROP | CHANGED_INVENTORY)) //If the panel's inventory is changed
{
notecard = llGetInventoryName(INVENTORY_NOTECARD, 0); //Set notecard name
texture = llGetInventoryName(INVENTORY_TEXTURE, 0); //Set texture name
if (notecard != "" & texture != "") //If there is a notecard and texture
{
llSetTexture((string)INVENTORY_TEXTURE, ALL_SIDES); //Set texture to avatar's picture
llAllowInventoryDrop(FALSE); //Turn off allow to prevent errors
state listening; //Then begin state paid
}
}
}
listen(integer CHANNEL, string name, key id, string message)
{
avatar_name = name; //Set global avatar_name to avatar's name
if (message == "OK")
{
llSay(0, "Please enjoy our service, " + name + "! =D");
}
}
}

state listening
{
touch_start(integer total_number)
{
toucher = llDetectedKey(0); //Set toucher UUID
if (toucher != renter_id) //If toucher is not the renter
state notRenter; //enter state notRenter
else //If toucher is the renter
state Renter; //enter state Renter
}
timer()
{
llRemoveInventory(notecard); //Remove notecard from inventory
llRemoveInventory(texture); //Remove texture from inventory
llResetScript(); //Reset the script
}
}
state notRenter
{
state_entry()
{
llListen(CHANNEL, "", NULL_KEY, "");
llDialog(llDetectedKey(0), "To read " + avatar_name + "'s information card, click 'Card'. If you like " + avatar_name + ", click 'Like'", MENU_PAID, CHANNEL);
}
listen(integer CHANNEL, string name, key id, string message)
{
if (message == "Card")
{
llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_NOTECARD, 0)); //Give application notecard
state listening;
}
else if (message == "Like")
{
likedby += 1; //Increase likedby by 1
text(avatar_name, ilike, likedby);
state listening;
}
}
}
state Renter
{
state_entry()
{
llListen(CHANNEL, "", NULL_KEY, "");
llDialog(llDetectedKey(0), "To take a copy of your card, click 'Card'. To cancel your service, click 'Terminate'", MENU_RENTER, CHANNEL);
}
listen(integer CHANNEL, string name, key id, string message)
{
if (message == "Card")
{
llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_NOTECARD, 0)); //Give application notecard
state listening;
}
else if (message == "Terminate")
{
llDialog(llDetectedKey(0), "Are you sure you wish to terminate your profile with us?", MENU_SURE, CHANNEL);
if (message == "Yes")
llResetScript();
else
{
llSay(0, "Thank you for continuing to use our services! =D");
state listening;
}
}

}
}


Thanks :D
_____________________
Error 407: Unhandled exception in Galaxy 9.
Reboot Universe? Y/N
Jeredin Denimore
Romani Ite Domum
Join date: 5 Jul 2008
Posts: 95
11-21-2008 05:48
From: JustinMichael Torok
I got the timer working! I was stupid -_-* I just used the set timer event and it worked ^^

I still need help with the above question, though :\

Thanks :)

My original code was intended to NOT use a timer hehe. The idea is that
llSetTimerEvent() suffers from time dilation which can be enough of a
difference over a week's time to be noticable but not detrimental in your
specific case. Being a professional programmer and thus very anal lol,
I avoid such squirrely aspects of timers. If, however, a timer works for
you in this situation, by all means use it hehe :)
From: JustinMichael Torok
Sorry about the amount of posts. I just wanted to clarify some things:

I need the script below to somehow remember people who have rented the panels. If a man rents a panel, let's call him A, and clicks on a woman's (B) panel and selects "like", A's panel should add one to the "ilike" variable, and B's panel should add one to the "likedby" variable. If B clicks on A's panel and selects "like", I want the same to occur, but now I want a message sent to both A and B saying that a match has been made and giving them the other's username.

If possible, I would like to be able to set the script up so only a man can like a woman and a woman can only like a man. By like, I mean select the like option from the dialog.

Here's my script so far:
...<snip>...
Thanks :D

In order to track who likes who and whether or not they like each other, you'll need to store this information in a list. You will quickly run out of memory I would imagine though. Most people store this type of historical data on an external webserver in a database. My advice would be maybe to store the last 5 or 10 people they've indicated they liked and not everyone, though this might not work for your application.

Now as far as males and females... players have a gender, avatars do not. You would have to ask the person using your object to select their gender with a menu and save that information in order to compare genders.
Jeredin Denimore
Romani Ite Domum
Join date: 5 Jul 2008
Posts: 95
11-21-2008 06:05
From: JustinMichael Torok
I got the timer working! I was stupid -_-* I just used the set timer event and it worked ^^

Another thing to consider about timers is this... I'm guessing this application is a "dating board" showing everyone's picture on a panel? If so you're going to have a bunch of these panels all at once. Do you really want every single panel running a timer? While it sounds easier (and it is hehe), using a timer will likely result in very high script load on the sim you put this application in. Just a thought :)
JustinMichael Torok
Old builder, new scripter
Join date: 29 Jul 2008
Posts: 23
11-21-2008 08:06
OK, but how do I get it working without a timer? I tried the script on the first page, but it didn't work right. Also, how can I save to an external database?
_____________________
Error 407: Unhandled exception in Galaxy 9.
Reboot Universe? Y/N
Jeredin Denimore
Romani Ite Domum
Join date: 5 Jul 2008
Posts: 95
11-25-2008 06:06
From: JustinMichael Torok
OK, but how do I get it working without a timer? I tried the script on the first page, but it didn't work right. Also, how can I save to an external database?


Please feel free to contact me in game via IM.

Once we solve it we can come back and post the solution here :)
1 2