Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Script go wrong?

Melissa Ordram
Registered User
Join date: 24 May 2009
Posts: 4
08-06-2009 16:42
I am working on a project for a small group that I am with. Problem is, I can not get my script to do right. I am trying to get it where when, the object is pushed, a menu will come up. I got the menu to come up, but I need to have the script to send a instant message to a certain groupe of peoproblem is, when the button for 'Yes" is pushed, it does not send the message. I know how to get the Popup menu personalized, but I do not know how to personalize the message that is sent. My script is as follows:



integer CHANNEL = -499899882; // dialog channel
list MENU_MAIN = ["Yes", "No"]; // the main menu
// a submenu

default {

state_entry() {
llListen(CHANNEL, "", NULL_KEY, "";); // listen for dialog answers (from multiple users)
}

touch_start(integer total_number)
{
llDialog(llDetectedKey(0), "How Much?", MENU_MAIN, CHANNEL); // present dialog on click
}

listen(integer channel, string name, key id, string message)
{
if (llListFindList(MENU_MAIN, [message]) != -1) // verify dialog choice

llSay(1, name + " picked the option '" + message + "'.";); // output the answer

else if (message == "Yes";)
llInstantMessage(llGetOwner(), "Instant message goes here";);
else if (message == "No";)
llInstantMessage(llGetOwner(), "Instant message goes here";);
else
llSay(0, name + " picked invalid option '" + llToLower(message) + "'.";); // not a valid dialog choice
}
}
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
08-06-2009 16:49
It's because you use "else if" to see if the script should send instant messages. The only case in which the script will reach the "else if" tests is when "message" is NOT found in your MENU_MAIN list. And that test won't fail because the only possible options exist in MENU_MAIN. You could probably remove the first "if...test" and have the script llSay(...) what it says.

After that, replace:
else if (message == "Yes";)

with:
if (message == "Yes";)
Melissa Ordram
Registered User
Join date: 24 May 2009
Posts: 4
08-07-2009 09:16
That worked perfectly on the corrections. It still comes up, I can not have my instant message to be sent when "Yes" is clicked.It sends, but not the right way. I wwrote down "+llDetectName(0) needs assistance", but it does not send it right. It just asys Synthax error.Thank you :)
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
08-07-2009 10:40
First: llDetectedName() only works in touch and sensor events.
Second: when embedding a function or variable in a string you need to do "string" + function() + "string"

In other words, I think you want to do this:

CODE

llInstantMessage(llGetOwner(), name + " needs assistance.");