|
|
Member
Total posts: 8
Joined: Jul 26, 2015
|
I built chatscript with the following options on windows:
#define DISCARDSERVER 1
#define DISCARDSCRIPTCOMPILER 1
#define NOMAIN 1
I’m starting it with InitSystem followed by InitStandalone.
PerformChat is then returning responses, but chatscript is also writing to stdout or stderr somehow. It just flashes the console window for a split second can’t even see what it’s saying, assuming it’s the output.
How can I prevent chatscript from ever writing to stderr/stdout?
Also, under VS 2013 I had to fix some issues with converting to and from ANSI/UNICODE. Assuming the author isn’t compiling on a modern MS windows SDK?
|
|
|
|
|
Posted: Jul 26, 2015 |
[ # 1 ]
|
|
Moderator
Total posts: 2372
Joined: Jan 12, 2010
|
what version of CS are you using. InitStandalone nowadays is part of initsystem. You would not call it separately.
CS accepts UTF8 input. It does not accept ANSI/UNICODE.
|
|
|
|
|
Posted: Jul 26, 2015 |
[ # 2 ]
|
|
Member
Total posts: 8
Joined: Jul 26, 2015
|
I’m using VS 2013 community edition. Most of the string issues were with MS functions that I guess now take wide strings where they didn’t use to? I fixed them with some simple casts.
|
|
|
|
|
Posted: Jul 26, 2015 |
[ # 3 ]
|
|
Moderator
Total posts: 2372
Joined: Jan 12, 2010
|
No. What version of ChatScript are you using?
|
|
|
|
|
Posted: Jul 26, 2015 |
[ # 4 ]
|
|
Member
Total posts: 8
Joined: Jul 26, 2015
|
|
|
|
|
|
Posted: Jul 26, 2015 |
[ # 5 ]
|
|
Moderator
Total posts: 2372
Joined: Jan 12, 2010
|
But the documentation for 5.5 says to call initsystem. It makes no mention of calling InitStandalone.
|
|
|
|
|
Posted: Jul 26, 2015 |
[ # 6 ]
|
|
Member
Total posts: 8
Joined: Jul 26, 2015
|
That’s really a side issue had zero effect on what I’m trying to fix. I was just following the links on sourceforge for the docs, didn’t notice they were out of date.
|
|
|
|
|
Posted: Jul 26, 2015 |
[ # 7 ]
|
|
Moderator
Total posts: 2372
Joined: Jan 12, 2010
|
I don’t know. I define #NOMAIN 1 and added this just before the main program and watched the console output. I saw no extraneous output
#ifdef NOMAIN
int main(int argc, char* argv[])
{
InitSystem(argc,argv);
char answer[10000];
while (1)
{
PerformChat("bob","","help me",NULL,answer);
printf("%s\r\n",answer);
}
}
#endif
|
|
|
|
|
Posted: Jul 26, 2015 |
[ # 8 ]
|
|
Member
Total posts: 8
Joined: Jul 26, 2015
|
Is there any way CS would write to stdout/stderr if I’m doing something wrong? I’m pretty new to CS so that would be entirely possible. Or maybe a combination of args to InitSystem that might cause it?
My code is basically the same as yours. I have swig in the mix but I just bypassed swig and still got the same console popping up. One for every call to PerformChat.
|
|
|
|
|
Posted: Jul 26, 2015 |
[ # 9 ]
|
|
Moderator
Total posts: 2372
Joined: Jan 12, 2010
|
What args are you passing into InitSystem? CS doesn’t write to stderr at all. It writes to stdout during logging if echoing has been requested. What do you get in the console? Is it like a line in the user log file?
|
|
|
|
|
Posted: Jul 26, 2015 |
[ # 10 ]
|
|
Moderator
Total posts: 2372
Joined: Jan 12, 2010
|
Try an argument of “nouserlog” and see what happens
|
|
|
|
|
Posted: Jul 27, 2015 |
[ # 11 ]
|
|
Member
Total posts: 8
Joined: Jul 26, 2015
|
I think the problem stems from a bug in the path handling for windows. CS definitely is throwing up a console, it got stuck in a loop printing to the console when I passed in a bad path to InitSystem complaining about something already existing. They went so fast I couldn’t get the exact words. So I’m assuming it’s doing the same elsewhere. There is no other explanation, there is no path in my code that prints to the console.
I added a log statement to WalkDirectory in os.cpp and the output was this:
No such directory C:/game_development/work/chatscript/Assets/chatscript/LIVEDATA/ENGLISH/*
if (hFind == INVALID_HANDLE_VALUE)
{
Log(SERVERLOG, "No such directory %s\n", DirSpec);
printf ("No such directory %s\n", DirSpec);
return;
}
|
|
|
|
|
Posted: Jul 27, 2015 |
[ # 12 ]
|
|
Moderator
Total posts: 2372
Joined: Jan 12, 2010
|
since you have the ability to compile/modify source, you have the lead. I have no idea what went wrong in your world.
the system will echo out bugs…. so if you have a bug, you might indeed get a console complaint.
|
|
|
|
|
Posted: Jul 27, 2015 |
[ # 13 ]
|
|
Member
Total posts: 8
Joined: Jul 26, 2015
|
Found the issue. It’s when it’s trying to execute talk.vbs. In an embedded environment this is going to fail more often then not.
|
|
|
|
|
Posted: Jul 27, 2015 |
[ # 14 ]
|
|
Moderator
Total posts: 2372
Joined: Jan 12, 2010
|
not that that explains why you got console output. but at least you have solved your problem
|
|
|
|
|
Posted: Jul 27, 2015 |
[ # 15 ]
|
|
Member
Total posts: 8
Joined: Jul 26, 2015
|
Yes it does. CS tries to execute talk whether it’s in the path or not, which will open a command window if the application isn’t a console app itself.
|
|
|
|