Blockland Forums > Modification Help
GUI Scroll Control & Variable
Aware:
Hello, I have a couple of problem I am attempting to find, they all include GUIs.
I am realy new to GUI makeing, and I am making a personal RPG mod.
-----------------------------------------------------------
* How do you use Scroll Control?-----------------------------------------------------------
* How do you make it so when you press a button, the window gives different Text.-----------------------------------------------------------
* How do you make it so you can give the number on a Variable.
Eg.
If egg = 1, (text) Egg: 1
If egg = 2, (text) Egg: 2 -----------------------------------------------------------
* How do you make it so an image and text only appear if you have a Variable greater than 0.-----------------------------------------------------------
jes00:
--- Quote from: Aware on December 28, 2011, 10:32:50 PM --------------------------------------------------------------
* How do you use Scroll Control?-----------------------------------------------------------
--- End quote ---
Look HERE
--- Quote from: Aware on December 28, 2011, 10:32:50 PM --------------------------------------------------------------
* How do you make it so when you press a button, the window gives different Text.-----------------------------------------------------------
--- End quote ---
In the function called by the button put the following code
--- Code: ---CONTROL_NAME.setText("TEXT_HERE");
--- End code ---
--- Quote from: Aware on December 28, 2011, 10:32:50 PM --------------------------------------------------------------
* How do you make it so you can give the number on a Variable.
Eg.
If egg = 1, (text) Egg: 1
If egg = 2, (text) Egg: 2 -----------------------------------------------------------
--- End quote ---
You could do something like
--- Code: ---function GUINAME::onWake(%client)
{
if(%client.Egg == 1)
{
CONTROL_NAME.setText("Egg: 1");
}
else if(%client.Egg == 2)
{
CONTROL_NAME.setText("Egg: 2");
}
}
--- End code ---
Or you could do something like this
--- Code: ---function GUINAME::onWake(%client)
{
CONTROL_NAME.setText("Egg: " @ %client.Egg);
}
--- End code ---
Aware:
Thank you.
I think I can figure it out now.
My main problem is this parenting crap. No tutorial tells you how to parent it to somthing other than just right click.
jes00:
--- Quote from: Aware on December 29, 2011, 11:18:37 AM ---My main problem is this parenting crap. No tutorial tells you how to parent it to somthing other than just right click.
--- End quote ---
Right click a control in the menu and add a new control, that control you right clicked is now the parent of the new control you made.
The reason for parenting is for example if you parent something to a window and you move the window then all the window's children will move too. there are also other uses for parenting.
Aware:
Oh I scanned you tutorial just now and found it.