Two things I can't get to work
by __._ · in Torque Game Engine · 05/02/2007 (7:38 am) · 9 replies
Hello everyone,
I'm currently trying to get two things to work within Torque, but it's giving me a headache. I am building my project on the racer-starterkit, and would like to remove the chatbox you see in the top-left corner. I know it's the file "MainChatHud.gui" but if I modify this file, either by text or by the GUI-editor, it somehow gets reset by Torque. If I edit the GUI to be empty (quick fix) and close the GUI-editor, it's gone, but if I restart Torque, it somehow comes back again... How can I get rid of this part of the GUI ?
Second problem I have is with my flyingvehicle. At some points the player should not be able to control the plane, e.g. at the start, and during some cutscenes. The following link mentions the parameter "disableMove", but for some reason it's not working. Simply does nothing.
http://tdn.garagegames.com/wiki/Torque_Console_Objects_3#FlyingVehicle
What did I do wrong?
Thanks in advance.
I'm currently trying to get two things to work within Torque, but it's giving me a headache. I am building my project on the racer-starterkit, and would like to remove the chatbox you see in the top-left corner. I know it's the file "MainChatHud.gui" but if I modify this file, either by text or by the GUI-editor, it somehow gets reset by Torque. If I edit the GUI to be empty (quick fix) and close the GUI-editor, it's gone, but if I restart Torque, it somehow comes back again... How can I get rid of this part of the GUI ?
Second problem I have is with my flyingvehicle. At some points the player should not be able to control the plane, e.g. at the start, and during some cutscenes. The following link mentions the parameter "disableMove", but for some reason it's not working. Simply does nothing.
http://tdn.garagegames.com/wiki/Torque_Console_Objects_3#FlyingVehicle
for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ )
{
%cl = ClientGroup.getObject( %clientIndex );
%cl.disableMove = 1;
}What did I do wrong?
Thanks in advance.
#2
Also you might delete all the DSO's after, just in case. It probably won't help, but it shouldn't hurt either! :)
05/02/2007 (1:25 pm)
You might be forgetting to "save" the changed GUI in the editor before closing it. (By default it doesn't save automatically which seems OK, but it also doesn't warn you that you are losing work either.)Also you might delete all the DSO's after, just in case. It probably won't help, but it shouldn't hurt either! :)
#3
The player is created by
So I figured my previous code should be
but it didn't work either. Even %player.disableMove = 1; in the function that creates the player doesn't affect it.
05/03/2007 (3:36 am)
THanks for the replies. Yes I'm positive I saved the GUI, but Tim Heldna's answer solved it. The 2nd part still won't work for me though. The player is created by
%player = new FlyingVehicle() {
dataBlock = UitvindersToestel;
client = %this;
};
...
// Give the client control of the player
%this.player = %player;So I figured my previous code should be
for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ )
{
%cl = ClientGroup.getObject( %clientIndex );
%cl.player.disableMove = 1;
}but it didn't work either. Even %player.disableMove = 1; in the function that creates the player doesn't affect it.
#4
I'm not sure I like the way you're obtaining the vehicle/player's ID. Have you tried using an echo to determine what %cl is returning? Other than that, the code looks ok.
05/03/2007 (4:03 am)
Ok, I didn't realize you were spawning as a flyingVehicle.I'm not sure I like the way you're obtaining the vehicle/player's ID. Have you tried using an echo to determine what %cl is returning? Other than that, the code looks ok.
#5
05/03/2007 (7:17 am)
That bit of code was in the starter-kit already, I just kept it in. Echoing cl gives me the number 1494. If I type 1494.diableMove = 1; in the console, it works just fine. Thats why I figured %cl.disableMove = 1; would work as well.. which ofcourse we now know it doesnt.
#6
05/03/2007 (7:42 am)
Well if the variable is collecting the right value and it works from the console I can't see why it isn't working from script?
#7
echo(%cl); --> gives 1494
%cl.disableMove = 1;
echo(%cl.disableMove); --> gives 1
But at this point the player can still move.
echo(1494.disableMove); --> gives 0 still
1494.disableMove = 1; --> Disables movement properly, but I can't script it this way, as I don't know the ID in advance..
I hope you can tell me why it's happening like this
05/03/2007 (9:47 am)
Hmm well, after eco-ing some more data, this is what's going on:echo(%cl); --> gives 1494
%cl.disableMove = 1;
echo(%cl.disableMove); --> gives 1
But at this point the player can still move.
echo(1494.disableMove); --> gives 0 still
1494.disableMove = 1; --> Disables movement properly, but I can't script it this way, as I don't know the ID in advance..
I hope you can tell me why it's happening like this
#8
--What member variable disableMove is mapped to in the ::initPersistFields() method
--how is this member variable used in the source code.
That will tell you at least if the expected use of the field is how you are using it, and give you a place to start debugging the physics code itself for the vehicle.
05/03/2007 (10:18 am)
You should search the source code of the class to see a couple of things:--What member variable disableMove is mapped to in the ::initPersistFields() method
--how is this member variable used in the source code.
That will tell you at least if the expected use of the field is how you are using it, and give you a place to start debugging the physics code itself for the vehicle.
#9
05/05/2007 (5:46 am)
Well before any changes, the %cl.player has a value asociated to disableMove, and is 0 by default. But setting it to 1 doesn't affect the player at all.
Torque Owner Tim Heldna
client/scripts/playGui.cs
function PlayGui::onWake(%this) { // Turn off any shell sounds... // alxStop( ... ); $enableDirectInput = "1"; activateDirectInput(); [b]// Message hud dialog[/b] [b]Canvas.pushDialog( MainChatHud );[/b] [b]chatHud.attach(HudMessageVector);[/b] // just update the action map here moveMap.push(); // hack city - these controls are floating around and need to be clamped schedule(0, 0, "refreshCenterTextCtrl"); schedule(0, 0, "refreshBottomTextCtrl"); canvas.pushDialog(playerHUD); } function PlayGui::onSleep(%this) { [b]Canvas.popDialog( MainChatHud );[/b] // pop the keymaps moveMap.pop(); canvas.popDialog(playerHUD); }Remove the entries I marked in bold. Then just nuke the chatHud.cs, chatHud.gui, messageHud.cs and mainChatHud.gui files and/or stop them from being executed in client/init.cs.
Comment out or remove these lines from client/init.cs:
exec("./ui/ChatHud.cs"); exec("./ui/ChatHud.gui"); exec("./ui/messageHud.cs"); exec("./ui/mainChatHud.gui");2) You're supposed to use the disableMove function on the flyingVehicle and not the client.