Jump to content

Menu section on separate script


Surssin
 Share

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

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

Recommended Posts

So with a little help I DID finally clear the syntax error. Had to cheat a little to get around a "dead code" error, but now I get a different one; "Not all code paths return a value"

I think it's time I just posted the whole second script (the first one is behaving, though no idea if the linking works yet), and see if I can get schooled on what I'm missing and how to make what I want to happen, happen.

For reference, "RLV 1..." is the first page of this second script's menu, and the one the main menu would call up when someone chooses "RLV" on the main meny. I'll also need to tune things so that when "Main Menu" is chosen, you get the main menu.

integer RLVFlags=65533; 

list pList; 
key tkey; 


RLVRefresh()
{
       if(RLVFlags & 4)
            trestrict += ",showinv=y";
        else
            trestrict += ",showinv=n";
                        
        if(RLVFlags & 32)
            trestrict += ",addoutfit=y,addattach=y";
        else
            trestrict += ",addoutfit=n,addattach=n";
            
        if(RLVFlags & 64)
            trestrict += ",remoutfit=y,remattach=y";
        else
            trestrict += ",remoutfit=n,remattach=n";
            
        if(RLVFlags & 128)
            trestrict += ",touchattachother=y";
        else
            trestrict += ",touchattachother=n";
            
        if(RLVFlags & 256)
            trestrict += ",touchattachself=y";
        else
            trestrict += ",touchattachself=n";
            
        if(RLVFlags & 512)
            trestrict += ",touchworld=y";
        else
            trestrict += ",touchworld=n";
            
        if(RLVFlags & 1024)
            trestrict += ",edit=y";
        else
            trestrict += ",edit=n";
            
        if(RLVFlags & 2048)
            trestrict += ",rez=y";
        else
            trestrict += ",rez=n";
            
        if(RLVFlags & 4096)
            trestrict += ",touchfar=y";
        else
            trestrict += ",touchfar=n";
            
        if(RLVFlags & 8192)
            trestrict += ",sittp=y";
        else
            trestrict += ",sittp=n";
            
        if(RLVFlags & 16384)
            trestrict += ",showworldmap=y,showminimap=y";
        else
            trestrict += ",showworldmap=n,showminimap=n";
            
        if(RLVFlags & 24)
            trestrict += ",shownearby=y,shownametags=y";
        else
            trestrict += ",shownearby=n,shownametags=n";
            
        if(RLVFlags & 32768)
            trestrict += ",startim=y";
        else
            trestrict += ",startim=n";
                        
        llOwnerSay(trestrict);
    }

string IsOffOn(integer value)
{
    if(value)
        return "off";
    return "on";   
}

string IsBlockedAllowed(integer value)
{
    if(value)
        return "allowed";
    return "BLOCKED";   
}

string At()
{
 

{
    }
    
    if(option == "RLV 1...")
    {
        
        
        
        tstring = "Configure the current RLV options (1/2).\nRLV is currently ";
        
        if(RLVFlags & 1) tstring += "ACTIVE\n\n";
        else tstring += "DISABLED\n\n";
        
        tstring += "Current Restrictions:"+"\nInventory - "+
IsBlockedAllowed(RLVFlags & 4) +"\nWear clothing - "+ IsBlockedAllowed(RLVFlags & 32) +"\nUnwear clothing - "+ IsBlockedAllowed(RLVFlags & 64) +"\nTouch attach (other) - "+ IsBlockedAllowed(RLVFlags & 128) +"\nTouch attach (self) - "+ IsBlockedAllowed(RLVFlags & 256) +"\nTouch world - "+ IsBlockedAllowed(RLVFlags & 512) +"\n(More on page 2)";

        tlist = ["Disable All RLV", "Unwear "+ IsOffOn(RLVFlags & 64), "Touch Wld "+ IsOffOn(RLVFlags & 512), "Enable Most RLV", "Wear "+ IsOffOn(RLVFlags & 32), "Touch Sel "+ IsOffOn(RLVFlags & 256), "Enable All RLV", "Inv. "+ IsOffOn(RLVFlags & 4), "Touch Oth "+ IsOffOn(RLVFlags & 128), "Main Menu", "RLV 2..."];
    }
    else if(option == "RLV 2...")
    {
        
        
        
        tstring = "Configure the current RLV options (2/2).\nRLV is currently ";
        
        if(RLVFlags & 1) tstring += "ACTIVE\n\n";
        else tstring += "DISABLED\n\n";
        
        tstring += "Current restrictions:\nEdit - "+ IsBlockedAllowed(RLVFlags & 1024) +"\nRez - "+ IsBlockedAllowed(RLVFlags & 2048) +"\nMaps & Location "+ IsBlockedAllowed(RLVFlags & 16384) +"\nFar touch - "+ IsBlockedAllowed(RLVFlags & 4096) +"\nFar sit - "+ IsBlockedAllowed(RLVFlags & 8192) +"\nStartIM - "+ IsBlockedAllowed(RLVFlags & 32768) +"\nNametags & Radar - "+
IsBlockedAllowed(RLVFlags & 24) +"\n(More on page 1)";

        tlist = ["Disable All RLV", "Maps "+ IsOffOn(RLVFlags & 16384), "Nametags "+ IsOffOn(RLVFlags & 24), "Enable Most RLV", "Rez "+ IsOffOn(RLVFlags & 2048), "StartIM "+ IsOffOn(RLVFlags & 32768), "Enable All RLV", "Edit "+ IsOffOn(RLVFlags & 1024), "Farsit "+ IsOffOn(RLVFlags & 8192), "Main Menu", "RLV 1...", "Fartouch "+ IsOffOn(RLVFlags & 4096)];
    
            }
    
    else if(llSubStringIndex(message, "Inv. ") == 0)
    {
        if(llGetSubString(message, -3, -1) == "off")
            RLVFlags = ((RLVFlags | 4) ^ 4);
        else
            RLVFlags = RLVFlags | 4;
        remenu = "RLV...";
    }
    else if(llSubStringIndex(message, "Wear ") == 0)
    {
        if(llGetSubString(message, -3, -1) == "off")
            RLVFlags = ((RLVFlags | 32) ^ 32);
        else
            RLVFlags = RLVFlags | 32;
        remenu = "RLV...";
    }
    else if(llSubStringIndex(message, "Unwear ") == 0)
    {
        if(llGetSubString(message, -3, -1) == "off")
            RLVFlags = ((RLVFlags | 64) ^ 64);
        else
            RLVFlags = RLVFlags | 64;
        remenu = "RLV...";
    }
    else if(llSubStringIndex(message, "Touch Oth ") == 0)
    {
        if(llGetSubString(message, -3, -1) == "off")
            RLVFlags = ((RLVFlags | 128) ^ 128);
        else
            RLVFlags = RLVFlags | 128;
        remenu = "RLV...";
    }
    else if(llSubStringIndex(message, "Touch Sel ") == 0)
    {
        if(llGetSubString(message, -3, -1) == "off")
            RLVFlags = ((RLVFlags | 256) ^ 256);
        else
            RLVFlags = RLVFlags | 256;
        remenu = "RLV...";
    }
    else if(llSubStringIndex(message, "Touch Wld ") == 0)
    {
        if(llGetSubString(message, -3, -1) == "off")
            RLVFlags = ((RLVFlags | 512) ^ 512);
        else
            RLVFlags = RLVFlags | 512;
        remenu = "RLV...";
    }
    else if(llSubStringIndex(message, "Edit ") == 0)
    {
        if(llGetSubString(message, -3, -1) == "off")
            RLVFlags = ((RLVFlags | 1024) ^ 1024);
        else
            RLVFlags = RLVFlags | 1024;
        remenu = "RLV 2...";
    }
    else if(llSubStringIndex(message, "Rez ") == 0)
    {
        if(llGetSubString(message, -3, -1) == "off")
            RLVFlags = ((RLVFlags | 2048) ^ 2048);
        else
            RLVFlags = RLVFlags | 2048;
        remenu = "RLV 2...";
    }
    else if(llSubStringIndex(message, "Fartouch ") == 0)
    {
        if(llGetSubString(message, -3, -1) == "off")
            RLVFlags = ((RLVFlags | 4096) ^ 4096);
        else
            RLVFlags = RLVFlags | 4096;
        remenu = "RLV 2...";
    }
    else if(llSubStringIndex(message, "Farsit ") == 0)
    {
        if(llGetSubString(message, -3, -1) == "off")
            RLVFlags = ((RLVFlags | 8192) ^ 8192);
        else
            RLVFlags = RLVFlags | 8192;
        remenu = "RLV 2...";
    }
    else if(llSubStringIndex(message, "StartIM ") == 0)
    {
        if(llGetSubString(message, -3, -1) == "off")
            RLVFlags = ((RLVFlags | 32768) ^ 32768);
        else
            RLVFlags = RLVFlags | 32768;
        remenu = "RLV 2...";
    }
    else if(llSubStringIndex(message, "Maps ") == 0)
    {
        if(llGetSubString(message, -3, -1) == "off")
            RLVFlags = ((RLVFlags | 16384) ^ 16384);
        else
            RLVFlags = RLVFlags | 16384;
        remenu = "RLV 2...";
    }
        else if(llSubStringIndex(message, "Nametags ") == 0)
    {
        if(llGetSubString(message, -3, -1) == "off")
            RLVFlags = ((RLVFlags | 24) ^ 24);
        else
            RLVFlags = RLVFlags | 24;
        remenu = "RLV 2...";
    }
    else if(message == "Enable Most RLV")
    {
        RLVFlags = ((RLVFlags | 4) ^ 4);        
        RLVFlags = ((RLVFlags | 32) ^ 32);        
        RLVFlags = ((RLVFlags | 64) ^ 64);
        RLVFlags = ((RLVFlags | 128) ^ 128);
        RLVFlags = ((RLVFlags | 256) ^ 256);
        RLVFlags = ((RLVFlags | 1024) ^ 1024);
        RLVFlags = ((RLVFlags | 2048) ^ 2048);
        RLVFlags = ((RLVFlags | 16384) ^ 16384);
        remenu = "RLV...";
    }
        else if(message == "Enable All RLV")
    {
        RLVFlags = ((RLVFlags | 4) ^ 4);        
        RLVFlags = ((RLVFlags | 32) ^ 32);        
        RLVFlags = ((RLVFlags | 64) ^ 64);
        RLVFlags = ((RLVFlags | 128) ^ 128);
        RLVFlags = ((RLVFlags | 256) ^ 256);
        RLVFlags = ((RLVFlags | 512) ^ 512);
        RLVFlags = ((RLVFlags | 1024) ^ 1024);
        RLVFlags = ((RLVFlags | 2048) ^ 2048);
        RLVFlags = ((RLVFlags | 4096) ^ 4096);
        RLVFlags = ((RLVFlags | 8192) ^ 8192);
        RLVFlags = ((RLVFlags | 16384) ^ 16384);
        remenu = "RLV...";
    }
    else if(message == "Unsit")
    {
        llOwnerSay("@unsit=force");
        remenu = "RLV...";
    }
    else if(message == "Disable All RLV")
    {
        RLVFlags = RLVFlags | 65533;
        remenu = "RLV...";
    }
    else if(message == "Main Menu")
    {
        llMessageLinked(LINK_THIS,0,"Main Menu","");
    }
    else if(message == "Clear")
    {
        RLVFlags = RLVFlags | 65533;

    }

  }              
