Then make the button change a global variable like this
var active = 0;
//inside of the onClick function that you want to turn it on
var active = 1;
//inside of the onClick function that you want to turn it off
var active = 0;
function modTick(){
while(active == 1){
//code to be executed when it is active
}
}
/*a while statement will run a block of code while the statement is equal to the condition
while(statement == condition){
run this code
}
*/
That is quite finicky though, cause it is counting down then resetting then doing it again and also setting 2 variables, it will be a lot quicker to use a while statement the shortest possible way would probably be something like
var a = 0;
function modTick(){
while(a == 1){
//run code
}}
I don't understand how to put it in a switch I'm new to all of this
If you don't have any experience in JavaScript you won't really be able to make a switch because they are coded in Java, you need to learn the basics before you learn the advanced stuff, the code for making a button alone (if it is compacted) is around 35 lines
If you don't have any experience in JavaScript you won't really be able to make a switch because they are coded in Java, you need to learn the basics before you learn the advanced stuff, the code for making a button alone (if it is compacted) is around 35 lines
My menu has over 1K lines of code it's featured on MCPE HUB (AJModsMCPE) I used droid Dex template but everything I try just fails when it comes to that I'm going to try something new I haven't hope it works
That's why, you are using an app to generate code rather then scripting it all your self, go on you tube and look up arjay07 he has some good tutorials for gui
That's why, you are using an app to generate code rather then scripting it all your self, go on you tube and look up arjay07 he has some good tutorials for gui
Lol I'm not using an app I'm not that much of a skid YouTube DroidDex I'm using that base you start with like 400 lines of code I'm nearly at 2K now I'm using DroidEdit to code it all and I figured it out I already had a modTick in my menu (in auto update) now I got it all working I'm having problems with 2 codes atm and 1 crashes (super jump kills me when lands it's only a 5 block jump even if I'm in God mode and have no fall dmg) instant kill gives me errors and sends me to a different part of my menu and instant mine just crashes when turned on :/
Thats what I mean tho, you are using a premade code as a base template, also fall damage can't be prevented in js as far as I am aware, a patch can however
Thats what I mean tho, you are using a premade code as a base template, also fall damage can't be prevented in js as far as I am aware, a patch can however
Give me a few mins and I'll PM you my private update with no fall damage
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I want to add a switch to my menu but idk how to use modtick I want an effect to Keep hapining over and over in till turned off
Depends on how you want the code to be executed, but you use a mod tick like any other function
modTick(){ //code here will be executed 20 times per second }I have a player effect function and I want it to turn on and repeat after button the switch and turn off when I re hit switch
Then make the button change a global variable like this
var active = 0; //inside of the onClick function that you want to turn it on var active = 1; //inside of the onClick function that you want to turn it off var active = 0; function modTick(){ while(active == 1){ //code to be executed when it is active } } /*a while statement will run a block of code while the statement is equal to the condition while(statement == condition){ run this code } */var isActive = false;
var tick = 600;
function modTick() {
if(isActive) tick--;
// EDIT! Repeat
if(tick == 0) tick = 600;
}
^ this will only run when you switch on
That is quite finicky though, cause it is counting down then resetting then doing it again and also setting 2 variables, it will be a lot quicker to use a while statement
the shortest possible way would probably be something like
var a = 0; function modTick(){ while(a == 1){ //run code }}I don't understand how to put it in a switch I'm new to all of this
If you don't have any experience in JavaScript you won't really be able to make a switch because they are coded in Java, you need to learn the basics before you learn the advanced stuff, the code for making a button alone (if it is compacted) is around 35 lines
My menu has over 1K lines of code it's featured on MCPE HUB (AJModsMCPE) I used droid Dex template but everything I try just fails when it comes to that I'm going to try something new I haven't hope it works
That's why, you are using an app to generate code rather then scripting it all your self, go on you tube and look up arjay07 he has some good tutorials for gui
Lol I'm not using an app I'm not that much of a skid YouTube DroidDex I'm using that base you start with like 400 lines of code I'm nearly at 2K now I'm using DroidEdit to code it all and I figured it out I already had a modTick in my menu (in auto update) now I got it all working I'm having problems with 2 codes atm and 1 crashes (super jump kills me when lands it's only a 5 block jump even if I'm in God mode and have no fall dmg) instant kill gives me errors and sends me to a different part of my menu and instant mine just crashes when turned on :/
Thats what I mean tho, you are using a premade code as a base template, also fall damage can't be prevented in js as far as I am aware, a patch can however
Give me a few mins and I'll PM you my private update with no fall damage