Viewing functions in the Console

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

Viewing functions in the Console

Postby Xray » Sat May 04, 2013 11:39 pm

I thought that I knew how to view the script in the console that makes up a function, but apparently I cannot get it to work. For example, I created a function in the console called: scene.my.RotateFCW which rotates a block of cubes in my Rubik's Cube scene. If I open the console and type scene.my.RotateFCW, then press the TAB key, the name of the function gets displayed but not the function's code. If I enter the name of the function and then press Enter, the function gets executed (which is not what I wanted). So, how can I view a function's code in the console without having to run the scene through a text editor?
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Viewing functions in the Console

Postby jon_joy_1999 » Sun May 05, 2013 12:04 am

using Algodoo v 2.1.0 I don't have this problem, are you sure you're typing just the function name, and not the entire function(vars)?
Image
BSrac = BoincStats recent average credit
I'd rather be network computing.
jon_joy_1999
 
Posts: 233
Joined: Fri Dec 09, 2011 12:51 am

Re: Viewing functions in the Console

Postby Xray » Sun May 05, 2013 12:11 am

Yes, I type only the function name (in this case: scene.my.RotateFCW). I recall that it used to work for me, but I haven't been able to make it work since downloading the latest version (v2.1.0).

Could you please download my Rubik's Cube scene from Algobox and then see if you can display the function scene.my.RotateFCW?

I don't know why it would work for you but not for me! :x
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Viewing functions in the Console

Postby jon_joy_1999 » Sun May 05, 2013 3:32 am

I have downloaded your scene and can replicate the issue. I've tried it in Algodoo 2.0.2 b15 (the oldest version I have available) and it still occurs.

I would like to preface this with: I know absofuzzinglutely nothing about the internal workings of Algodoo, especially when it comes to scripting

I think the problem is because braces are used for values that are supposed to be evaluated when they are used, so when you hit enter for your Rotate* functions it evaluates all of the writearrays and returns the last assignment
Image
BSrac = BoincStats recent average credit
I'd rather be network computing.
jon_joy_1999
 
Posts: 233
Joined: Fri Dec 09, 2011 12:51 am

Re: Viewing functions in the Console

Postby Xray » Sun May 05, 2013 3:45 am

jon_joy_1999 wrote:I have downloaded your scene and can replicate the issue. I've tried it in Algodoo 2.0.2 b15 (the oldest version I have available) and it still occurs.

I would like to preface this with: I know absofuzzinglutely nothing about the internal workings of Algodoo, especially when it comes to scripting

I think the problem is because braces are used for values that are supposed to be evaluated when they are used, so when you hit enter for your Rotate* functions it evaluates all of the writearrays and returns the last assignment


absofuzzinglutely? :lol: Nice word! :clap:

Anyhow, I believe that you hit the nail on the head. You are correct about my functions using "curly brackets" (or "braces"?) rather than the conventional parentheses. Functions are supposed to be written like this: F(x) = whatever But my functions are F={x}, and that's why the console doesn't display the script. THANK YOU for catching that! MY BAD!!! :oops:

Problem solved!
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Viewing functions in the Console

Postby jon_joy_1999 » Sun May 05, 2013 5:38 am

nice! glad to hear that solved the problem :D
Image
BSrac = BoincStats recent average credit
I'd rather be network computing.
jon_joy_1999
 
Posts: 233
Joined: Fri Dec 09, 2011 12:51 am


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 6 guests