default
{
    state_entry()
    {
    }
}

 

Link to comment
Share on other sites

I don't think that's it. With out that line, I get a "Dead code found beyond return statement" error, and STILL get the other error as well. I added that in as an attempt at a cheat to get around that.

Edit: The "Not all code paths return a value" error jumps to the end of the script, if that helps.

Edited by Surssin
Link to comment
Share on other sites

19 minutes ago, Surssin said:

Sheesh. How does anyone stay sane doing this? It's like pulling weeds. Got that fixed (I think), but now on the line listed below, it's giving me a "name not defined within scope" error.

 

    if(option == "RLV 1...")

"name not defined within scope" means that the variable referenced (in this case 'option') is not declared in the script. Going by the code posted then 'option' should be declared as a global variable of type string

there are a number of other variables referenced in the code, which are not declared either

about the pulling weeds.  We get past this eventually if we persevere. Even if the end doesn't seem to be on the horizon. Just have to keep on as best we can

  • Thanks 1
Link to comment
Share on other sites

21 minutes ago, Lucia Nightfire said:

That entire script could be significantly condensed too, albeit less "readable", heh.

For someone better than me, I have absolutely no doubt. But this is a system I understand and can adapt to fit my end goals (such as easily adding or removing options). So if I can get it to operate with the main menu, that'll do. I'm not good enough to condense it.

And I plan to eventually sell these scripts so people can build their own gags like I did. Getting someone to do all of that work for free or a price I can afford with that understanding is highly unlikely.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 946 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...