Page 1 of 1

Diference ?

PostPosted: Sat May 26, 2018 4:16 pm
by Skrubs
Diference between [ ] ,{ } and ( ) ?

Re: Diference ?

PostPosted: Tue May 29, 2018 11:30 pm
by Xray
[ ] are used to enclose elements of an array.
example: = [[x],[y],[z]]

{ } are used to enclose executable code which tell Thyme to execute the code when necessary.
example: var1 >= 3.14 ? {x=x+1}:{x=x-1}

( ) are used to enclose one or more arguments of a function, and are also used to enclose an index for reading the value of an array element (sadly, array elements cannot be directly written to in Thyme, only read).
_Func3(3.14); =;
This is not allowed: =, although there are some work-arounds for writing to array elements.

Re: Diference ?

PostPosted: Mon Sep 17, 2018 3:01 am
by Skrubs
Arguments ?
can you tell a list of a arguments ? if not show me the ones you know

Re: Diference ?

PostPosted: Mon Sep 24, 2018 12:55 pm
by FRA32
[] Describes arrays, or "multi variables" in other words.
pos = [0,0]

{} contains literal code that is executed when algodoo is told to do so.
Angle = {5}; <-Executes "5" everytime angle is needed, which just returns said number.
(e)=>{...}; <- executes the stuff in the {} whenever the event function is triggered by Algodoo.

() resembles mathematical paranthesis, i.e. (x+3)*5 = x*5+15, index arrays and parameters.
pos(0) would give you the X-Value of the position.
colorHSVA(3) would give you the A-Value of the color.
(e)=>{} allows algodoo to give you the "e-information" that the event generated.
math.vec.len(vel) passes the vel as a paremeter to the len function in algodoo.

Re: Diference ?

PostPosted: Sun Oct 21, 2018 8:40 am
by Xray
@FRA32 -- I already explained all that to him. Didn't you read my message before repeating everything that I said? :?

Re: Diference ?

PostPosted: Sun Oct 21, 2018 9:52 am
by FRA32
I did in fact read it, but wanted to present the answer in the way I understand it, along with more elaborate examples. I very much recognize your answer as informative aswell, but considering that Skrubs very likely never used a coding language before, many examples, along with explanations, can be very usefull. :thumbup:

Re: Diference ?

PostPosted: Sat Nov 03, 2018 7:37 am
by Xray
No problem! You are correct that sometimes another person might have a different way to describe a technical subject which may help the student to understand it better.

Thanks for your input! :thumbup: