Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding LinksetData to oc_core for dynamic menus #943

Closed

Conversation

Yosty7B3
Copy link
Collaborator

@Yosty7B3 Yosty7B3 commented Apr 2, 2023

  • All the settings are now read directly from the LinksetData instead of relying on link messages.
  • Buttons can now be added and removed by directly editing the LinksetData OR through the old method of link_messages.
  • The LinksetData keys used for the menu's are 'Menu_' followed by the name of the menu. So for Main that is "Menu_Main", and for Apps that is "Menu_Apps".
  • The values are comma separated strings of the buttons.
  • Weld has been removed mostly from oc_core in preparation of a separate oc_weld script.

* All the settings are now pulled directly from the LinksetData instead of relying on link messages.
* Buttons can now be added and removed by directly editing the LinksetData OR through the old method of link_messages.
* The LinksetData keys used for the menu's are 'Menu_' followed by the name of the menu. So for Main that is "Menu_Main", and for Apps that is "Menu_Apps".
* The values are comma separated strings of the buttons.
* Weld has been removed mostly from oc_core in preparation of a separate oc_weld script.
Yosty7B3 added a commit to Yosty7B3/OpenCollar that referenced this pull request Apr 3, 2023
Replaces the functionality that Weld had before but in it's on script now.

Using LinksetData instead of prim description for settings, which also allows the Weld button from being dynamically added and removed.
Added global_hideweld flag to hides the Weld button (1=hide).

Most weld dependencies in oc_settings should now be redundant and could be removed.
Already removed (commented out) weld from oc_core in OpenCollarTeam#943
Yosty7B3 added a commit to Yosty7B3/OpenCollar that referenced this pull request Apr 3, 2023
Replaces the functionality of Weld but in it's on script now (was spread between oc_core and oc_settings).

Using LinksetData instead of prim description for settings, which also allows the Weld button from being dynamically added and removed. 
Added global_hideweld flag to hides the Weld button (1=hide).

Most weld dependencies in oc_settings should now be redundant and could be removed. 
Already removed (commented out) weld from oc_core in OpenCollarTeam#943
@Yosty7B3 Yosty7B3 mentioned this pull request Apr 3, 2023
@Medea-Destiny Medea-Destiny added Do Not Merge (yet) One reason or another for not merging OC9.x Target v9 with LSD revisions labels Apr 8, 2023
@Medea-Destiny
Copy link
Collaborator

Nice work here. Ties in with #944 and implements LSD functions. Likely to need some changes when we finalize the settings standards with LSD.

@tayaphidoux
Copy link
Contributor

your linkset_data() section has more work than is needed there is no reason for the script to have to store this information just call it where its needed, the only part of linkset_data() that is needed is the lock section detach call

@Yosty7B3
Copy link
Collaborator Author

your linkset_data() section has more work than is needed there is no reason for the script to have to store this information just call it where its needed, the only part of linkset_data() that is needed is the lock section detach call

We could remove those but then we have to make sure the linksetdata is set to the right values for all of them.
Right now their default values are not empty/zero, so if you try to read their linksetdata while it's not set then we'll end up with the wrong default value.

@tayaphidoux
Copy link
Contributor

you are right on that i went over the script last night doing just that i am trying to convert the full core set to use LSD the ones that have a default value need to be set by the first script to boot or by the script that would naturally set them, so i came up with the following.

FirstRun()
{
    if(llLinksetDataRead("auth_wearer") == "")
    {
        llLinksetDataWrite("auth_wearer",llGetOwner());
    }
    else if(llLinksetDataRead("auth_wearer") != llGetOwner())
    {
        llLinksetDataReset();
    }
    if(!(integer)llLinksetDataRead("global_firstrun"))
    {
        llLinksetDataWrite("global_safeword","RED");
        llLinksetDataWrite("global_prefix",llToLower(llGetSubString(llKey2Name((key)llLinksetDataRead("auth_wearer")),0,1)));
        llLinksetDataWrite("global_channel","1");
        llLinksetDataWrite("global_weareraddon",(string)TRUE);
        llLinksetDataWrite("global_addonlimit",(string)TRUE);
        llLinksetDataWrite("auth_limitrange",(string)TRUE);
    }
    else
    {
        if(llLinksetDataRead("global_safeword") == "")
        {
            llLinksetDataWrite("global_safeword","RED");
        }
        if(llLinksetDataRead("global_prefix") == "")
        {
            llLinksetDataWrite("global_prefix",llToLower(llGetSubString(llKey2Name((key)llLinksetDataRead("auth_wearer")),0,1)));
        }
        if(llLinksetDataRead("global_channel") == "")
        {
            llLinksetDataWrite("global_channel","1");
        }
        if(llLinksetDataRead("global_weareraddon") == "")
        {
            llLinksetDataWrite("global_weareraddon",(string)TRUE);
        }
        if(llLinksetDataRead("global_addonlimit") == "")
        {
            llLinksetDataWrite("global_addonlimit",(string)TRUE);
        }
        if(llLinksetDataRead("auth_limitrange") == "")
        {
            llLinksetDataWrite("auth_limitrange",(string)TRUE);
        }
    }
    if(llLinksetDataRead("global_verbosity") == "")
    {
        llLinksetDataWrite("global_verbosity","1");
    }
}

