Thyme 2.0
9 posts • Page 1 of 1
Thyme 2.0
Did you notice new string.length function? Now we know size of lists. With readable it's possible to get surfaces values of existing polygon and do some magic with it.
btw, just another (simpler) extended for-cycle:
n1 and n2 must be integer, n2 >= n1
usage example, ten thousands cycles:
scene.my.xFor(0,10000, (n) => {print(n)})
btw, just another (simpler) extended for-cycle:
n1 and n2 must be integer, n2 >= n1
- Code: Select all
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)}
}
usage example, ten thousands cycles:
scene.my.xFor(0,10000, (n) => {print(n)})
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Thyme 2.0
Yeaaaa!
It was impossible, but now it's just a simple trick
It was impossible, but now it's just a simple trick
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Thyme 2.0
Kilinich's scene is epoch making for Thyme scripting.
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).
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
-
tatt61880 - [Most Helpful Person 2010]
- Posts: 1150
- Joined: Mon Aug 31, 2009 5:45 pm
- Location: Tokyo, Japan
Re: Thyme 2.0
the melting ice is amazing! btw how do you find out about new thyme commands?
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: Thyme 2.0
KarateBrot wrote:the melting ice is amazing! btw how do you find out about new thyme commands?
Just press tab in console, and search for something new.
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Thyme 2.0
yeah i know but for example if you have commands that are not in the console like the (put some id commands here).pos and stuff
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: Thyme 2.0
oh, sometimes I just make a wild guess =)
Did you try layers btw? It's cool! - scene.addLayer / scene.selectLayer / layer in geom.
Did you try layers btw? It's cool! - scene.addLayer / scene.selectLayer / layer in geom.
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Thyme 2.0
haha nice
no how does it work?^^
no how does it work?^^
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: Thyme 2.0
I've improved xFor function.
* FIXED: Negative value issue.
> xFor(-2, 0, (n)=>{n}) ... "Stack overflow!"
> xFor_improved(-2, 0, (n)=>{n}) ... -2, -1, 0
* FIXED: Larger to lower issue.
> xFor( 2, 0, (n)=>{n}) ... 2
> xFor_improved( 2, 0, (n)=>{n}) ... 2, 1, 0
NOTE: Kilinich's xFor (below) is good enough when 0 <= n1 <= n2
* FIXED: Negative value issue.
> xFor(-2, 0, (n)=>{n}) ... "Stack overflow!"
> xFor_improved(-2, 0, (n)=>{n}) ... -2, -1, 0
* FIXED: Larger to lower issue.
> xFor( 2, 0, (n)=>{n}) ... 2
> xFor_improved( 2, 0, (n)=>{n}) ... 2, 1, 0
- Code: Select all
Scene.my.xFor_improved := (n1, n2, code)=>{
(n2 % 1 != 0 || n1 % 1 != 0) ? {
print ("ERROR - Usage: Scene.my.xFor_improved(int, int, func)")
} : {
(n1 == n2) ? {
code(n1)
} : {
m := ((n1 + n2) % 2 == 0) ?
{(n1 + n2) / 2} :
{(n1 + n2 - 1) / 2}; /* (n1, n2) = (-2, -1) => m = -2 */
(n2 > n1) ? {
Scene.my.xFor_improved( n1, m, code);
Scene.my.xFor_improved(m+1, n2, code)
} : {
Scene.my.xFor_improved( n1, m+1, code);
Scene.my.xFor_improved( m, n2, code)
}
}
}
};
NOTE: Kilinich's xFor (below) is good enough when 0 <= n1 <= n2
- Code: Select all
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)}
}
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).
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
-
tatt61880 - [Most Helpful Person 2010]
- Posts: 1150
- Joined: Mon Aug 31, 2009 5:45 pm
- Location: Tokyo, Japan
9 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 11 guests