Here's a quick documentation of the currently available functions:
Hook functions
- These functions are used to execute other specified functions if certain actions are performed.
function useItem(x,y,z,itemId,blockId,side){}
Performs specified functions when the player uses an item.
Can be used to identify:
On what block an item was used.
The used item's ID.
The used blocks ID.
The side of the used block.
To test for specific use cases, use if/else statements
function useItem(x,y,z,itemId,blockId,side) { // When an item/block is used...
if(itemId==280) { // And if your item is a stick...
clientMessage("You used a stick!"); // Send a message to the chat.
}
}
function attackHook(attacker, victim){}
Performs specified functions when a player attacks another entity.
Can be used to performs actions onto both the attacker and the victim
function attackHook(attacker, victim) { // If an attack is performed...
if(getCarriedItem()==280) { // And if the used item is a stick...
preventDefault(); // Don't call the real attack function...
setVelY(victim,1.5); // Set the victim's Y Velocity to 1.5.
}
}
function procCmd(cmd){}
Can be used to identify what has been written in the chat.
function procCmd(cmd) { // When something is said in chat...
var Data = cmd.split(" "); // Split different sets of data at the spaces.
if(Data[0]=="coords") { // If the first bit of data is "coords"...
var xc = getPlayerX(); // Get the players X coordinate...
var yc = getPlayerY(); // The players Y coordinate...
var zc = getPlayerX(); // And the players Z coordinates...
clientMessage("X:" + xc + ", Y:" + yc + ", Z:" + zc); // Then send the info to the chat.
}
}
function modTick(){}
Can be used for timed functions.
Necessary to be at the end of every script for it to work.
Text functions
- These functions are used to display information.
function print(text);
Displays the specified text.
Accepts text strings.
On iOS, it displays the text in an alert popup.
function clientMessage(text);
Displays the specified text.
Accepts text strings.
Differs from print(); as clientMessage(); shows the string in the chat rather than in an alert.
GET functions
- These functions are used to get specified information. They don't cause any on screen changes.
function getPlayerX();
function getPlayerY();
function getPlayerZ();
Gets the players X, Y, and Z coordinates respectively.
When "x,y,z" is passed as an argument, getTile(); will get the Data Value of the selected block.
When coordinates are specified, getTile(); will get the Data Value of the block that it finds at said coordinates.
function getCarriedItem();
Gets the Data Value of the currently carried item.
Accepts no arguments.
SET functions
- These functions are used to set information and values. They may cause on screen changes.
function setNightMode(isNight);
Doesn't seem to work.
Assumed to change time of day.
function setTile(x,y,z,type);
Sets the Data Value of the selected block to the specified Data Value
Accepts X, Y, and Z coordinates and Data Values.
When "x,y,z,--data value--" is passed as an argument, setTile(); will set the Data Value of the selected block to the specified Data Value.
When coordinates are specified, setTile(); will set the Data Value of the block it finds at said coordinates to the specified Data Value.
function setPosition(ent,x,y,z);
Sets the position of the specified entity to the specified coordinates.
Accepts X, Y, and Z, coordinates and an entity value.
When attackHook(); isn't used, setPosition(); needs the entity ID of the player for "ent".
When attackHook(player,target); is used, setPosition(); needs one of the two arguments passed in attackHook(); for "ent".
setPositionRelative(); IS POSSIBLY WRONG
function setPositionRelative(ent,x,y,z);
Sets the position of the specified entity relative to the current direction the entity is facing.
Accepts X, Y, and Z coordinates and an entity value.
When attackHook(); isn't used, setPositionRelative(); needs the entity ID of the player for "ent".
When attackHook(player,target); is used, setPositionRelative(); needs one of the two arguments passed in attackHook(); for "ent".
function setRot(ent,x,y);
Sets the rotation of the head of the specified entity.
Accepts X and Y coordinates and an entity value.
When attackHook(); isn't used, setRot(); needs the entity ID of the player for "ent".
When attackHook(player,target); is used, setRot(); needs one of the two arguments passed in attackHook(); for "ent".
function setVelX(ent,amount);
function setVelY(ent,amount);
function setVelZ(ent,amount);
Sets the respective X, Y, and Z velocities of the specified entity.
Accepts an entity value and an amount value.
When attackHook(); isn't used, setVel?(); needs the entity ID of the player for "ent".
When attackHook(player,target); is used, setVel?(); needs one of the two arguments passed in attackHook(); for "ent".
Spawn functions
- These functions are used for spawning mobs
function spawnChicken(x,y,z,image);
function spawnCow(x,y,z,image);
Spawns the respective mob at the specified coordinates with the specified image.
Accepts X, Y, and Z, coordinates and an image file location value.
When "x,y,z,--image--" is passed as an argument, the respective mob will be spawned on the selected block.
When coordinates are specified, the mob is spawned at said coordinates.
Miscellaneous functions
- These functions don't fit anywhere else and are more random
function preventDefault();
Prevents the default action of the current function and/or item.
Accepts no arguments.
function explode(x,y,z,radius);
Causes an explosion centered at the specified coordinates with the size of the explosion depending on the radius specified.
Accepts X, Y, and Z coordinates and a radius value.
When "x,y,z,--radius--" is passed as an argument, explode(); will cause an explosion centered on the selected block with a radius of the radius specified.
When coordinates are specified, explode(); will cause an explosion centered at said coordinates with a radius of the radius specified.
function addItemInventory(id,amount);
Adds the specified amount of the specified item.
Accepts Data Values of blocks and items and amount values ranging from 1 to 255.
function rideAnimal(player,target);
Makes the player ride the target.
Requires the attackHook(); function and its arguments.
Rollback Post to RevisionRollBack
-------------------- If I helped you, made you laugh, or you just like my post, click this button! --------------------v
Here's a quick documentation of the currently available functions:
Hook functions
- These functions are used to execute other specified functions if certain actions are performed.
function useItem(x,y,z,itemId,blockId,side){}
Performs specified functions when the player uses an item.
Can be used to identify:
On what block an item was used.
The used item's ID.
The used blocks ID.
The side of the used block.
To test for specific use cases, use if/else statements
function useItem(x,y,z,itemId,blockId,side) { // When an item/block is used...
if(itemId==280) { // And if your item is a stick...
clientMessage("You used a stick!"); // Send a message to the chat.
}
}
function attackHook(attacker, victim){}
Performs specified functions when a player attacks another entity.
Can be used to performs actions onto both the attacker and the victim
function attackHook(attacker, victim) { // If an attack is performed...
if(getCarriedItem()==280) { // And if the used item is a stick...
preventDefault(); // Don't call the real attack function...
setVelY(victim,1.5); // Set the victim's Y Velocity to 1.5.
}
}
function procCmd(cmd){}
Can be used to identify what has been written in the chat.
function procCmd(cmd) { // When something is said in chat...
var Data = cmd.split(" "); // Split different sets of data at the spaces.
if(Data[0]=="coords") { // If the first bit of data is "coords"...
var xc = getPlayerX(); // Get the players X coordinate...
var yc = getPlayerY(); // The players Y coordinate...
var zc = getPlayerX(); // And the players Z coordinates...
clientMessage("X:" + xc + ", Y:" + yc + ", Z:" + zc); // Then send the info to the chat.
}
}
function modTick(){}
Can be used for timed functions.
Necessary to be at the end of every script for it to work.
Text functions
- These functions are used to display information.
function print(text);
Displays the specified text.
Accepts text strings.
On iOS, it displays the text in an alert popup.
function clientMessage(text);
Displays the specified text.
Accepts text strings.
Differs from print(); as clientMessage(); shows the string in the chat rather than in an alert.
GET functions
- These functions are used to get specified information. They don't cause any on screen changes.
function getPlayerX();
function getPlayerY();
function getPlayerZ();
Gets the players X, Y, and Z coordinates respectively.
When "x,y,z" is passed as an argument, getTile(); will get the Data Value of the selected block.
When coordinates are specified, getTile(); will get the Data Value of the block that it finds at said coordinates.
function getCarriedItem();
Gets the Data Value of the currently carried item.
Accepts no arguments.
SET functions
- These functions are used to set information and values. They may cause on screen changes.
function setNightMode(isNight);
Doesn't seem to work.
Assumed to change time of day.
function setTile(x,y,z,type);
Sets the Data Value of the selected block to the specified Data Value
Accepts X, Y, and Z coordinates and Data Values.
When "x,y,z,--data value--" is passed as an argument, setTile(); will set the Data Value of the selected block to the specified Data Value.
When coordinates are specified, setTile(); will set the Data Value of the block it finds at said coordinates to the specified Data Value.
function setPosition(ent,x,y,z);
Sets the position of the specified entity to the specified coordinates.
Accepts X, Y, and Z, coordinates and an entity value.
When attackHook(); isn't used, setPosition(); needs the entity ID of the player for "ent".
When attackHook(player,target); is used, setPosition(); needs one of the two arguments passed in attackHook(); for "ent".
setPositionRelative(); IS POSSIBLY WRONG
function setPositionRelative(ent,x,y,z);
Sets the position of the specified entity relative to the current direction the entity is facing.
Accepts X, Y, and Z coordinates and an entity value.
When attackHook(); isn't used, setPositionRelative(); needs the entity ID of the player for "ent".
When attackHook(player,target); is used, setPositionRelative(); needs one of the two arguments passed in attackHook(); for "ent".
function setRot(ent,x,y);
Sets the rotation of the head of the specified entity.
Accepts X and Y coordinates and an entity value.
When attackHook(); isn't used, setRot(); needs the entity ID of the player for "ent".
When attackHook(player,target); is used, setRot(); needs one of the two arguments passed in attackHook(); for "ent".
function setVelX(ent,amount);
function setVelY(ent,amount);
function setVelZ(ent,amount);
Sets the respective X, Y, and Z velocities of the specified entity.
Accepts an entity value and an amount value.
When attackHook(); isn't used, setVel?(); needs the entity ID of the player for "ent".
When attackHook(player,target); is used, setVel?(); needs one of the two arguments passed in attackHook(); for "ent".
Spawn functions
- These functions are used for spawning mobs
function spawnChicken(x,y,z,image);
function spawnCow(x,y,z,image);
Spawns the respective mob at the specified coordinates with the specified image.
Accepts X, Y, and Z, coordinates and an image file location value.
When "x,y,z,--image--" is passed as an argument, the respective mob will be spawned on the selected block.
When coordinates are specified, the mob is spawned at said coordinates.
Miscellaneous functions
- These functions don't fit anywhere else and are more random
function preventDefault();
Prevents the default action of the current function and/or item.
Accepts no arguments.
function explode(x,y,z,radius);
Causes an explosion centered at the specified coordinates with the size of the explosion depending on the radius specified.
Accepts X, Y, and Z coordinates and a radius value.
When "x,y,z,--radius--" is passed as an argument, explode(); will cause an explosion centered on the selected block with a radius of the radius specified.
When coordinates are specified, explode(); will cause an explosion centered at said coordinates with a radius of the radius specified.
function addItemInventory(id,amount);
Adds the specified amount of the specified item.
Accepts Data Values of blocks and items and amount values ranging from 1 to 255.
function rideAnimal(player,target);
Makes the player ride the target.
Requires the attackHook(); function and its arguments.
Error: Modtick does NOT have to be at the end of a script. I don't use the editor and write them from scratch and I never add the modtick hook.
Ok, im working on a Super Speed command for android. There are no syntax errors, or any others in this code, but it crashes my BlockLauncher after typing
/speed on
This is part of a bigger command list, located in my signature.
for(r=-18000;r<=18000;r==r+360) {
Any help?
Spotted it right off: change "r==r+360" to "r=r+360" or "r+=360".
"==" is the comparison operator, "=" is the assignment operator.
Rollback Post to RevisionRollBack
"There is no greater good than Justice; and only if law serves Justice is it a good law."
Changed it to "r = r + 360", but still crashes BlockLauncher
Also: 'speed' 'on' and 'off' need to be "speed" "on" and "off".
" " are for strings (multiple characters of text.)
' ' are for single characters.
Also, your 6 nested "for"-loops at the beginning have no code inside!
Also, the variables 'r','s','t','u','v', and 'w' need to be declared outside the function "modTick" if you want to access them in the function "useItem"
Here's a quick documentation of the currently available functions:
Hook functions
- These functions are used to execute other specified functions if certain actions are performed.
function useItem(x,y,z,itemId,blockId,side){}
Performs specified functions when the player uses an item.
Can be used to identify:
On what block an item was used.
The used item's ID.
The used blocks ID.
The side of the used block.
To test for specific use cases, use if/else statements
function useItem(x,y,z,itemId,blockId,side) { // When an item/block is used...
if(itemId==280) { // And if your item is a stick...
clientMessage("You used a stick!"); // Send a message to the chat.
}
}
function attackHook(attacker, victim){}
Performs specified functions when a player attacks another entity.
Can be used to performs actions onto both the attacker and the victim
function attackHook(attacker, victim) { // If an attack is performed...
if(getCarriedItem()==280) { // And if the used item is a stick...
preventDefault(); // Don't call the real attack function...
setVelY(victim,1.5); // Set the victim's Y Velocity to 1.5.
}
}
function procCmd(cmd){}
Can be used to identify what has been written in the chat.
function procCmd(cmd) { // When something is said in chat...
var Data = cmd.split(" "); // Split different sets of data at the spaces.
if(Data[0]=="coords") { // If the first bit of data is "coords"...
var xc = getPlayerX(); // Get the players X coordinate...
var yc = getPlayerY(); // The players Y coordinate...
var zc = getPlayerX(); // And the players Z coordinates...
clientMessage("X:" + xc + ", Y:" + yc + ", Z:" + zc); // Then send the info to the chat.
}
}
function modTick(){}
Can be used for timed functions.
Necessary to be at the end of every script for it to work.
Text functions
- These functions are used to display information.
function print(text);
Displays the specified text.
Accepts text strings.
On iOS, it displays the text in an alert popup.
function clientMessage(text);
Displays the specified text.
Accepts text strings.
Differs from print(); as clientMessage(); shows the string in the chat rather than in an alert.
GET functions
- These functions are used to get specified information. They don't cause any on screen changes.
function getPlayerX();
function getPlayerY();
function getPlayerZ();
Gets the players X, Y, and Z coordinates respectively.
When "x,y,z" is passed as an argument, getTile(); will get the Data Value of the selected block.
When coordinates are specified, getTile(); will get the Data Value of the block that it finds at said coordinates.
function getCarriedItem();
Gets the Data Value of the currently carried item.
Accepts no arguments.
SET functions
- These functions are used to set information and values. They may cause on screen changes.
function setNightMode(isNight);
Doesn't seem to work.
Assumed to change time of day.
function setTile(x,y,z,type);
Sets the Data Value of the selected block to the specified Data Value
Accepts X, Y, and Z coordinates and Data Values.
When "x,y,z,--data value--" is passed as an argument, setTile(); will set the Data Value of the selected block to the specified Data Value.
When coordinates are specified, setTile(); will set the Data Value of the block it finds at said coordinates to the specified Data Value.
function setPosition(ent,x,y,z);
Sets the position of the specified entity to the specified coordinates.
Accepts X, Y, and Z, coordinates and an entity value.
When attackHook(); isn't used, setPosition(); needs the entity ID of the player for "ent".
When attackHook(player,target); is used, setPosition(); needs one of the two arguments passed in attackHook(); for "ent".
setPositionRelative(); IS POSSIBLY WRONG
function setPositionRelative(ent,x,y,z);
Sets the position of the specified entity relative to the current direction the entity is facing.
Accepts X, Y, and Z coordinates and an entity value.
When attackHook(); isn't used, setPositionRelative(); needs the entity ID of the player for "ent".
When attackHook(player,target); is used, setPositionRelative(); needs one of the two arguments passed in attackHook(); for "ent".
function setRot(ent,x,y);
Sets the rotation of the head of the specified entity.
Accepts X and Y coordinates and an entity value.
When attackHook(); isn't used, setRot(); needs the entity ID of the player for "ent".
When attackHook(player,target); is used, setRot(); needs one of the two arguments passed in attackHook(); for "ent".
function setVelX(ent,amount);
function setVelY(ent,amount);
function setVelZ(ent,amount);
Sets the respective X, Y, and Z velocities of the specified entity.
Accepts an entity value and an amount value.
When attackHook(); isn't used, setVel?(); needs the entity ID of the player for "ent".
When attackHook(player,target); is used, setVel?(); needs one of the two arguments passed in attackHook(); for "ent".
Spawn functions
- These functions are used for spawning mobs
function spawnChicken(x,y,z,image);
function spawnCow(x,y,z,image);
Spawns the respective mob at the specified coordinates with the specified image.
Accepts X, Y, and Z, coordinates and an image file location value.
When "x,y,z,--image--" is passed as an argument, the respective mob will be spawned on the selected block.
When coordinates are specified, the mob is spawned at said coordinates.
Miscellaneous functions
- These functions don't fit anywhere else and are more random
function preventDefault();
Prevents the default action of the current function and/or item.
Accepts no arguments.
function explode(x,y,z,radius);
Causes an explosion centered at the specified coordinates with the size of the explosion depending on the radius specified.
Accepts X, Y, and Z coordinates and a radius value.
When "x,y,z,--radius--" is passed as an argument, explode(); will cause an explosion centered on the selected block with a radius of the radius specified.
When coordinates are specified, explode(); will cause an explosion centered at said coordinates with a radius of the radius specified.
function addItemInventory(id,amount);
Adds the specified amount of the specified item.
Accepts Data Values of blocks and items and amount values ranging from 1 to 255.
function rideAnimal(player,target);
Makes the player ride the target.
Requires the attackHook(); function and its arguments.
This'll need testing, but I think "setPositionRelative" moves the chosen entity relative to the player, not the direction it's facing.
Rollback Post to RevisionRollBack
"There is no greater good than Justice; and only if law serves Justice is it a good law."
This'll need testing, but I think "setPositionRelative" moves the chosen entity relative to the player, not the direction it's facing.
Yeah I'll look into it. Btw, the documentation is somewhat outdated now. It appears that some functions were removed while others were changed. I'll look into updating it some other time.
Link Removed
Link Removed
I don't believe this is JavaScript. It looks more like a form of C but I'm not 100% sure
I am secretly a modder, who works only for himself, seldom publishes.
Hook functions
- These functions are used to execute other specified functions if certain actions are performed.
Text functions
- These functions are used to display information.
GET functions
- These functions are used to get specified information. They don't cause any on screen changes.
SET functions
- These functions are used to set information and values. They may cause on screen changes.
Spawn functions
- These functions are used for spawning mobs
Miscellaneous functions
- These functions don't fit anywhere else and are more random
Error: Modtick does NOT have to be at the end of a script. I don't use the editor and write them from scratch and I never add the modtick hook.
Link Removed
Link Removed
New Funcs:
http://pastebin.com/w4AWwVkG
Darn....
Nope, but it will be in the near future.
This ModPE also has an auto updator, support for OOP funcs, and the ability to swap texture packs within a ModPE script!
Example:
Oh my god. TreeBl. You are amazing. I love you. xD!!! That's awesome jeep up the good work!!!
Darn....
Spotted it right off: change "r==r+360" to "r=r+360" or "r+=360".
"==" is the comparison operator, "=" is the assignment operator.
"There is no greater good than Justice; and only if law serves Justice is it a good law."
Also: 'speed' 'on' and 'off' need to be "speed" "on" and "off".
" " are for strings (multiple characters of text.)
' ' are for single characters.
Also, your 6 nested "for"-loops at the beginning have no code inside!
Also, the variables 'r','s','t','u','v', and 'w' need to be declared outside the function "modTick" if you want to access them in the function "useItem"
"There is no greater good than Justice; and only if law serves Justice is it a good law."
This'll need testing, but I think "setPositionRelative" moves the chosen entity relative to the player, not the direction it's facing.
"There is no greater good than Justice; and only if law serves Justice is it a good law."
Link Removed
Link Removed
Yeah I'll look into it. Btw, the documentation is somewhat outdated now. It appears that some functions were removed while others were changed. I'll look into updating it some other time.
for iOS I believe is
Correct me if I'm wrong
Link Removed
Link Removed
AND IT REMOVED MY TEXTURE PACK(not really a big deal)
But why doesn't the script patch/apply
Link Removed
Link Removed
I am secretly a modder, who works only for himself, seldom publishes.