Is it possible to run a DOS batch file via GUIButtonCtrl()?
by James Owen · in Torque Game Engine · 11/20/2004 (9:47 am) · 6 replies
Eg. I have a batch file DedicatedServer.bat
what should I put in command="***** "; below so that I can run a batch file (if possible)? Or can batch file be run in .cs file?
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "420 280";
extent = "125 20";
minExtent = "8 8";
visible = "1";
command = "****************";
helpTag = "0";
text = "Run Dedicated Server";
};
Thank you.
what should I put in command="***** "; below so that I can run a batch file (if possible)? Or can batch file be run in .cs file?
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "420 280";
extent = "125 20";
minExtent = "8 8";
visible = "1";
command = "****************";
helpTag = "0";
text = "Run Dedicated Server";
};
Thank you.
#2
You could however create a consolefunction that calls cmd("rundedicated.bat"); or whatever it is that you want to execute.
I think that is the right syntax, but I'm not sure how the application will react when you run this. I think it will keep going until the dedicatedserver.bat is dead and that could take a while. Might be worth looking into if that's what you want to do.
11/20/2004 (2:19 pm)
James Owen, as Gonzo said you can create a dedicated server with much less effort and have it look cleaner and more controllable.You could however create a consolefunction that calls cmd("rundedicated.bat"); or whatever it is that you want to execute.
I think that is the right syntax, but I'm not sure how the application will react when you run this. I think it will keep going until the dedicatedserver.bat is dead and that could take a while. Might be worth looking into if that's what you want to do.
#3
Exec ("dedicatedserver.cs");
consolefunction ds() {
cmd ("rundedicated.bat");
}
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "420 280";
extent = "125 20";
minExtent = "8 8";
visible = "1";
command = "ds()";
helpTag = "0";
text = "Run Dedicated Server";
};
Also, any way to kill the batch file in the GUI interface via buttons?
Thanks for the suggestions.
11/20/2004 (2:39 pm)
Basically, I want to allow player the ability to choose the map they want to run as a dedicated server through a GUI interface. Would it be right to say I need to create a dedicatedserver.cs file with the following code?Exec ("dedicatedserver.cs");
consolefunction ds() {
cmd ("rundedicated.bat");
}
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "420 280";
extent = "125 20";
minExtent = "8 8";
visible = "1";
command = "ds()";
helpTag = "0";
text = "Run Dedicated Server";
};
Also, any way to kill the batch file in the GUI interface via buttons?
Thanks for the suggestions.
#4
I still don't think you want to do it this way. Take a look at the createServer(); scripts of the demo, you can do exactly what you want from there :) It's really easy when you find the function and start playing around with it.
Good luck!
Edit: I'm pasting some script-code.. sec.
Alright. Make a button which calls a function. And place something like this inside the function:
That should get you started. Make sure you enabled the consoleWindow if that's what you want too.. I think that is enableWinConsole(true);
11/20/2004 (3:10 pm)
No. To call a cmd you need to do it through C++ and the source of Torque Game Engine.I still don't think you want to do it this way. Take a look at the createServer(); scripts of the demo, you can do exactly what you want from there :) It's really easy when you find the function and start playing around with it.
Good luck!
Edit: I'm pasting some script-code.. sec.
Alright. Make a button which calls a function. And place something like this inside the function:
destroyServer(); portInit($Pref::Server::Port); allowConnections(true); onServerCreated(); $ServerGroup = new SimGroup(ServerGroup); loadMission(%mission, true);
That should get you started. Make sure you enabled the consoleWindow if that's what you want too.. I think that is enableWinConsole(true);
#5
11/21/2004 (1:29 pm)
Thanks Stefan Lundmark, that helps :)
#6
11/25/2004 (4:28 am)
Kinda kills the cross platform effect ....
Torque Owner Gonzo T. Clown