# New To Shake Scripting

**URL:** https://forum.highend3d.com/t/new-to-shake-scripting/9497
**Category:** Compositing
**Tags:** shake
**Created:** [December 27, 2006, 10:27pm UTC](https://forum.highend3d.com/t/new-to-shake-scripting/9497 "2006-12-27T22:27:46Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![user\_deleted](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/u/35a633/32.png) [@user\_deleted](https://forum.highend3d.com/u/user_deleted)
#### Post date: [December 27, 2006, 10:27pm UTC](https://forum.highend3d.com/t/new-to-shake-scripting/9497/1 "2006-12-27T22:27:46Z")

</div>

Hi. I've been working with shake for some time, but never got to write scripts in it. I need a very basic script that turns the opacity of a muzzle flash on and off based on what frame I'm on. I was thinking about using the modulus function, but didn't find any references to it in shake manual.  
basically, my line of script looked like this:

if (time%3){  
maskPercent = 100}  
else if[maskPercent = 0  
};

I think there might be a number of problems with it ![](http://www.highend3d.com/boards/style_emoticons/<#EMO_DIR#>/smile.gif)

First of all, is modulus implemented in Shake and if so, what's the syntaxis for it?

Secondly, the command structure goes like if - else if. Does it mean that on the second part (else if) I need to specify the opposite of the statement I used in the first part? Or should I simply leave it the way it is now?

Thank you very much,  
Luka

---

<div class="post-metadata">

### Author: ![user\_deleted](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/u/35a633/32.png) [@user\_deleted](https://forum.highend3d.com/u/user_deleted)
#### Post date: [December 30, 2006, 8:05am UTC](https://forum.highend3d.com/t/new-to-shake-scripting/9497/2 "2006-12-30T08:05:32Z")

</div>

there's a fair bit of how to deal with expressions in th shake manual, in fact i think it's a whole chapter (dont have it with me but i'm quite sure the % function is described too)

so you might want to read up on that, but basically you could take a fade node for your mask and try something like:

(time%3 == 0) ? 1 : 0

read: if time is a multiple of 3 then set opacity to 1 (100%) else to 0
