Jump to content

Looking For Help With Dialog Menu Script


mistressanubisra
 Share

You are about to reply to a thread that has been inactive for 1777 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

so the issue so far is that timer is coming back with a syntax error normally i dont have much issues but im at a block and could use advice and knowledge from the community

Quote

list notecardsList;

float CRATE = 20.0; 
integer listener;
integer mainMenuChannel;
integer accessChannel;
integer check = 0;
integer notecardLine;
 
string notecardName = "!access";
key query;
 
string access = "Owner";
 
list accessList;
 
integer randomNumber()
{
    return (integer)(llFrand(99999.0))*-1;
}
 
menu(key user,integer channel,string title,list buttons)
{
    llListenRemove(listener);
    listener = llListen(channel,"","","");
    llDialog(user,title,buttons,channel);
    llSetTimerEvent(25.0);
}
 
mainMenu(key id)
{
    llListenRemove(listener);
    mainMenuChannel = randomNumber();
    menu(id,mainMenuChannel,"MainMenu",["-", "QSpin", "HSpin", "Fspin", "Access"]);
}
 

integer isOnList(list src, list find)
{
     return (llListFindList(src,find) > -1);
}
 

integer checkAccess(key id)
{
    string name = llToLower(llKey2Name(id));
 
    return (id == llGetOwner()) || (llSameGroup(id) && access == "Group") || ( (isOnList(accessList,[name]) && (access == "List") ) || (access == "Anyone") );
}
 
accessMenu(key id)
{
    accessChannel = randomNumber();
    menu(id,accessChannel,"Access Menu " + "\n \n \n *Actual Access Level = " + access,["Owner","Group","Anyone","<< Back","List"]);
}
 
default
{
    state_entry()
    {
 
        if (llGetInventoryType(notecardName) == INVENTORY_NOTECARD)
        {
            
            llOwnerSay("Configuring, please wait...");
            notecardLine = 0;
            query = llGetNotecardLine(notecardName,notecardLine);
            llTargetOmega(<0,0,0.5>,0.3,PI);
        }
        else
        {
            state ready;
        }
    }
 
    dataserver(key requested, string data)
    {
        if (requested == query)
        {
            if (data != EOF)
            {
                if ( (llGetSubString(data,0,0) != "#") && (data != "") ) 
                {
                    string name = llToLower(llStringTrim(data,STRING_TRIM)); 
 
                    if (llGetFreeMemory() >= 1024) 
                    {
                        accessList = (accessList = []) + accessList + [name];
                    }
                    else
                    {
                        llOwnerSay(name + " could not be added because the script is running out of memory");
                        state ready;
                    }
                }
                notecardLine++;
                query = llGetNotecardLine(notecardName,notecardLine);
            }
            else
            {
                state ready;
            }
        }
    }
 
    on_rez(integer n)
    {
        if (llGetInventoryType("!config") == INVENTORY_TEXTURE)
        {
            llOwnerSay("Configuring, please wait...");
            notecardLine = 0;
            query = llGetNotecardLine(notecardName,notecardLine);
        }
        else
        {
            state ready;
        }
    }
}
 
