Browse Search Popular Register Upload Rules User list Login:
Search:
Infinite list (Class type variables!)

Image:
screenshot of the scene

Author: FRA32

Group: Default

Filesize: 27.72 kB

Date added: 2020-04-04

Rating: 5.6

Downloads: 674

Views: 389

Comments: 7

Ratings: 2

Times favored: 0

Made with: Algodoo v2.1.0

Tags:

Scene tag

After years of thyme experimentation, one my oldest questions has finally been answered:

How do you make and use Class type variables?

This scene showcases a brand new class type variable called scene.my.list which is capable of storing an infinite amount of data which can be individually changed. Use the green boxes to enter text and position ID and the blue buttons to add a text line to the end or overwrite an existing entry.

One remaining issue is that the class-type is volatile, meaning it won't survive if the scene is undone or reloaded. For this reason, this scene features an onSpawn script that rebuilds the class from scratch everytime the scene reloads.

The discovery of the class syntax unfortunally was not my own, but that of Kutis96, a User I met on our new Algodoo Discord [Link removed due to safety reasons. You can find it on the Forum under Livingroom/Ghost Town]. Thanks to him, I have learned of many powerfull thyme commands that allow countless possibilities. I will most likely upload at least two more scenes showcasing what I learnt.
Last edited at 2020/04/04 20:19:22 by FRA32
Please log in to rate this scene
edit
Similar scenes
Title: HelloArts Difficulty Chart Difficulties! sneak peak
Rating: 5
Filesize: 14.89 MB
Downloads: 1946
Comments: 1
Ratings: 1
Date added: 2024/09/21 15:44:35
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: 1.8.2 Slowdown
Rating: 5.375
Filesize: 16.36 kB
Downloads: 1374
Comments: 0
Ratings: 2
Date added: 2010/11/06 16:34:00
Made with: Algodoo before v1.8.5
Rating: rated 5.4
download
Title: Arkanoid type game
Rating: 5
Filesize: 47.48 kB
Downloads: 990
Comments: 0
Ratings: 1
Date added: 2009/07/04 06:08:38
Made with: Phun
Rating: rated 5
download
Title: Lit Box - Multiple Lights
Rating: 5.625
Filesize: 9.61 kB
Downloads: 474
Comments: 5
Ratings: 2
Date added: 2014/05/18 00:58:28
Made with: Algodoo v2.1.0
Rating: rated 5.6
download
Title: Amazing class reference for epics camps update 2
Rating: 5
Filesize: 0.77 MB
Downloads: 431
Comments: 6
Ratings: 1
Date added: 2015/07/21 18:49:28
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Levers
Rating: 5
Filesize: 57.46 kB
Downloads: 278
Comments: 0
Ratings: 1
Date added: 2016/09/29 02:20:22
Made with: Algodoo v2.1.0
Rating: rated 5
download
FRA32 -- Not sure if I would ever need something like this in my future scenes, but nonetheless, it is very clever. Nice work, and I am looking forward to more of your interesting scenes. :tup:


Oh, by the way, I recall user kilinich posted a scene or two in which he also found some useful class type variables in Thyme. If you haven't done so already, you could click on his username in order to list all of his scenes. Maybe you will find the one(s) I am referring to.
Last edited at 2020/04/04 21:11:34 by Xray
FRA32,

Thanks for posting this scene. I was thinking about class creation recently, read the "How to make a new class?" thread in the forum, and then gave up. I like how the scene works but I don't like the changes it makes to the config.cfg file. After seeing that the config file was violated, I revisited the forum and see that Kilinich stated "Unfortunately, Algodoo could not serialize and save it, so you should be aware, all internal objects will be stored (and run) in root scope.". In other words the methods and variables (like add, get, entry0, entry1...) become root methods and variables in every scene opened after opening this scene.
Last edited at 2020/04/05 14:30:45 by s_noonan
Hey, FRA, I'm trying to make a new sandbox game based on Scrap Mechanic (maybe you've heard of it) and I'm trying to find a way to make proximity sensors without the use of global variables. My original idea was to have a laser that turns green when it hits anything and turns red when it no longer hits anything, and then have said laser attach to a box, and the box copy the color of the laser, but despite knowing how to transfer data from a box to an attached laser, I have no idea how to do the reverse. Given what I've seen you pull off, do you know of any way to move a local variable from a laser to the box it's attached to?
Thanks.
in laser:
_x := "hello";
_makeVarInBox := {
g := entityByGeomID((readable(entity)).geom);
g._y := _x
};
onClick = (e)=>{_makeVarInBox};
Thank you s_noonan, I realized just before pulling up your reply that i could simply turn my assignment backwards, so that instead of putting:
color = entityByGeomID(readable(entity)).color;
I could simply swap the terms and put this code in the laser. But thanks for the reply!
UDG04 -- I posted a sample scene for you which was based on the description you gave above in your comments. When you no longer need it, just let me know and I will delete it.

Any questions about it?

Sample Scene for UDG04
Last edited at 2021/05/08 23:52:03 by Xray