This code knows your name. Can I use it?
Posted: Wed Jan 09, 2019 5:26 am
So I was messing around and wrote up this script:
What it does is it takes the file directory of the scene and extracts the name of the user. It only works if the directory is not in the Algodoo directory (or if the directory is not listed as such and shows "/Users..." instead of "Algodoo..."). It works on Windows for certain, and it should work on Mac. Now, the name, of course, stays within the scene. It can't be accessed by anyone other than the user viewing the scene. I wasn't sure if this was allowed, so I'm asking here before using it in anything.
- Code: Select all
Scene.fileDir != string.list2str(scene.my.thing) ? {
scene.my.name = "";
scene.my.num = 0;
scene.my.thing = string.str2list(Scene.fileDir);
scene.my.done = 0
} : {};
scene.my.done == 0 ? {
scene.my.thing(0) == "/" ? {
scene.my.thing(7 + scene.my.num) != "/" ? {
scene.my.name = scene.my.name + scene.my.thing(9 + scene.my.num);
scene.my.num = scene.my.num + 1
} : {
scene.my.done = 1
}
} : {
scene.my.thing(9 + scene.my.num) != "/" ? {
scene.my.name = scene.my.name + scene.my.thing(9 + scene.my.num);
scene.my.num = scene.my.num + 1
} : {
scene.my.done = 1
}
}
} : {}
What it does is it takes the file directory of the scene and extracts the name of the user. It only works if the directory is not in the Algodoo directory (or if the directory is not listed as such and shows "/Users..." instead of "Algodoo..."). It works on Windows for certain, and it should work on Mac. Now, the name, of course, stays within the scene. It can't be accessed by anyone other than the user viewing the scene. I wasn't sure if this was allowed, so I'm asking here before using it in anything.