Viewing functions in the Console
6 posts • Page 1 of 1
Viewing functions in the Console
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?
-

Xray - Posts: 501
- Joined: Sun Jun 17, 2012 6:12 am
- Location: USA
Re: Viewing functions in the Console
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)?
- jon_joy_1999
- Posts: 233
- Joined: Fri Dec 09, 2011 12:51 am
Re: Viewing functions in the Console
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!
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!
-

Xray - Posts: 501
- Joined: Sun Jun 17, 2012 6:12 am
- Location: USA
Re: Viewing functions in the Console
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
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
- jon_joy_1999
- Posts: 233
- Joined: Fri Dec 09, 2011 12:51 am
Re: Viewing functions in the Console
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?
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!!!
Problem solved!
-

Xray - Posts: 501
- Joined: Sun Jun 17, 2012 6:12 am
- Location: USA
Re: Viewing functions in the Console
nice! glad to hear that solved the problem 
- jon_joy_1999
- Posts: 233
- Joined: Fri Dec 09, 2011 12:51 am
6 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 6 guests




