Jump to content
mistressanubisra

Looking For Help With Dialog Menu Script

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

Share this post


Link to post
Share on other sites

You missed an accolade in your listen event. Replace lines 217-222 with:
 

                access = message;
                llOwnerSay("Access Mode: " + message);
                accessMenu(id);
            }
        }
    }

and it will work just fine.

  • Like 1

Share this post


Link to post
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.

Share this post


Link to post
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 ?

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...