Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  


Ian Ross has just released a book on Anim8or. It's perect for a beginner and a good reference for experienced users. It contains detailed chapters on every aspect, with many examples. Get your own copy here: "Anim8or Tutorial Book"

Author Topic: My Only ASL Script Complaint  (Read 8598 times)


  • Newbie
  • *
  • Posts: 2
    • View Profile
My Only ASL Script Complaint
« on: December 20, 2007, 02:07:14 pm »

Ok, maybe it's 2 complaints.

1)  I can't declare a static "local" variable that "remembers" it's value frame to frame.  This hasn't been a big deal, just makes for some interesting code when I use the "frame" number to key off frame specific events.

2) I can't declare a static "global" variable (again, that remembers it's value frame to frame).

Since "animated gifs" are not an option in the system, I've been using "frame#" to sequentially display textured tiles.  Since I sometimes want to display several different copies of these animations, I'm doing a lot of "hand editing" of the file.  Being able to have variables for the "first frame" and let each subsequent tile reference that would be great!


  • Administrator
  • Hero Member
  • *****
  • Posts: 2122
    • View Profile
Re: My Only ASL Script Complaint
« Reply #1 on: December 20, 2007, 03:57:41 pm »

Persistent variables are problematic in ASL.  They introduce a lot of new issues.  Are they part of the project?  The session?  When are they updated?  When are they initialized (if ever)?  If you render the same frame twice does it update the variable twice?  Same question for a script.  Anim8or needs to rerun certain scripts at unpredictable times (such as parameteric shape scripts and controller scripts).  If they have side effects then the shape or animation could change unpredictably.  Switching between different scenes, for example, might or might not rerun controller and parameteric shape scripts.

IMHO a better way to do this is using files.  Both reading and writing files are on the roadmap so you could deal with these issues as you wished.  Note that file input will not be allowed for some scripts (e.g. parameteric shape scripts) because these must create exactly the same shape each time that they are called with the same parameters.

As for keying off frame numbers,  there might be a better way to do what you want.  If you want to have a changeable time that something happens you can add a new controller to the world object in a scene.  (Edit->Controllers..Add).  Use an int named "InitialActionFrame", for example, and set it to the frame of interest.  Read it in all scripts that need it.  By changing this single value you can alter the timing of the scene without editing all of the scripts.


  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: My Only ASL Script Complaint
« Reply #2 on: April 26, 2010, 01:01:40 pm »

IMHO, global scene variables are a must to simplify animation. I think all that needs to be done is for the user to always make sure they are initialized before using them. Seems like one way to do this is to conditionally check for frame == 0 to set the global variables and only use them when frame > 0. I am suffering from the lack of being able to conditionally execute scripts based on what happened previously in the scene. I was trying to simulate a bouncing ball using scripts. When the ball is first dropped, the equation constants are different then when it bounces off the floor. The only way I know how to do this is to manually figure out at what frame (or time) the ball would hit the ground and conditionally key off that frame (or time) to execute the different equations. With global variables we could automatically determine the time or frame when the ball hits the ground and set the variable to be used in future conditional executions. Maybe there is an easier way to do this? Steve, wouldn't writing and reading a file significantly slow down frame setup? Maybe it's not so bad when all things are considered? Just wondering.