PDA

View Full Version : AssertMsg



RobsoN
17th October 2013, 17:28
if(self.pers["team"] == team)
{
AssertMsg("Moving "+self.name+ " to same team! "+team);
iprintln("Moving "+self.name+ " to same team! "+team);
return;
}
[18:24] RobsoN: and i need to check where is my script called, because i don't know why my script is switching team twice
[18:25] RobsoN: so i wanted to use assertmsg to get the call info
[18:25] RobsoN: and i can see iprintln in console, but no errors from assertmsg


Im on developer 1, logfile 1.

Tally
17th October 2013, 18:03
You need to actually throw an error before it will print:


assertmsg( <message> )


ModuleDebug


Summary

throws a script error with the given message



Example

assertmsg ( "There is no enemy is sight!!" );

RobsoN
17th October 2013, 18:44
I'm sorry but I can't understand

serthy
17th October 2013, 18:50
fires script error:

assert( false );
assertEx( false , "ERROR" );
assertMsg( true , "ERROR" );

everything OK:

assert( true );
assertEx( true , "ERROR" );
assertMsg( false , "ERROR" );

RobsoN
17th October 2013, 19:09
None of them work :(.

serthy
17th October 2013, 19:14
Then youre not in developer mode.

RobsoN
17th October 2013, 19:41
Im in.


]developer
"developer" is: "2" default: "0"
Domain is any integer from 0 to 2

serthy
17th October 2013, 20:00
my startparameters:
CoD2MP_s.exe +set dedicated 2 +set fs_game serthywars_002 +exec server.cfg +set developer 1

tested and everything is running just fine

RobsoN
17th October 2013, 20:44
Which version of CoD are you running?

serthy
17th October 2013, 20:59
10characters 1.2

Tally
17th October 2013, 22:14
fires script error:

assert( false );
assertEx( false , "ERROR" );
assertMsg( true , "ERROR" );

everything OK:

assert( true );
assertEx( true , "ERROR" );
assertMsg( false , "ERROR" );

AssertMsg() only has 1 argument. Not 2. Only AssertEx() has 2 arguments.

RobsoN
2nd December 2013, 23:09
Sorry for refreshing, but I found solution which can be usefull for other new scripters.

You have to have "developer_script" cvar set to 1 if you want to use assert , assertMSG or assertEx.

Tally
3rd December 2013, 10:18
Sorry for refreshing, but I found solution which can be usefull for other new scripters.

You have to have "developer_script" cvar set to 1 if you want to use assert , assertMSG or assertEx.

Yes, they are all in the "debug" section of the script documentation. All debug items are developer functions, and as such, need to have developer_script enabled. I thought every one knew that.