list main_menu = ["Time", "Cancel"];
list sit_menu = ["Sit Options"];
list MENU;
integer listen_handle;
integer channel;
integer AgentSitting(key kk) {
integer a = llGetNumberOfPrims();
while(1 < a){
key lk=llGetLinkKey(a);
if(llGetAgentSize(lk)){
if (lk==kk) return TRUE;
--a;
}
else return FALSE;
}
return FALSE;
}
dlg(key kk) {
stopt();
channel = -((integer)llFrand(20000000)+1000);
listen_handle = llListen(channel, "", kk, "");
llSetTimerEvent(120);
llDialog(kk, "\n\nSelect an Option", MENU, channel);
}
stopt(){
llListenRemove(listen_handle);
llSetTimerEvent(0);
}
default
{
listen(integer channel, string name, key id, string message) {
if (llListFindList(MENU, [message]) != -1) {
if (message == "Sit Options") llDialog(id, "\nCLICK:\n\nm for Menu\n\na to Adjust Position", ["m","a"], 1);
else if (message == "Time") llSay(0,llGetTimestamp());
stopt();
}
}
timer(){ stopt(); }
touch_start(integer s) {
key k=llDetectedKey(0);
MENU=main_menu;
if (AgentSitting(k)) MENU=sit_menu+MENU;
dlg(k);
}
}