Author Topic: How do I make an HUD from GUI element(s)?  (Read 2349 times)

PlayGUI.add(gui control);
PlayGUI.remove(gui control);

How do I know where to position it?

How do I know where to position it?
Make use of the horizSizing and vertSizing fields.
For example if you want to have something at the top of the screen and 2 pixels off the right border,
give it the position 20 0
give it the horizSizing left
give it the vertSizing bottom

It's basically the direction in which the coordinates work. left goes from right to left and right goes from left to right, bottom goes from top to bottom etc
Width scalid leaves the object at the same position but if the parent object is scaled, your object gets scaled the exact same ammount of pixels.
Relative scaling scales the position and the size of the object relative to the parent.
Play with those settings a bit (note that if you set the size of the parent in the editor, it will not work, resize or drag-scale instead)

---
Alright, cool.
Now how can I set value of textboxes to that of a variable on the server? (Cash, Bricks, etc.)

Alright, cool.
Now how can I set value of textboxes to that of a variable on the server? (Cash, Bricks, etc.)
use clientcmds.

function clientCmdSetGenericMessage(%string){genericField.setText(%string);}

use clientcmds.

function clientCmdSetGenericMessage(%string){genericField.setText(%string);}
would the server-side be this?

%cash = (cash amount or whatever)
commandToClient(%client, 'SetGenericMessage', %cash);


How do I snap the GUI to the right of the screen? It's not working.

How do I snap the GUI to the right of the screen? It's not working.
Use position: 0 0
Use horizSizing: left

Use position: 0 0
Use horizSizing: left
I already tried that.
It's too late now, I had to make it on the bottom.

If you want to put it in the wherever you want you can start from 0 and add that line of code and do some simple math.

Code: [Select]
getword($pref::Video::resolution,INDEX)


It does if you know what is going on... It seems to me like you don't exactly know where you are going with this.
« Last Edit: June 27, 2013, 08:33:24 PM by Scriode »

Do what Zeb said. It won't appear that way in the GUI editor, but press f10 to preview it and it should be snapped to the right side.

Do what Zeb said. It won't appear that way in the GUI editor, but press f10 to preview it and it should be snapped to the right side.
Doesn't work.

It looks fine in the GUI editor, but not when loaded in-game.

Doesn't work.
[img width=1000 height=562]https://dl.dropboxusercontent.com/u/96011435/Blockland_00239.png[ /img]
It looks fine in the GUI editor, but not when loaded in-game.
Code: [Select]
getword($pref::Video::resolution,INDEX)
Like I said before. That is how you will fix it if you understand how to use variables...

Like I said before. That is how you will fix it if you understand how to use variables...
I know how to use variables.
That's a very nice function you gave me, I might use it if I knew where and how.