General language questions. Important.

About advanced scenes, and the Thyme scripting language used in Algodoo.

General language questions. Important.

Postby AlexHunt » Thu Sep 17, 2009 10:16 pm

I read this (tutorials) and this (sort of documentation), and I still got some important questions.

1. How to declare scopes/objects/structures or whatever they called in your language?
I want to use my hierarchy of objects, like "Car.Engine.Cylinder" or add some methods to "Math.*".

2. How to create my own script files within my scene (archive/folder)
Code: Select all
Reflection.ExecuteFile "additional_math.thyme";
Reflection.ExecuteFile "arm.thyme";

Only works when these files are in the root of Algodoo. And I want to set relative paths, so I can then send the
scene to my friends and post it online.

ANSWERED
Using hit-and-miss technique found out that ralative path to your scene are like these:
Code: Select all
Reflection.ExecuteFile("Algodoo/scenes/space/additional_math.thyme");
Reflection.ExecuteFile("Algodoo/scenes/space/arm.thyme");

Now we can all create program modules separate from scene file and not lose formatting and comments upon scene save, but still it's half-hardcoded - scene still needs to be in Algodoo/scenes/.
Doesn't work for archives. Sad.

3. When are you going to write normal, full, complete, structured thyme documentation with context working (not abstract) EXAMPLES of code?

4. I know it's a long shot, but... is there anything like event-driven programming in thyme?
'Cause, seriosly... guys! It's impossible to program a super-duper-Earth-destroying space robot without events, actions, action listeners and other usefull stuff.

5. WE (everyone who uses thyme) need a normal, usable timers (job) system.
Code: Select all
Sim.frequency(<code>; 100);

This is not good at all.
We need somthing like
Code: Select all
Sim.addJob(<code>, <execution time>, <interval (zero - for once)>, <number of times>);
Sim.addJob(<code>, <execution time>, <interval (zero - for once)>, <end time>);

and other different variations on those.

Image
AlexHunt
 
Posts: 1
Joined: Thu Sep 17, 2009 9:34 pm

Re: General language questions. Important.

Postby cdh473 » Sun Sep 20, 2009 9:12 pm

1.)I've recently been wondering that too, maybe Grady will answer it.
2.)I would imagine it's the same as specifying the directory in any other language.
3.)No comment.
4.)The simulation is where your events are. I'm sure you can think of something for whatever you're doing.
5.)Put that in the suggestions forum. For now, just use what you've got(if life gives you lemons, make lemonade. don't try to make orange juice until you get some oranges. Ask for some oranges though.)
Please excuse my posts. I am extremely stupid.
User avatar
cdh473
 
Posts: 816
Joined: Tue Sep 01, 2009 12:37 am
Location: Yes

Re: General language questions. Important.

Postby gradyfitz » Mon Sep 21, 2009 2:37 am

AlexHunt wrote:I read this (tutorials) and this (sort of documentation), and I still got some important questions.

1. How to declare scopes/objects/structures or whatever they called in your language?
I want to use my hierarchy of objects, like "Car.Engine.Cylinder" or add some methods to "Math.*".


1. Create an object pointer (for example, Scene.my.Car).
2. Bring down the console (using F11 or tilde ("~")).
2. Type the identifier of the object pointer (Scene.my.Car).
3. Type a dot (".").
4. Type the new identifier (for example, Engine).
5. Type an assignment operator ("=" or ":=").
6. Type a value.
7. Check you haven't made any mistakes, it should look something like Scene.my.Car.Engine = 6.
8. Press Enter

(NOTE: There aren't yet published serialised scopes/structures in Thyme, though this should work in your current session and shouldn't leave anything behind).

AlexHunt wrote:3. When are you going to write normal, full, complete, structured thyme documentation with context working (not abstract) EXAMPLES of code?


My thyme tutorial has examples when creating the code and apart from the code (both context and abstract examples).

AlexHunt wrote:4. I know it's a long shot, but... is there anything like event-driven programming in thyme?
'Cause, seriosly... guys! It's impossible to program a super-duper-Earth-destroying space robot without events, actions, action listeners and other usefull stuff.

Yes, onCollide and onLaserHit/onHitByLaser.

AlexHunt wrote:5. WE (everyone who uses thyme) need a normal, usable timers (job) system.
Code: Select all
Sim.frequency(<code>; 100);

This is not good at all.
We need somthing like
Code: Select all
Sim.addJob(<code>, <execution time>, <interval (zero - for once)>, <number of times>);
Sim.addJob(<code>, <execution time>, <interval (zero - for once)>, <end time>);

and other different variations on those.

You can make them yourself :D. I've already made structures of this nature, it's not hard at all :) (there are so many ways to do this).

Hopefully I've answered your questions, if you still have more, feel free to ask them.
Mechanisms: 18 Mechanisms.
Thyme: Tutorial - Variables/Commands List.
Thymechanic
gradyfitz
 
Posts: 174
Joined: Tue Sep 01, 2009 8:33 am
Location: Victoria, Australia

Re: General language questions. Important.

Postby tatt61880 » Mon Sep 21, 2009 5:12 am

AlexHunt wrote:1. How to declare scopes/objects/structures or whatever they called in your language?
I want to use my hierarchy of objects, like "Car.Engine.Cylinder" or add some methods to "Math.*".


One important advice.
Car.Engine.Cylinder or Math.* are not good variables for your scenes if you will post the scenes into Algodoo because only Scene.my.* will be saved into your scene when you saved scenes.
i.e. even if you could declare "Car.Engine.Cylinder", this variable will not be saved into your scene file but into config.cfg.

Actually, link0007 has posted some math functions into Some extra math functions however those variables are not Math.* but are Scene.my.*. They works well. : )
NOTE: I'm not an Algoryx member.
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
User avatar
tatt61880
[Most Helpful Person 2010]
 
Posts: 1150
Joined: Mon Aug 31, 2009 5:45 pm
Location: Tokyo, Japan


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 1 guest