Blockland Forums > Modification Help

[Tutorial] Creating A GUI [Updated 4/1/2012]

Pages: << < (2/12) > >>

mp7964:

Bump because this is rather helpful.

jes00:

Added a section on making a parent and added a section for GuiRadioCtrl.

mp7964:

Add something about making a custom HUD with GUIs. Like using playgui.add(GUINAME) and making the GUIs show a value, like money.

jes00:


--- Quote from: mp7964 on October 31, 2011, 06:15:29 PM ---Add something about making a custom HUD with GUIs. Like using playgui.add(GUINAME) and making the GUIs show a value, like money.

--- End quote ---
You write it, I put it in and give you credit, profit?

mp7964:

HUD GUIs.
By MP6767, for jes00's tutorial.
Usually, when making a HUD-type GUI, you use GUISwatchCtrls, GUITextCtrls, and GUIBitmapCtrls. Do NOT use a GUIWindowCtrl, or any buttonctrls.

Make a GUI and name it HUDGUITEST. Now, make a GUISwatchCtrl, recolor it, with the digits on the left, to your liking, and right-click it. This will be what a window would be on a normal GUI. Lets start out by making a simple one that shows a number. Make a GUITextCtrl in the middle of the Swatch, and name it TESTHUDTEXT. Set it to the middle of your GUI, save the GUI as test.gui and to somewhere you know you'll find it, and exit Blockland.

For now, we'll leave that GUI alone, and start the scripting aspect of it. Open up your favorite text editor and type


--- Code: ---function GUIFUNCTIONTEST(%client)
{
%lol = 25;
testhudtext.setValue(%lol);
}
--- End code ---

Now save this file as test.cs, and put it in a folder with your GUI, open up another text file in your favorite text editor, and type


--- Code: ---exec("./test.cs");
exec("./test.gui");
--- End code ---
Save this as server.cs


Almost there! Next, make a text file called description.txt, and put this

--- Code: ---Title: HUD TEST
Author: You
--- End code ---
Save that and leave it alone.

Now, open up the GUI in your favorite text editor. If it doesn't open, select it to open in whatever you use to edit text and such.
At the bottom of the file, type playGUI.add(HUDGUITEST);, and select your server.cs, test.cs, test.gui, and description.txt, and send them all to a zipped file, and name the zip server_hudtest.

Lastly, start up a server in Blockland with server_hudtest enabled. If your GUI is on your screen, you did it right. Now, open up the console (~), and type GUIFUNCTIONTEST();. Your GUI should have 25 in the middle of it now.

Congrats, you just made a HUD.

Pages: << < (2/12) > >>

Go to full version