Help Grabable is griefing me


#1

I have a grabable problem on my domain
Prettymuch everything is grabable

Can one of you code wizzards help me out, i tried doing a find replace on the domain gz turning all the trues to false and got nowhere.

I want a script i can run that will go through everything in my domain and uncheck grabable for everything


#2

try this that I wrote on my lunch break.I havent tested it, so remember to backup your stuff, they may explode. No Guarantees as I have not yet tested it in world

var entities = Entities.findEntities(Vec3.ZERO, 1000000);
console.log(entities.length)
for (var entityIndex in entities) {
    var entity = Entities.getEntityProperties(entities[entityIndex]);
    
    Entities.editEntity(entity.id, {"locked":false});
    if (entity.userData) {
        var userData = JSON.parse(entity.userData);

        if(userData.grabbableKey && userData.grabbableKey.grabbable){
            console.log("Found a Grabbable Object", entity.locked);
        }
        
        userData["grabbableKey"] = { "grabbable": false };
        Entities.editEntity(entity.id, { "userData": JSON.stringify(userData) });
    } else {
        
        Entities.editEntity(entity.id, { "userData": JSON.stringify({ "grabbableKey": { "grabbable": false } }) });
    }
    
    Entities.editEntity(entity.id, {"locked":entity.locked});
} 


#3

hahahahahahahaha, I wrote it on my lunch break.
Would have to take a few days off…actually, I can read that script…getting scared.


#4

Be carefull lots of your stuff will explode as Menithal warns, I mentioned this before, the fact that the grabbable is in the userdata, means that any hard change to the grabbable will wipe all your user data, so anything that has doors closing or clocks ticking or lighting or music data or audio urls and such, or whatever, I have loads of stuff that depends on userdata, it will all just break with this kind of global override.
There needs to be a more complex script that takes your existing usedata and preserves it and just changes the grabbable to false and then replaces any other userdata component that was there other than grabbable.
I havent had time to write this complex script yet.


#5

Im trying it on a sandboxed version, its not quite happening as yet

when does anything menithal makes not explode , its why we keep him around :smiley:

i dont have anything thats animated or scripted um sound emitters and particles is about all

but as i said im testing it on a back up copy

loving the new sandbox domain back up features btw


#6

Which Is why I wrote it only to effect the grabbable part…

theoretically.

Also forgot about the locked entities, added those to the script, just run it straight from the console…

at your own risk


#7

This has caused no end to issues for me… oops grabbed the ground … aahhh… good luck trying to align it again , enter 0 , 0 , 0 in rotation and place it again with those dumb handles (now fixed yaya!)

I think i saw a checkbox to turn off grabbable on rez in interface, I cant see a use case on desktop where this would be a good thing.


#8

@Menithal Ok I didnt use your code, i see what you are saying now. In the past I have simply checked the grabbable checkbox and it wipes all my UserData.

@whyroc the problem is that checkbox setting reverts itself at every relog, so you have to remember to check it at every login.


#9

My only informed critisizm of the script was the clashing blue and red colours used in the sample


#10

runs it with menithals word as a sly old fox as guarantee

[UncaughtException evaluate] Error: Unable to parse JSON string in about:console:4 [Backtrace] () at about:console:4

SyntaxError: Unable to parse JSON string

hmm

goes to http://hackertyper.com/ to feel more involved


#11

Fixed it, ive been spending too much time in python


#12

Fixed and working great
Thanks @Menithal