function useItem(x,y,z,itemId,blockId,side)
{
//Your Code Here
}
function attackHook(attacker, victim)
{
//Your Code Here
}
var t=0;
function modTick()
{
if(t%300==0)
{
clientMessage("Welcome to ModPE");
clientMessage("Made by Treebl");
t=0;
}
t++;
}
function useItem(x,y,z,itemId,blockId,side)
{
//Your Code Here
}
function attackHook(attacker, victim)
{
//Your Code Here
}
var t=0;
function modTick()
{
if(t%300==0)
{
clientMessage("Welcome to ModPE");
clientMessage("Made by Treebl");
t=0;
}
t++;
}
Man I'm stuck getting the WELCOME TO MODPE AND MADE BYE TREEBL PLEASE HELP I DON'T LIKE IT WHEN IT REPEATS
This is what i put in function useItem(x,y,z,itemId,blockId,side) { addItemInventory(17,64); print("/aPickaxeCrafter2"); } function useItem(x,y,z,itemId,blockId,side) { addItemInventory(57,64). print("/aPickaxeCrafter1"); } function useItem(x,y,z,itemId,blockId,side) { addItemInventory(20,64); print("/aPickaxeCrafter3"); } and worldedite is not work
We are Sphix!
First, your code is completely wrong.
Second, you cannot do commands yet .
Third, you can put your "SphixTeam" thing in your signature.
Sorry but I have know idea what any off this means :/ help!!!!!
Use the examples or read someone else's script to get a basic idea.
I am currently working on a guide that treebl could maybe put on the script editor site.
if that's ok with treebl. If not I'll just write everything down into the editor and give you the id.
WHY ARE ALL OF THE MOD MAKERS FOR IOS ONLY?!?!?!?!?! :'(
if u play 0.6.1 in android,I will cry and say"WHY ALL THE AWSOME MOD ALWAYS IN ANDROID(snow ball grenade,remove gravity, open containers in creative,free crafting,night in creative,mobs spawn in creative,crazy mob,armor in creative,too many item,and more)
if u play 0.6.1 in android,I will cry and say"WHY ALL THE AWSOME MOD ALWAYS IN ANDROID(snow ball grenade,remove gravity, open containers in creative,free crafting,night in creative,mobs spawn in creative,crazy mob,armor in creative,too many item,and more)
what the point of it?I have dry to mine a log with axe,flower,lava bucket,hand and all thing but still nothing's happan
I have just made my 1st ever mod BUT it does not work... Help?
--snip--
Fixed:
function useItem(x,y,z,itemId,blockId,side) {
if(itemId==280) { //If your item is a stick
addItemInventory(14,64);
print("BUTTER!");
}
else if(itemId==288) { //If your item is a feather
addItemInventory(56,64);
print("I just found Diamond");
}
else if(itemId==287) { //If your item is string
addItemInventory(10,32);
print("Burn baby burn");
}
else if(itemId==262) { //If your item is an arrow
addItemInventory(8,32);
print("just for the LOLZ!");
}
}
function modTick(){}
Couple things;
Capitalization matters when using JavaScript. You originally called the useitem function (which doesn't exist) while you should have called the useItem function instead (useitem() =/= useItem())
Make sure to add semicolons. This is VERY important as functions "merge" (for lack of a better term) when you don't specify the end of said function. Without a semicolon at the end of the first function, the device will only read that function or will result in an error. Adding a semi colon to the last function in a script isn't necessary, but it's good practice to do so.
Avoid using items such as torches and flowers as they can't really be "used" but rather placed. Use items like; string, arrows, sticks, feathers, gunpowder, etc.
You misspelled itemId in the last else if statement (iemID).
It's better to use clientMessage() than print() as iOS users have to deal with that annoying popup but that's just my opinion. It's the same syntax, just a different way of displaying the information.
For everyone else who ever has problems with their script, Google is your friend! JavaScript isn't anything new so if you're having problems, look up some examples of it online (specifically if/else statements, variable scoping, and proper syntax).
ModPE Script v0.2 Alpha Release
Licensed under the Creative Commons Attribution-NoDerivs 3.0 Unported license
Please View the details of the license here: http://creativecommons.org/licenses/by-nd/3.0/legalcode
Made by Carter Feldman
Copyright 2013
Steps:
1.
Put the dylib and plist in /Library/MobileSubstrate/DynamicLibraries/
2.
Register at
http://betamodpe2.cf.gy/user/register.php
3.
Confirm your email
4.
Login and click on LOAD SCRIPT EDITOR
5.
Under "Create New Script" type in your script name and press "Create New Script"
6.
Wait a few seconds and then click on the "My Scripts" drop down, select your script and press "Load"
7.
Code your script, and when your done, press "Save" in the top left hand corner.
8.
Copy down the Script ID displayed in the top right hand corner (It should say Currently Editing: <your script name> Script ID: <your script id>)
9.
Start Minecraft PE and enter in your id!
----------------------
Built in Function List:
function print(text);
function clientMessage(text);
function setNightMode(isNight);
function getPlayerX();
function getPlayerY();
function getPlayerZ();
function getPlayerEnt();
function getLevel();
function getYaw();
function getPitch();
function setPosition(ent,x,y,z);
function setPositionRelative(ent,x,y,z);
function setRot(ent,x,y);
function getTile(x,y,z);
function setVelX(ent, amount);
function setVelY(ent, amount);
function setVelZ(ent, amount);
function explode(x, y, z, radius);
function addItemInventory(id, amount);
function rideAnimal(player, target);
function getCarriedItem();
function preventDefault();
function setTile(x,y,z,type);
function spawnChicken(x,y,z,image);
function spawnCow(x,y,z,image);
Example Scripts:
---------------------------------------------------
Example 1:
function useItem(x,y,z,itemId,blockId,side)
{
if(itemId==280)//If your item is a stick
{
addItemInventory(3,5);//Add 5 Dirt blocks to your inventory.
print("Hello World");
}
}
function attackHook(attacker, victim)
{
if(getCarriedItem()==280)//If your item is a stick
{
preventDefault();//Don't call the real attack function after
setVelY(victim,1.5);//Make them fly vertically =)
}
}
function modTick()
{
}
---------------------------------------------------
---------------------------------------------------
Example 2:
function useItem(x,y,z,itemId,blockId,side)
{
if(itemId==291&&blockId==4)//If your item is a stone hoe, and the block your using it on is stone
{
explode(x,y,z,3.1);//Blow it up!
}
else if(blockId==5)//If the block we are using is a wooden plank
{
setTile(x,y,z,11);//Turn it into lava!!
}
else if(itemId==287)//If our item is string
{
ImAHelperFunction(x,y,z);//make a gold tower!
}
}
function ImAHelperFunction(x,y,z)
{
for(var i=0;i<5;i++)
{
setTile(x,y+i,z,14);
}
}
function attackHook(attacker, victim)
{
var ourItem = getCarriedItem();//The id of the item we are wielding
if(ourItem==288)//If the item is a feather
{
preventDefault();//Don't call the real attack function after
rideAnimal(attacker,victim);//ride the animal
}
else if(ourItem==262)//If the item is an arrow
{
spawnChicken(getPlayerX(),getPlayerY()+4,getPlayerZ(),"mob/chicken.png");//spawn a chicken above our head (you can change it to your own picture if you like)
}
}
function modTick()
{
}
------------------------------------------------------
More Examples Coming Soon!
---------------------------------------------------
unction useItem(x,y,z,itemId,blockId,side)
{if(itemId==280) { //If your item is a stickaddItemInventory(14,64);print("BUTTER!");}else if(itemId==288) { //If your item is a featheraddItemInventory(56,64);print("I just found Diamond");}else if(itemId==287) { //If your item is stringaddItemInventory(10,32);print("Burn baby burn");}else if(itemId==262) { //If your item is an arrowaddItemInventory(8,32);print("just for the LOLZ!");}}function modTick(){}
let me guess... the gaps between the lines...?
You're commenting all of your code. If you want your code to be on one line, delete all the comments. Like so:
function useItem(x,y,z,itemId,blockId,side){if(itemId==280){addItemInventory(14,64);print("BUTTER!");}else if(itemId==288){addItemInventory(56,64);print("I just found Diamond");}else if(itemId==287){addItemInventory(10,32);print("Burn baby burn");}else if(itemId==262){addItemInventory(8,32);print("just for the LOLZ!");}}function modTick(){}
Rollback Post to RevisionRollBack
-------------------- If I helped you, made you laugh, or you just like my post, click this button! --------------------v
Ik I shouldn't ask this here but this is like the only place I could get answer who was the guy who made the mob controlling script I searched and couldn't find it
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.
Lol you basically just did what I am doing. I was going to make a written guide now I see I don't have to lol. Good job now people shouldn't say "I have know idea what I do!" Good job, again.
Modulus works
function useItem(x,y,z,itemId,blockId,side) { //Your Code Here } function attackHook(attacker, victim) { //Your Code Here } var t=0; function modTick() { if(t%300==0) { clientMessage("Welcome to ModPE"); clientMessage("Made by Treebl"); t=0; } t++; }Man I'm stuck getting the WELCOME TO MODPE AND MADE BYE TREEBL PLEASE HELP I DON'T LIKE IT WHEN IT REPEATS
function useItem(x,y,z,itemId,blockId,side) { if(itemId==280) { var xc = getPlayerX(); var yc = getPlayerY(); var zc = getPlayerZ(); clientMessage("X:" + xc + ", Y:" + yc + ", Z:" + zc); } } function modTick(){}Or just use this id: 2893. Just tap on a block with the stick and it'll tell you your coordinates.
Great job so far treebl! Keep up the work! Btw, are there any plans to add the ability to get strings posted in the chat?
First, your code is completely wrong.
Second, you cannot do commands yet .
Third, you can put your "SphixTeam" thing in your signature.
Use the examples or read someone else's script to get a basic idea.
I am currently working on a guide that treebl could maybe put on the script editor site.
if that's ok with treebl. If not I'll just write everything down into the editor and give you the id.
I recommend using Dolphin Browser from the App Store or Google Play. I believe it is compatible with the ModPE Script Editor.
Fixed:
function useItem(x,y,z,itemId,blockId,side) { if(itemId==280) { //If your item is a stick addItemInventory(14,64); print("BUTTER!"); } else if(itemId==288) { //If your item is a feather addItemInventory(56,64); print("I just found Diamond"); } else if(itemId==287) { //If your item is string addItemInventory(10,32); print("Burn baby burn"); } else if(itemId==262) { //If your item is an arrow addItemInventory(8,32); print("just for the LOLZ!"); } } function modTick(){}Couple things;
- Capitalization matters when using JavaScript. You originally called the useitem function (which doesn't exist) while you should have called the useItem function instead (useitem() =/= useItem())
- Make sure to add semicolons. This is VERY important as functions "merge" (for lack of a better term) when you don't specify the end of said function. Without a semicolon at the end of the first function, the device will only read that function or will result in an error. Adding a semi colon to the last function in a script isn't necessary, but it's good practice to do so.
- Avoid using items such as torches and flowers as they can't really be "used" but rather placed. Use items like; string, arrows, sticks, feathers, gunpowder, etc.
- You misspelled itemId in the last else if statement (iemID).
- It's better to use clientMessage() than print() as iOS users have to deal with that annoying popup but that's just my opinion. It's the same syntax, just a different way of displaying the information.
For everyone else who ever has problems with their script, Google is your friend! JavaScript isn't anything new so if you're having problems, look up some examples of it online (specifically if/else statements, variable scoping, and proper syntax).Do you have a computer version?
Click above to SUBSCRIBE for some of the best work of MCPE!
You're commenting all of your code. If you want your code to be on one line, delete all the comments. Like so:
function useItem(x,y,z,itemId,blockId,side){if(itemId==280){addItemInventory(14,64);print("BUTTER!");}else if(itemId==288){addItemInventory(56,64);print("I just found Diamond");}else if(itemId==287){addItemInventory(10,32);print("Burn baby burn");}else if(itemId==262){addItemInventory(8,32);print("just for the LOLZ!");}}function modTick(){}Lol you basically just did what I am doing. I was going to make a written guide now I see I don't have to lol. Good job now people shouldn't say "I have know idea what I do!" Good job, again.