rendered paste bodyinteger channel = 42;
integer letter = 34;
string notecard = "CONTROLLERS"; // name of a notecard in the object's inventory
integer notecard_line = 0; // current line number
key notecard_q_id; // id used to identify dataserver queries
list controllers = [];
list clicker = [];
list MENU_CONTROLLER_CLICK = ["Take Control", "Reset", "Ignore"];
check_controllers(string name, key id)
{
clicker = [name];
llSay(0, "Clicker: "+(string)clicker);
notecard_q_id = llGetNotecardLine(notecard, notecard_line); // request first line
integer vote_controller = llListFindList(controllers, clicker);
llSay(0, "vote_controller: "+(string)vote_controller);
if (vote_controller >= 0)
{
llDialog(id, "What would you like to do?", MENU_CONTROLLER_CLICK, channel);
}
}
fill_list()
{
notecard_q_id = llGetNotecardLine(notecard, notecard_line); // request first line
}
default
{
listen(integer chan, string name, key id, string message)
{
llSay(0, "asdfasdfasdf");
// llSay(0, name + " picked the option '" + message + "'."); // output the answer
}
touch_start(integer total_number)
{
key id = llDetectedKey(0);
check_controllers((string)llDetectedName(0), id);
llMessageLinked(LINK_ALL_OTHERS, letter, "Changing Letter", NULL_KEY);
}
state_entry() {
fill_list();
llListen(channel, "", NULL_KEY, "");
}
dataserver(key query_id, string data) {
if (query_id == notecard_q_id) {
if (data != EOF) { // not at the end of the notecard
controllers += [(string)data];
++notecard_line; // increase line count
notecard_q_id = llGetNotecardLine(notecard, notecard_line); // request next line
}
}
}
}