Followed by maybe some if statements or something to spoonfeed out possible parameters or outcomes? I don't know, I didn't really put much thought into it, I'm pretty tired...
Rollback Post to RevisionRollBack
Back to modding! Follow me on Twitter @byteandahalf
Followed by maybe some if statements or something to spoonfeed out possible parameters or outcomes? I don't know, I didn't really put much thought into it, I'm pretty tired...
This is the script I used in the video:
function useItem(x,y,z,itemId,blockId,side)
{
//Your Code Here
}
function attackHook(attacker, victim)
{
//Your Code Here
}
function modTick()
{
//Your Code Here
}
var CMD_DEBUG = false;
function procCmd(cmd)
{
var cmdData = cmd.split(" ");
var playa = getPlayerEnt();
if(CMD_DEBUG)
{
clientMessage("Command: "+cmdData[0]);
for(var i=1;i<cmdData.length;i++)
clientMessage("Arg: "+cmdData[i]);
}
if(cmdData[0]=="setVelX")
{
setVelX(playa,Integer.parseInt(cmdData[1]));
}
else if(cmdData[0]=="setVelY")
{
setVelY(playa,Integer.parseInt(cmdData[1]));
}
else if(cmdData[0]=="setVelZ")
{
setVelZ(playa,Integer.parseInt(cmdData[1]));
}
else if(cmdData[0]=="cmdDebug")
{
CMD_DEBUG = !CMD_DEBUG;
//clientMessage(CMD_DEBUG);
if(CMD_DEBUG)
{
clientMessage("Command Debugging: On");
}else{
clientMessage("Command Debugging: Off");
}
}
else if(cmdData[0]=="addItem")
{
if(cmdData.length==3)
{
addItemInventory(Integer.parseInt(cmdData[1]),Integer.parseInt(cmdData[2])%255);
}else{
addItemInventory(Integer.parseInt(cmdData[1]),1);
}
}
}
That's awesome...So we can make our own commands. But Im confused about that command debug thing.... and does the command debug always have to have a global variable for it? What does it do?
Rollback Post to RevisionRollBack
Back to modding! Follow me on Twitter @byteandahalf
Right under the function procCmd(cmd), you define 2 local variables, fine. But then the only thing left in those brackets leading to anywhere else in the code is an if statement calling your global variable CMD_DEBUG to compare, which makes me think it's required... Anyway, nice work! Can't wait to use this treebl!
Rollback Post to RevisionRollBack
Back to modding! Follow me on Twitter @byteandahalf
Note:
This won't work in the current release, but I will update it sometime this week.
Will there be a callback that receives all chat messages or will there only be a callback that only fires with commands?
Also, if ModPE Scripts were adapted for servers, the use of / may conflict. Any other ideas? Some desktop clients uses a . to prefix client messages, however, that might be a bit obtrusive.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Note:
This won't work in the current release, but I will update it sometime this week.
First!
Back to modding! Follow me on Twitter @byteandahalf
Followed by maybe some if statements or something to spoonfeed out possible parameters or outcomes? I don't know, I didn't really put much thought into it, I'm pretty tired...
Back to modding! Follow me on Twitter @byteandahalf
This is the script I used in the video:
function useItem(x,y,z,itemId,blockId,side) { //Your Code Here } function attackHook(attacker, victim) { //Your Code Here } function modTick() { //Your Code Here } var CMD_DEBUG = false; function procCmd(cmd) { var cmdData = cmd.split(" "); var playa = getPlayerEnt(); if(CMD_DEBUG) { clientMessage("Command: "+cmdData[0]); for(var i=1;i<cmdData.length;i++) clientMessage("Arg: "+cmdData[i]); } if(cmdData[0]=="setVelX") { setVelX(playa,Integer.parseInt(cmdData[1])); } else if(cmdData[0]=="setVelY") { setVelY(playa,Integer.parseInt(cmdData[1])); } else if(cmdData[0]=="setVelZ") { setVelZ(playa,Integer.parseInt(cmdData[1])); } else if(cmdData[0]=="cmdDebug") { CMD_DEBUG = !CMD_DEBUG; //clientMessage(CMD_DEBUG); if(CMD_DEBUG) { clientMessage("Command Debugging: On"); }else{ clientMessage("Command Debugging: Off"); } } else if(cmdData[0]=="addItem") { if(cmdData.length==3) { addItemInventory(Integer.parseInt(cmdData[1]),Integer.parseInt(cmdData[2])%255); }else{ addItemInventory(Integer.parseInt(cmdData[1]),1); } } }Back to modding! Follow me on Twitter @byteandahalf
Back to modding! Follow me on Twitter @byteandahalf
Back to modding! Follow me on Twitter @byteandahalf
Back to modding! Follow me on Twitter @byteandahalf
Java/C/C++ dev, server owner and hacker extraordinare
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumWill there be a callback that receives all chat messages or will there only be a callback that only fires with commands?
Also, if ModPE Scripts were adapted for servers, the use of / may conflict. Any other ideas? Some desktop clients uses a . to prefix client messages, however, that might be a bit obtrusive.