Issue with code (Maybe it could be beta 1.1?)
by Bob Mann · in Torque 3D Professional · 01/21/2011 (9:08 pm) · 9 replies
My game crashes (Server and client) when I try to run this.
Code down below.
About the author
#3
01/22/2011 (11:25 am)
Ok, what files are you putting the code into so I can duplicate it?
#4
01/22/2011 (11:26 am)
popDialog (D) in uppercase?
#5
01/22/2011 (11:43 am)
Also check the case on OpenForWrite.
#6
01/22/2011 (12:05 pm)
It's been so long since I have done anything in TS that I forgot that only variables are not case sensitive. But I would think he would see a compile issue in the console log about it.
#7
01/22/2011 (12:28 pm)
it would probably not error and crash at the point of calling up the function. unless break points were echo'd in at each stage. My bet is the case.
#8
01/22/2011 (2:08 pm)
If its not throwing up basic errors then he must be using a release build, the debug build barfs almost everything to the log.
#9
01/24/2011 (7:32 pm)
Update: Working code.//client
function ReportPlayer(%client)
{
// Make the variables nice and short
%p = $reportplayer;
if($debug >= 2)
{
echo("Client > Report Player > Get Varaibles");
}
// Check to make sure nothing is blank
if(getSubStr(%p, 0, 1) $= "")
{
MessageBoxOK("Error", " Please give a player name!");
error("Report Failed :: No name given!");
return;
}
warn("Sending player report to server! Player : " @ %p @ " !");
// ServerCMD and close the GUI
commandToServer('ReportPlayer', %p, %d);
canvas.popdialog(ReportGui);
}
//server
function serverCmdReportPlayer(%client, %p, %d)
{
// Write new file for report!
echo("Writing player report to database. Player :" @ %p @ "!");
%file = new FileObject();
%file.openforWrite("database/reports/" @ %p @ ".txt");
%file.writeLine("Player Name: " @ %p @ "");
//%file.writeLine("Details: " @ %d @ "");
%file.close();
%file.delete();
echo("Report saved");
}
Torque Owner Ryan Mick
Red Witch Entertainment