Game Development Community

Moving GUI Controls via TorqueScript

by joshdb · in Torque Game Engine · 01/22/2007 (9:55 am) · 6 replies

Is there a way to move GUI controls via TorqueScript? If there's a function a la SetPos(ControlName,x,y) it would be killer - I just can't find it anywhere in the documentation.

#1
01/22/2007 (11:24 am)
%control.setPosition(x, y) should do the trick.
#2
01/23/2007 (3:57 pm)
Alright, cool. Thanks a lot... I figured there would be something like this, I just couldn't find it.
#3
01/24/2007 (1:56 pm)
Alright, can anyone tell me why this code locks up my screen? I can use AltimitBar.setPosition(200, 200); in the console and it works fine, but it won't work through a .gui script.

//--- OBJECT WRITE BEGIN ---
new GuiBitmapCtrl(Boot) {
canSaveDynamicFields = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "0 0";
Extent = "1024 768";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
wrap = "0";

new GuiBitmapCtrl(AltimitBar) {
canSaveDynamicFields = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "0 0";
Extent = "1280 190";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
bitmap = "~/data/ui/images/AltimitBar.png";
wrap = "0";
};
};
//--- OBJECT WRITE END ---

// ... More code here ... Irrelevant

Canvas.setContent( Boot );

AltimitBar.setPosition(200, 200); // This is just test code to test if the command works at all - Which it doesn't

for($y=190; $y < 900; $y++) {
AltimitBar.setPosition(0, $y);
}
#4
01/24/2007 (3:26 pm)
Isn't "Altimit" the name of the OS used in the .Hack// series?
#5
01/24/2007 (4:01 pm)
AltimitBar.setPosition(200, 200); should work, but....

Quote:for($y=190; $y < 900; $y++) {
AltimitBar.setPosition(0, $y);
}

That looks like a VERY bad idea. This will just run the code uninterrupted without updating anything. You really want to do this with a schedule and not in a loop.
#6
01/25/2007 (9:08 am)
Quote:Isn't "Altimit" the name of the OS used in the .Hack// series?

Yep, it is. I'm not sure really what I'm doing yet, but I was just planning primarily on making a really cool animated GUI. It looks good but isn't animated yet.

I'm not sure if I'll replicate the .Hack// series games, but everyone's told me not to dream big at first - So I'm taking things one at a time.

I'll trry putting it in a schedule and post more later.