@tayaphidoux
Copy link
Contributor

and yes in that i added 2 new values we only need one script to get and check the wearer key this reduces the redundency and if the key is wrong i have it clear linkset which should force a reset of every script if you have it set up. LINKSETDATA_RESET action.

@tayaphidoux
Copy link
Contributor

i forgot to add llLinksetDataWrite("global_firstrun",(string)true); under the first run check

@Medea-Destiny
Copy link
Collaborator

@tayaphidoux I think we should be looking to remove on attach restarts altogether, so we could be doing first run settings in state_entry

@Medea-Destiny
Copy link
Collaborator

Slightly OT but as it comes up in @tayaphidoux 's comments -- I strongly suggest we no longer use lists for trusted/owner/blacklist auth values. If we save users in the form token: auth_(uuid) value: iAuth we have a faster and more efficient auth process.

@Yosty7B3
Copy link
Collaborator Author

Yosty7B3 commented May 14, 2023

instead of adding a firstrun token, we could also just revert back to the default value when a specific token doesn't exist.

    if(!~llListFindList(llLinksetDataListKeys(0,0),[sToken])){ // token/key doesn't exist in the list of keys
        llLinksetDataWrite(sToken, sDefaultVal);
    }

@tayaphidoux
Copy link
Contributor

tayaphidoux commented May 14, 2023

@Yosty7B3 that looks better than what i wrote and is more flexible.

@Medea-Destiny the reset i mentioned is not on worn its on key change and its on LSD Reset, in order to prepare the collar for a new user when its passed from one person to the next, not reset every script on wear, not that it matters if you put the important stuff in LSD, it means to reset the scripts all you need to do is erase all of LSD, a separate reset can be implemented for non destructive resets or soft_resets, destructive resets could be used to fix collars that are permalocked by malicious users using a separate script or in collar emergency button such as run away.

@Medea-Destiny
Copy link
Collaborator

@tayaphidoux If we're clearing LSD then we're effectively doing a "factory reset" and there's no reason not to reset all scripts.

@tayaphidoux
Copy link
Contributor

@Medea-Destiny so you would rather some one hand you a collar pre configured the way they want to controll you?

and yes its a factory reset hence why the code below should exist in all linkset blocks, so that the scripts know to repopulate pre defined peramiters, this means the only time you need to reset the scripts are A) when some one clears memory, b) when you pass the collar from one person to the next to prevent passing maillisious/broken configurations.

linkset_data(integer iAction, string sName, string sValue)
{
        if(iAction == LINKSETDATA_RESET)
        {
                llResetScript();
        }
}

@Medea-Destiny
Copy link
Collaborator

@tayaphidoux "@Medea-Destiny so you would rather some one hand you a collar pre configured the way they want to controll you?"

What? Were you thinking we wouldn't clear LSD on a changed owner? I have no idea what you're talking about here.

@tayaphidoux
Copy link
Contributor

tayaphidoux commented May 18, 2023

@Medea-Destiny i am talking about doing just that, and encase a third party script wipes the data.
you need password to delete secure data but you do not need one to clear the whole LSD storage with a reset command.

@Medea-Destiny
Copy link
Collaborator

A third party script could wipe all settings today just as easily.

@SilkieSabra SilkieSabra deleted the branch OpenCollarTeam:8.3_Features-branch October 5, 2024 16:03
@SilkieSabra SilkieSabra closed this Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Do Not Merge (yet) One reason or another for not merging OC9.x Target v9 with LSD revisions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants