Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Guru Knowledge

KINGR Redgrave
Registered User
Join date: 23 Dec 2006
Posts: 37
12-27-2006 17:58
How would i add a command such as scan to this script?
CODE

string MENU_PROMPT = "What do you need help with?";
list MENU_BUTTONS = ["Scan", "option"];
list MENU_OPTION = ["help"];
integer MENU_CHANNEL = 1024;


default
{
state_entry()
{
llListen(0,"",NULL_KEY,"");
}

listen(integer channel, string name, key id, string message)
{
if (llToLower(message) == "help")

llDialog(id, MENU_PROMPT, MENU_BUTTONS, MENU_CHANNEL);
else if (message == "option")
llDialog(id, "", MENU_OPTION, MENU_CHANNEL);









}
}
Lazink Maeterlinck
Registered User
Join date: 8 Nov 2005
Posts: 332
12-27-2006 18:10
CODE


string MENU_PROMPT = "What do you need help with?";
list MENU_BUTTONS = ["Scan", "option"];
list MENU_OPTION = ["help"];
integer MENU_CHANNEL = 1024;


default
{
state_entry()
{
llListen(0,"",NULL_KEY,"");
}

listen(integer channel, string name, key id, string message)
{
if (llToLower(message) == "help")
{
llDialog(id, MENU_PROMPT, MENU_BUTTONS, MENU_CHANNEL);
llListen(MENU_CHANNEL, "", NULL_KEY, "");
}
else if (message == "option")
{
llDialog(id, "", MENU_OPTION, MENU_CHANNEL);
}
else if(message == "Scan")
{
llSensor(Sensor Parameters here);
}
}

sensor(integer number)
{
//Sensor Code here
}

no_sensor()
{
//No one/thing sensed, do stuff here
}
}


it's messy, I didn't clean up the listener or anything or time out the menu. but that's how you'd add a scan to it. If by scan you mean a sensor.
KINGR Redgrave
Registered User
Join date: 23 Dec 2006
Posts: 37
12-27-2006 18:21
Thanks! but im having a syntax error in my code can anyone help out real quick?
CODE

string MENU_PROMPT = "What do you need help with?";
list MENU_BUTTONS = ["Scan", "option"];
list MENU_OPTION = ["help"];
integer MENU_CHANNEL = 1024;


default
{
state_entry()
{
llListen(0,"",NULL_KEY,"");
}

listen(integer channel, string name, key id, string message)
{
if (llToLower(message) == "help")
{
llDialog(id, MENU_PROMPT, MENU_BUTTONS, MENU_CHANNEL);
llListen(MENU_CHANNEL, "", NULL_KEY, "");
}
else if (message == "option")
{
llDialog(id, "", MENU_OPTION, MENU_CHANNEL);
}
else if(message == "Scan")
{
llSensor("", NULL_KEY, AGENT, 10, PI);
}
}

sensor(integer total_number)
{
llWhisper(0, (string)total_number + " avatars detected" );
// The following 'for' loop runs through all detected avatars and says "Hello Jane Doe",
// where "Jane Doe" is the name of the current detected avatar.
integer i;
for (i = 0; i < total_number; i++)
{
llWhisper(0, "Hello " + llDetectedName(i));

}

no_sensor()
{
llSay(0, "Nobody is around.");
}
}
Gearsawe Stonecutter
Over there
Join date: 14 Sep 2005
Posts: 614
12-27-2006 18:55
a "}" just above no_sensor