Saccy701, that code will work fine. The var definition is a global...so it will do what is expected. Not well, but it will work. modTick() is a loop. It happens @ 20Hz.
I will suggest that you change that string of ifs to one IF and else if on everything else. Otherwise you are checking ALL of those on EVERY tick. Not good coding.
Personally, I would change it to a switch case, probably the MOST efficient way to code that as you have it, but yet being a bit lazy with working out the code.
If you wanted to get REALLY fancy, you can put all of your responses into an array. Then use math to determine if you need to increment the array pointer and say something.
As you have it written, mod 20 (modulus) will do well.
Rollback Post to RevisionRollBack
To Download my Mods, after you click the download link, select the arrow in the UPPER RIGHT. This will then, download the file to your device
oh, and you wanted to have commands to start, etc.
Remember to add ; to your code. It makes it more readable :-)
JS is a bit lazy with this, but you shouldn't be!
Change:
var count = 0
function modTick()
{
{
count++
}
if(count == 20)
{
To: (also, I removed the extra { }. not needed...java is interpreted, so more text is bad and slower)
var count = 0;
var run = false;
function modTick()
{
if(run)
count++;
else
return;
if(count == 20)
{
------------------------------------------------
Then as Saccy701 pointed out (I copied this from above and added the else cases),
//Make sure you don't put in cmd == "/start" because ingame youll have to put in "//start"
//The "cmd" is the command typed in, as in "/start" :
function procCmd(cmd) {
if (cmd == "start") {
run = true;
}
else if (cmd == "stop") {
run = false;
count = 0;
}
else if (cmd == "help") {
// add print statements or whatever you want to happen when help is typed
}
}
Hello!
It may sound a little bit noob, but how can I add a 'help' command (only text) and a 'start' command to run the script below?
var count = 0
function modTick()
{
{
count++
}
if(count == 20)
{
clientMessage("§8- §6Starting in 0:30§8 -")
}
if(count == 40)
{
clientMessage("§8- §6Starting in 0:29§8 -")
}
if(count == 60)
{
clientMessage("§8- §6Starting in 0:28§8 -")
}
if(count == 80)
{
clientMessage("§8- §6Starting in 0:27§8 -")
}
if(count == 100)
{
clientMessage("§8- §6Starting in 0:26§8 -")
}
if(count == 120)
{
clientMessage("§8- §6Starting in 0:25§8 -")
}
if(count == 140)
{
clientMessage("§8- §6Starting in 0:24§8 -")
}
if(count == 180)
{
clientMessage("§8- §6Starting in 0:23§8 -")
}
if(count == 200)
{
clientMessage("§8- §6Starting in 0:22§8 -")
}
if(count == 220)
{
clientMessage("§8- §6Starting in 0:21§8 -")
}
if(count == 240)
{
clientMessage("§8- §6Starting in 0:20§8 -")
}
if(count == 260)
{
clientMessage("§8- §6Starting in 0:19§8 -")
}
if(count == 280)
{
clientMessage("§8- §6Starting in 0:18§8 -")
}
if(count == 300)
{
clientMessage("§8- §6Starting in 0:17§8 -")
}
if(count == 320)
{
clientMessage("§8- §6Starting in 0:16§8 -")
}
if(count == 340)
{
clientMessage("§8- §6Starting in 0:15§8 -")
}
if(count == 360)
{
clientMessage("§8- §6Starting in 0:14§8 -")
}
if(count == 380)
{
clientMessage("§8- §6Starting in 0:13§8 -")
}
if(count == 400)
{
clientMessage("§8- §6Starting in 0:12§8 -")
}
if(count == 420)
{
clientMessage("§8- §6Starting in 0:11§8 -")
}
if(count == 440)
{
clientMessage("§8- §6Starting in 0:10§8 -")
}
if(count == 460)
{
clientMessage("§8- §6Starting in 0:09§8 -")
}
if(count == 480)
{
clientMessage("§8- §6Starting in 0:08§8 -")
}
if(count == 500)
{
clientMessage("§8- §6Starting in 0:07§8 -")
}
if(count == 520)
{
clientMessage("§8- §6Starting in 0:06§8 -")
}
if(count == 540)
{
clientMessage("§8- §6Starting in 0:05§8 -")
}
if(count == 560)
{
clientMessage("§8- §6Starting in 0:04§8 -")
}
if(count == 580)
{
clientMessage("§8- §6Starting in 0:03§8 -")
}
if(count == 600)
{
clientMessage("§8- §6Starting in 0:02§8 -")
}
if(count == 620)
{
clientMessage("§8- §6Starting in 0:01§8 -")
}
if(count == 640)
{
clientMessage("§8[§cGAME§8] §6Game has started")
}
}
Thanks
Making a mod with friends.
Help please!
Making a mod with friends.
Saccy701, that code will work fine. The var definition is a global...so it will do what is expected. Not well, but it will work. modTick() is a loop. It happens @ 20Hz.
I will suggest that you change that string of ifs to one IF and else if on everything else. Otherwise you are checking ALL of those on EVERY tick. Not good coding.
Personally, I would change it to a switch case, probably the MOST efficient way to code that as you have it, but yet being a bit lazy with working out the code.
If you wanted to get REALLY fancy, you can put all of your responses into an array. Then use math to determine if you need to increment the array pointer and say something.
As you have it written, mod 20 (modulus) will do well.
To Download my Mods, after you click the download link, select the arrow in the UPPER RIGHT. This will then, download the file to your device
oh, and you wanted to have commands to start, etc.
Remember to add ; to your code. It makes it more readable :-)
JS is a bit lazy with this, but you shouldn't be!
Change:
To: (also, I removed the extra { }. not needed...java is interpreted, so more text is bad and slower)
------------------------------------------------
Then as Saccy701 pointed out (I copied this from above and added the else cases),
//Make sure you don't put in cmd == "/start" because ingame youll have to put in "//start"
//The "cmd" is the command typed in, as in "/start" :
To Download my Mods, after you click the download link, select the arrow in the UPPER RIGHT. This will then, download the file to your device