state ready
{
    state_entry()
    {
        llOwnerSay("--- Ready ---");
    }
 
    changed (integer c)
    {
        if (c & CHANGED_INVENTORY)
        {
            
            llResetScript();
        }
    }
 
    touch_start(integer total_number)
    {
        key toucher = llDetectedKey(0);
        if (checkAccess(toucher))
        {
            mainMenu(toucher);
        }
        else
        {
            llSay(0,"Sorry you don't have access to the main menu, current access level: " + access);
        }
    }
 
    listen(integer channel, string name, key id, string message)
    {
        if (channel == mainMenuChannel)
        {
            if (message == "-")
        {
            
        }
            llSetTimerEvent(0);
            if (message == "QSpin")
        {
            llSay(0," Has Quarter Turned Me");
            llTargetOmega(<0,0,-0.5>, 8.0, PI);
            llSleep(0.25);
            llTargetOmega(<0,0,0.5>,0.3,PI);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            check = 1;             
        }
        if (message == "HSpin")
        {
            llSay(0, " Has Half Turned Me");
            llTargetOmega(<0,0,-0.5>, 8.0, PI);
            llSleep(0.5);
            llTargetOmega(<0,0,0.5>,0.3,PI);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            check = 1;
        }
        if (message == "FSpin")
        {
            llSay(0," Has Turned Me a Full Rotation");
            llTargetOmega(<0,0,-0.5>, 8.0, PI);
            llSleep(1.0);
            llTargetOmega(<0,0,0.5>,0.3,PI);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            check = 0;    
            
            if ( (message == "Access") && (id == llGetOwner())) 
            {
                accessMenu(id);
            }
            else
            {
                llSay(0,"Sorry, only owner can access to this menu");
            }
        }
        else if (channel == accessChannel)
        {
            if (message == "<< Back")
            {
                mainMenu(id);
                return;
            }
 
            access = message;
            llOwnerSay("Access Mode: " + message);
            accessMenu(id);
        }
    }

 
    timer()
    {
        llListenRemove(listener);
        llSetTimerEvent(0);
    }
}
 

 

Edited by mistressanubisra
Link to comment
Share on other sites

14 minutes ago, mistressanubisra said:

ok now further issue is that Fspin is not functioning 

Your button is named "Fspin" but your listener listens for "FSpin", with a capital S. 
Change one of the two to match the other and it should work like the rest does.

Link to comment
Share on other sites

so a new error has occurried where when Fspin is launched it spits out the access error message Sorry, only owner can access to this menu in cordination of the spin and i have no access to the access functions to change it from owner group list or anyone any suggestions that may help ?

Link to comment
Share on other sites

list notecardsList;

float CRATE = 20.0; 
integer listener;
integer mainMenuChannel;
integer accessChannel;
integer check = 0;
integer notecardLine;
 
string notecardName = "!access";
key query;
 
string access = "List";
 
list accessList;
 
integer randomNumber()
{
    return (integer)(llFrand(99999.0))*-1;
}
 
menu(key user,integer channel,string title,list buttons)
{
    llListenRemove(listener);
    listener = llListen(channel,"","","");
    llDialog(user,title,buttons,channel);
    llSetTimerEvent(25.0);
}
 
mainMenu(key id)
{
    llListenRemove(listener);
    mainMenuChannel = randomNumber();
    menu(id,mainMenuChannel,"MainMenu",["-", "QSpin", "HSpin", "FSpin", "Access"]);
}
 

integer isOnList(list src, list find)
{
     return (llListFindList(src,find) > -1);
}
 

integer checkAccess(key id)
{
    string name = llToLower(llKey2Name(id));
 
    return (id == llGetOwner()) || (llSameGroup(id) && access == "Group") || ( (isOnList(accessList,[name]) && (access == "List") ) || (access == "Anyone") );
}
 
accessMenu(key id)
{
    accessChannel = randomNumber();
    menu(id,accessChannel,"Access Menu " + "\n \n \n *Actual Access Level = " + access,["Owner","Group","Anyone","<< Back","List"]);
}
 
default
{
    state_entry()
    {
 
        if (llGetInventoryType(notecardName) == INVENTORY_NOTECARD)
        {
            
            llOwnerSay("Configuring, please wait...");
            notecardLine = 0;
            query = llGetNotecardLine(notecardName,notecardLine);
            llTargetOmega(<0,0,0.5>,0.3,PI);
        }
        else
        {
            state ready;
        }
    }
 
    dataserver(key requested, string data)
    {
        if (requested == query)
        {
            if (data != EOF)
            {
                if ( (llGetSubString(data,0,0) != "#") && (data != "") ) 
                {
                    string name = llToLower(llStringTrim(data,STRING_TRIM)); 
 
                    if (llGetFreeMemory() >= 1024) 
                    {
                        accessList = (accessList = []) + accessList + [name];
                    }
                    else
                    {
                        llOwnerSay(name + " could not be added because the script is running out of memory");
                        state ready;
                    }
                }
                notecardLine++;
                query = llGetNotecardLine(notecardName,notecardLine);
            }
            else
            {
                state ready;
            }
        }
    }
 
    on_rez(integer n)
    {
        if (llGetInventoryType("!config") == INVENTORY_TEXTURE)
        {
            llOwnerSay("Configuring, please wait...");
            notecardLine = 0;
            query = llGetNotecardLine(notecardName,notecardLine);
        }
        else
        {
            state ready;
        }
    }
}
 
state ready
{
    state_entry()
    {
        llOwnerSay("--- Ready ---");
    }
 
    changed (integer c)
    {
        if (c & CHANGED_INVENTORY)
        {
            
            llResetScript();
        }
    }
 
    touch_start(integer total_number)
    {
        key toucher = llDetectedKey(0);
        if (checkAccess(toucher))
        {
            mainMenu(toucher);
        }
        else
        {
            llSay(0,"Sorry you don't have access to the main menu, current access level: " + access);
        }
    }
 
    listen(integer channel, string name, key id, string message)
    {
        if (channel == mainMenuChannel)
        {
            if (message == "-")
        {
            
        }
            llSetTimerEvent(0);
            if (message == "QSpin")
        {
            llSay(0," Has Quarter Turned Me");
            llTargetOmega(<0,0,-0.5>, 8.0, PI);
            llSleep(0.25);
            llTargetOmega(<0,0,0.5>,0.3,PI);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            check = 1;             
        }
        if (message == "HSpin")
        {
            llSay(0, " Has Half Turned Me");
            llTargetOmega(<0,0,-0.5>, 8.0, PI);
            llSleep(0.5);
            llTargetOmega(<0,0,0.5>,0.3,PI);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            check = 1;
        }
        if (message == "FSpin")
        {
            llSay(0," Has Turned Me a Full Rotation");
            llTargetOmega(<0,0,-0.5>, 8.0, PI);
            llSleep(1.0);
            llTargetOmega(<0,0,0.5>,0.3,PI);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            llRegionSayTo(llGetOwner(),-9999999, "charge " + (string)CRATE);
            check = 1;    
        }
        if ( (message == "Access") && (id == llGetOwner())) 
        {
            accessMenu(id);
        }
        else
        {
                llSay(0,"Sorry, only owner can access to this menu");
        }
    }
        else if (channel == accessChannel)
        {
            if (message == "<< Back")
            {
                mainMenu(id);
                return;
            }
 
            access = message;
            llOwnerSay("Access Mode: " + message);
            accessMenu(id);
        }
    }
    
    timer()
    {
        llListenRemove(listener);
        llSetTimerEvent(0);
    }
}

this is the new edits any suggestions

Edited by mistressanubisra
wrong code submit
Link to comment
Share on other sites

4 hours ago, mistressanubisra said:

so a new error has occurried where when Fspin is launched it spits out the access error message Sorry, only owner can access to this menu in cordination of the spin and i have no access to the access functions to change it from owner group list or anyone any suggestions that may help ?

the rules for who can access the menu are in the function checkAccess(..)

to help you to better understand what these rules are, and what rule values are needed for the function to return TRUE then best to break out the rules into if else if clauses:

if (1st rule is true)
{
   return TRUE;
}
else if (2nd rule is true)
{
   return TRUE;
}
else if (3rd rule is true)
{
   return TRUE;
}
else
{
   return FALSE;
}

then use llSay(0, ... values as text ...) to debug (give you feedback) to Nearby Chat of what the values are, that the rules are being applied too

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1777 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...