MonkeyScript

is a Gameplay Mechanic. This feature is used to modify something in a condition. For example, it can be used to modify towers to cease fire when a gold bloon appears. (It may crash though)

It costs 5000 MM to unlock.

Syntax
The Syntax works exactly like javascript, except there are some extra functions. There are some square brackets([]). They represent the value you have to enter. Some are specific: Tower id: The id of the tower. Will be explained later. Entity id: The id of the tower/agent/item/bloon that are specified. For example, two different towers placed on a track has different entity id's. Agent id: The id of the again. Will be explained later. Target id: The id of the targeting type. Will be explained later. Bloon id: The id of the bloon. Will be explained later. Entity type: The type of the bloon. Will be explained later. There are also some double square brackets. They represent a syntax like this(the value is 3, for example): [3] Or this (the xy one) [57,20] There are a few types of variables. Currently 2. int - integers from -2147483648 to 2147483647 array- An array of vars. [x] is the sequence of the array.

Setting
function ["Function Name"](variables); { // Function here }

Buying towers
Buys a tower and places it somewhere.

Syntax: Action.place([Tower id],[x],[y])

Selling towers
Sells a tower. Need I say more?

Syntax: Action.sell([Entity id])

Buying agents
Obviously buys an agent.

Syntax: Action.buy([Agent id])

Placing agents
Well, not buy, but places the agent.

Syntax: Action.placeAgent([Agent id],[x],[y])

Changing target type
Changes target priority.

Syntax: Action.setTarget([Entity id],[Target id])

Upgrading towers
Upgrades tower.

Syntax: Action.up([Entity id],[Path])

Variables
There are variables that are gettable by this syntax: [Variable Syntax]=[var]

Rank
Gets the rank of the user.

Syntax: getUserRank

Exp
Gets EXP of the user.

Syntax: getUserExp

Monkey Money
Gets.... you guess.

Syntax: getMM

Cash
Gets the cash you have (in the current game, obviously)

Syntax: getCash

Lives
Gets the live you have (same as above)

Syntax: getLives

Round
Get the round of the current game.

Syntax: getRound

Pop Count
Gets the pop count of a specific tower/agent.

Syntax: getTowerPop([Entity id])

Entities in range
Sets a range and collects it into an array.

Syntax: getEntity(Fromx],[y,tox],[y,[Entity type(optional)])

RBE
Gets RBE of a tower bloon.

Syntax: getRBE([Entity id])

HP
Gets HP of an entity.

Syntax: getHP([Entity id])

Speed
Gets Speed of a bloon.

Syntax: getSpeed([Entity id])

Position
Gets Position of an entity.

Syntax: getPos([Entity id])

Id
Get a whatever Id of entity. (Not entity id's)

Syntax: getId([Entity id],[Entity type])

Operators
Well, I won't divide this part into subheadings. Too much to write. I will only explain the special ones. + - * / % - Modulus. See more at Wikipedia. ^ ++ - Increment. Increases by one. -- - Decrement. Does reverse as above. = > < >= - gte <= - lte == === != - Not equal || - or && - and

Conditional functions
What else other than If, then and else? Works exactly like javascript. nuff said.

Other function
All javascript functions works.

Id
Here are the Id's of the bloons. Although there are like hundreds of them, only a few will be listed. 1 - Red 2 - Blue 3 - Green ... 6 - Purple 7 - Black 8 - White 9 - Zebra 10- Lead 11- Commando 12- Two-faced 13- Zebra 14- Gold etc Here are bloon properties applied to original bloons. x is the original value. x+65536 - Camo x+131072- Regen Here are the tower Id's 1 - Dart Monkey 2 - Tack Shooter etc According to the setting of the Towers. Here are the Target Id's 1 - First 2 - Last 3 - Strong 4 - Weak 5 - Cease Fire And finally, here are the Entity types. 1 - Tower 2 - Agent 3 - Bloon 4 - Item

Examples
Cease fire if gold Bloon enters game Function CeaseFire { getEntity(From[0,0],to[804,602],3)=a1; getEntity(From[0,0],to[804,602],1)=a2; if (a1.any=14) {  for (var i = 0; i < a2.length; i++) {  Action.setTarget(a2[i],5); } } } Restore tower if HP is below 2. Function ResHP { getEntity(From[0,0],to[804,602],1)=a1; for (var i = 0; i < a1.length; i++) { getHP(a1[i])=x if (x<2) {  getId(a1[i],1)=y; getPos(a1[i])=a2; var a2[1]=z1; var a2[2]=z2; Action.sell(a1[i],5); Action.place(y,z1,z2); } }

Trivia

 * When I first tried to change this to visual mode, it says there is some complex codes
 * Obvious reference to me.
 * Incomplete!