This is a challenge where you must create a ModPE Script which implements GUI's into MCPE.
Restrictions:
1. The ModPE script must not exceed 200 lines.
2. The ModPE script must implement GUI's for at least three functions.
The aim of this challenge is to see more GUI ModPE scripts on the forums.
You just need to copy someone's GUI code and modify it. There is no way to make a GUI script look very different to other people's GUI scripts even if you know Java well. The only differences would be the size and placement of the buttons and the functions of each button.
I'm sure anybody can do this now, but this is a tutorial by byteandahalf.
var buttonWindow = null; //A window we haven't yet made
function newLevel() { //As soon as the world loads
var activity = com.mojang.minecraftpe.MainActivity.currentMainActivity.get();
//A variable we'll use later to add the button to the current MCPE activity
activity.runOnUiThread(new java.lang.Runnable({ run: function() {
//This will allow our button to run on the current UI thread of MCPE
try { //Try to create our button
buttonWindow = new android.widget.PopupWindow();
//Make our variable a usable window
var layout = new android.widget.RelativeLayout(activity);
//A layout to put into our window
var button = new android.widget.Button(activity);
//A button to put in our layout
button.setText("Press Me!");
//Write some text upon our button
button.setOnClickListener(new android.view.View.OnClickListener({
//When we press our button
onClick: function(viewarg) { //This lets our button run something
//The function() comes from activity.runOnUiThread()
Level.explode(Player.getX(), Player.getY(), Player.getZ(), 3.0);
clientMessage("This is our button!");
}
}));
layout.addView(button);//Add our button to our layout
buttonWindow.setContentView(layout);//Add our layout to our window
buttonWindow.setWidth(android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT);
buttonWindow.setHeight(android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT);
//Make our window the same size as the button within
buttonWindow.setBackgroundDrawable(new
android.graphics.drawable.ColorDrawable(android.graphics.Color.TRANSPARENT));
//The outline of our button's(The window) color
buttonWindow.showAtLocation(activity.getWindow().getDecorView(), android.view.Gravity.RIGHT | android.view.Gravity.BOTTOM, 0, 0);
//The location of our button on the screen, BOTTOM RIGHT
//The 0, 0 is the margin size, use this to push it around along those locations
}catch(problem){
print("Button could not be displayed: " + problem); //Print our error if we failed to make the button
}
}}));
}
function leaveGame() { //Get rid of it when we leave the world
var activity = com.mojang.minecraftpe.MainActivity.currentMainActivity.get();
activity.runOnUiThread(new java.lang.Runnable({ run: function() {
if(buttonWindow != null) { //If our window still exists
buttonWindow.dismiss(); //Remove it from the screen
buttonwindow = null; //Reset it
}
}}));
}
I'm sure anybody can do this now, but this is a tutorial by byteandahalf.
var buttonWindow = null; //A window we haven't yet made
function newLevel() { //As soon as the world loads
var activity = com.mojang.minecraftpe.MainActivity.currentMainActivity.get();
//A variable we'll use later to add the button to the current MCPE activity
activity.runOnUiThread(new java.lang.Runnable({ run: function() {
//This will allow our button to run on the current UI thread of MCPE
try { //Try to create our button
buttonWindow = new android.widget.PopupWindow();
//Make our variable a usable window
var layout = new android.widget.RelativeLayout(activity);
//A layout to put into our window
var button = new android.widget.Button(activity);
//A button to put in our layout
button.setText("Press Me!");
//Write some text upon our button
button.setOnClickListener(new android.view.View.OnClickListener({
//When we press our button
onClick: function(viewarg) { //This lets our button run something
//The function() comes from activity.runOnUiThread()
Level.explode(Player.getX(), Player.getY(), Player.getZ(), 3.0);
clientMessage("This is our button!");
}
}));
layout.addView(button);//Add our button to our layout
buttonWindow.setContentView(layout);//Add our layout to our window
buttonWindow.setWidth(android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT);
buttonWindow.setHeight(android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT);
//Make our window the same size as the button within
buttonWindow.setBackgroundDrawable(new
android.graphics.drawable.ColorDrawable(android.graphics.Color.TRANSPARENT));
//The outline of our button's(The window) color
buttonWindow.showAtLocation(activity.getWindow().getDecorView(), android.view.Gravity.RIGHT | android.view.Gravity.BOTTOM, 0, 0);
//The location of our button on the screen, BOTTOM RIGHT
//The 0, 0 is the margin size, use this to push it around along those locations
}catch(problem){
print("Button could not be displayed: " + problem); //Print our error if we failed to make the button
}
}}));
}
function leaveGame() { //Get rid of it when we leave the world
var activity = com.mojang.minecraftpe.MainActivity.currentMainActivity.get();
activity.runOnUiThread(new java.lang.Runnable({ run: function() {
if(buttonWindow != null) { //If our window still exists
buttonWindow.dismiss(); //Remove it from the screen
buttonwindow = null; //Reset it
}
}}));
}
Hope this helps people!
Lol thanks dude
But I already know how to use GUI, Thanks Anyways!
Restrictions:
1. The ModPE script must not exceed 200 lines.
2. The ModPE script must implement GUI's for at least three functions.
The aim of this challenge is to see more GUI ModPE scripts on the forums.
Want GUI Templates? Done!
https://github.com/BeATz-UnKNoWN/ModPE_Scripts/wiki/ModPE-Script-Templates
P.S. Feel free to follow me so you know when I post "awesome" content and make the MCForums a brighter place (totally).
If you need to contact me you can either shoot a Kik message to beatz_unknown or send an email to [email protected]
Perhaps to gui mod challenge?
The problem in doing that is the fact that there is no reward. Correct me if I'm wrong, but doesn't every challenge have to have a reward?
Want GUI Templates? Done!
https://github.com/BeATz-UnKNoWN/ModPE_Scripts/wiki/ModPE-Script-Templates
P.S. Feel free to follow me so you know when I post "awesome" content and make the MCForums a brighter place (totally).
If you need to contact me you can either shoot a Kik message to beatz_unknown or send an email to [email protected]
I am secretly a modder, who works only for himself, seldom publishes.
It would be great if you could make a function library for GUI! Also your YouTube tutorials have been really helpful. Good work!
Want GUI Templates? Done!
https://github.com/BeATz-UnKNoWN/ModPE_Scripts/wiki/ModPE-Script-Templates
P.S. Feel free to follow me so you know when I post "awesome" content and make the MCForums a brighter place (totally).
If you need to contact me you can either shoot a Kik message to beatz_unknown or send an email to [email protected]
Yeah !
Willing to work on Android apps or multi-platform games, see profile bio for information.
Founder and CEO of Temena Development
Twitter: @TemenaPE
Instagram: @ItsLiterallyMath
Want GUI Templates? Done!
https://github.com/BeATz-UnKNoWN/ModPE_Scripts/wiki/ModPE-Script-Templates
P.S. Feel free to follow me so you know when I post "awesome" content and make the MCForums a brighter place (totally).
If you need to contact me you can either shoot a Kik message to beatz_unknown or send an email to [email protected]
YES PLEASE!!!
Yes, I know, but it would be better if there where functions.
Want GUI Templates? Done!
https://github.com/BeATz-UnKNoWN/ModPE_Scripts/wiki/ModPE-Script-Templates
P.S. Feel free to follow me so you know when I post "awesome" content and make the MCForums a brighter place (totally).
If you need to contact me you can either shoot a Kik message to beatz_unknown or send an email to [email protected]
var buttonWindow = null; //A window we haven't yet made
function newLevel() { //As soon as the world loads
var activity = com.mojang.minecraftpe.MainActivity.currentMainActivity.get();
//A variable we'll use later to add the button to the current MCPE activity
activity.runOnUiThread(new java.lang.Runnable({ run: function() {
//This will allow our button to run on the current UI thread of MCPE
try { //Try to create our button
buttonWindow = new android.widget.PopupWindow();
//Make our variable a usable window
var layout = new android.widget.RelativeLayout(activity);
//A layout to put into our window
var button = new android.widget.Button(activity);
//A button to put in our layout
button.setText("Press Me!");
//Write some text upon our button
button.setOnClickListener(new android.view.View.OnClickListener({
//When we press our button
onClick: function(viewarg) { //This lets our button run something
//The function() comes from activity.runOnUiThread()
Level.explode(Player.getX(), Player.getY(), Player.getZ(), 3.0);
clientMessage("This is our button!");
}
}));
layout.addView(button);//Add our button to our layout
buttonWindow.setContentView(layout);//Add our layout to our window
buttonWindow.setWidth(android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT);
buttonWindow.setHeight(android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT);
//Make our window the same size as the button within
buttonWindow.setBackgroundDrawable(new
android.graphics.drawable.ColorDrawable(android.graphics.Color.TRANSPARENT));
//The outline of our button's(The window) color
buttonWindow.showAtLocation(activity.getWindow().getDecorView(), android.view.Gravity.RIGHT | android.view.Gravity.BOTTOM, 0, 0);
//The location of our button on the screen, BOTTOM RIGHT
//The 0, 0 is the margin size, use this to push it around along those locations
}catch(problem){
print("Button could not be displayed: " + problem); //Print our error if we failed to make the button
}
}}));
}
function leaveGame() { //Get rid of it when we leave the world
var activity = com.mojang.minecraftpe.MainActivity.currentMainActivity.get();
activity.runOnUiThread(new java.lang.Runnable({ run: function() {
if(buttonWindow != null) { //If our window still exists
buttonWindow.dismiss(); //Remove it from the screen
buttonwindow = null; //Reset it
}
}}));
}
Hope this helps people!
Yuugen0127
|MCPE Modder, Mapmaker, Mediocre Skinmaker, Update Maniac, Problem-Solver, and Texture-Pack Beginner|
Biggest Update thread for MCPE 0.12.x :
http://www.minecraftforum.net/forums/minecraft-pocket-edition/mcpe-recent-upcoming-pe-updates/2436094-minecraft-pe-the-upcoming-0-12-0-minecraft-peits
Biggest Update thread for MCPE 0.13.0 :
http://www.minecraftforum.net/forums/minecraft-pocket-edition/mcpe-recent-upcoming-pe-updates/2504717-topic-updated-minecraft-pe-the-upcoming-0-13-0
Contact: @GenBrianSuzuki (Twitter), email address on request.
Lol thanks dude
But I already know how to use GUI, Thanks Anyways!