Browse Search Popular Register Upload Rules User list Login:
Search:
Array Functions

Image:
screenshot of the scene

Author: s_noonan

Group: Technical

Filesize: 115.11 kB

Date added: 2020-03-27

Rating: 6.3

Downloads: 381

Views: 353

Comments: 18

Ratings: 4

Times favored: 1

Made with: Algodoo v2.1.0

Tags:
tool

Scene tag

Array Functions Tool

7135 CLOC

Rev A: Updated textbox functionality.
Last edited at 2025/04/18 11:47:03 by s_noonan
Please log in to rate this scene
edit
Similar scenes
Title: String Functions
Rating: 5.6667
Filesize: 94.01 kB
Downloads: 297
Comments: 11
Ratings: 3
Date added: 2020/03/31 05:38:17
Made with: Algodoo v2.1.0
Rating: rated 5.7
download
Title: Country marble race 1
Rating: 5
Filesize: 1.19 MB
Downloads: 3590
Comments: 1
Ratings: 1
Date added: 2020/06/27 01:01:49
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Animatic Battle Physics Simulator
Rating: 5
Filesize: 5.83 MB
Downloads: 3383
Comments: 2
Ratings: 1
Date added: 2024/08/26 02:10:54
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Direct write access array demo
Rating: 6.1111
Filesize: 35.65 kB
Downloads: 3960
Comments: 5
Ratings: 3
Date added: 2016/03/25 11:01:04
Made with: Algodoo v2.1.0
Rating: rated 6.1
download
Title: Multiple Choice Nation & Its Capitals
Rating: 6.1111
Filesize: 508.13 kB
Downloads: 3712
Comments: 3
Ratings: 3
Date added: 2023/01/09 01:39:59
Made with: Algodoo v2.1.0
Rating: rated 6.1
download
Title: useful new thruster tool [Algodoo 1.9.5]
Rating: 5
Filesize: 313.47 kB
Downloads: 711
Comments: 4
Ratings: 1
Date added: 2011/06/06 16:13:53
Made with: Algodoo before v1.8.5
Rating: rated 5
download
Some time ago, I made a plugin system that utilizes writeToFile to write stuff to your algodoo installation, so you could add functionality. one of the uses for it was adding native thyme packs (like a native modulo, and some array tools) so you could use them directly on your scenes - the obvious downside is you need everyone to have that code on their Algodoo installation or it wouldn't work.
Now I'm thinking it'd be possible to make a phunlettable menu that reads plugin files and injects the code on the scene at will - all this would make for a good mechanism where you drop a menu box and you can have premade UIs for, say, gears or chain and sproket generators.

eventually i abandoned the idea because of the obvious need for absolutely everyone to have it installed or the scene wouldn't work at all, but i'd love to have something like this in a way that stays on your algodoo and has a good version checking with an easy way of opening a scene where you'd upload updates (for more functionality or fixing bugs)
Those are some interesting thoughts. You could add the Algodoo "scene.importPhunlet" function to a runOnce function in your default scene. The imported phunlets could be standard phunlets or functions that can be used in any of your scenes. The "scene.importPhunlet" function may fail when another user runs your scene, but by then the originally imported functions, variables, an objects will have been saved with your scene.

I did an experiment where I deleted all the objects from this "Array Functions" scene, saved the scene, and then moved the scene into the phunlets folder. I then created another scene that automatically imported the phunlet. All the associated scene.my functions came in with the phunlet.
Now I can modify my array functions! :lol:
I wish there was a way to permanently hook your Algo Sound files with Algodoo so that users no longer would need to activate it each time they launch Algodoo. If the sound feature was somehow made intrinsic, then I believe that people would use it. I definitely would.
xRay,

I agree. Here's an idea that might work (but is probably more trouble than it's worth):
1. Create a startAlgoSound utility that starts AlgoSound minimized if it isn't already running.
2. Create a batch file that runs Algodoo and startAlgoSound.
3. Associate .phz files with the batch file.

The startAlgoSound utility could read the .phz file and start AlgoSound only if "scene.my.playSound" is found in the zipped scene.phn file.

I might experiment with this, but don't expect anything soon.

Another approach would be to put runVbAlgoSound.bat (or pyAlgoSound_05.py)in the startup folder, but I would consider that overkill since the program would always be running.
Those are great ideas, but the average user (and I am referring to children) here on Algobox will not be able to do those things. I was thinking more along the lines of a special file (probably an .exe file) that anyone can download which would somehow attach itself to Algodoo on anyone's computer who would like to have the ALgoSound feature.

Ideally, it would be great if Algoryx were to release the Algodoo source files into Public Domain so that anyone can modify it and recompile it, but I doubt that that would ever happen. I am just throwing out some ideas here, but I know that they are wishful thinking.
If you feel like it, you can try this:

1. Modify runVbAlgoSound.bat to look something like this:

@echo off
cd "C:\Program Files (x86)\Algodoo"
start Algodoo.exe
cd "C:\Users\Xray\Documents\Algodoo\AlgoSound"
cscript //d %~dp0\vbAlgoSound_05.vbs
exit

2. Put a shortcut to runVbAlgoSound.bat on the desktop.
3. Open the shortcut properties, select Change Icon..., Browse, and then click on Algodoo.exe. The Algodoo icon will then become available for selection.
4. Rename the shortcut to AlgoSound.
5. Double-click the shortcut. AlgoSound and Algodoo will open simultaneously.
I'll play around with that. Thanks!

By the way, in the scene, your "Notes #1" misspelled Phunlet.
Last edited at 2020/04/10 03:35:38 by Xray
Thanks.
In the example which shows a letter array [h,e,l,l,o], I believe each letter needs opening and closing quotation marks. Otherwise, Thyme will interpret those letters as variables instead of text.

More: Same for the word "hello" in the Results example shown.
Last edited at 2021/10/09 20:39:09 by Xray
Thanks Xray. Now it's a feature (See note #5).
Can you create a version of elemExists that can look for arrays inside the array? e.g. Look for [1, 2] in [[2, 1], [1, 2], [5, 6]]
The GUI doesn't work for that example, but the underlying function does work.
Run scene.my.ra_elemExists([[2, 1], [1, 2], [5, 6]] , [1, 2]) in the console.

For reference:
scene.my.ra_elemExists := (ra, value)=>{
  elemExists := false;
  n := string.length(ra);
  scene.my.xFor(0, n - 1, (i)=>{
    ra(i) == value ? {
      elemExists = true
    } : {}
  });
  elemExists
};
Is there any alternative way to set list values like this?

Example:

Set an index of 2 to 4.
Before: [1, 2, 3]
After: [1, 4, 3]
scene.my.xFor := (n1, n2, code)=>{
  n2 > n1 ? {
    m := (n1 + n2) / 2;
    scene.my.xFor(n1, m, code);
    scene.my.xFor(m + 1, n2, code)
  } : {code(n1)}
};
scene.my.ra_setItem := (ra, item, value)=>{
  n := string.length(ra);
  r := [];
  scene.my.xFor(0, n - 1, (i)=>{
    i == item ? {
      r = r ++ [value]
    } : {
      r = r ++ [ra(i)]
    }
  });
  r
};
Do you know how to convert the string to array?

Example:

"[3, 1]" --> [2, 3]

"[4, [1, 5]]" --> [4, [1, 5]]
Last edited at 2024/04/20 18:15:12 by BlueMoon2607
eval("[4, [1, 5]]")
@s_noonan - Thanks! I'll use them in the future!:tup: