Game Development Community

Console functions not recognized

by Chris Calef · in Torque Game Engine · 12/15/2003 (11:05 am) · 3 replies

I must be doing something wrong, but from everything I've read in this forum and everywhere else, it appears that all I have to do to make a console function available in the game is declare it in a .cs file and execute the file.

This works for me some of the time, but it is inconsistent. For example, in trying to apply the "slightly advanced bot scripting" tutorial by Stefan Beffy Moises, I can't seem to find anywhere in the whole project that I can put the function addBot() such that I can type it in at the console. Everywhere I put it, I get "cannot find function addBot()" when I try to use it. I've had similar problems with other functions in the past, but other times I can write new functions and use them.

addBot() doesn't even work when it is declared right after serverCmdAddBot() in fps/server/scripts/commands.cs, and serverCmdAddBot() works great every time from the console.

I tried deleting all of the .dso files to do a fresh "make" and even that didn't work. Has anyone else experienced this kind of behavior or have any ideas for me to try? This issue is definitely slowing me down! :-(

thanks very much
chris

#1
12/15/2003 (11:11 am)
Chris,

Have you checked the console.log for errors? search for string similar to the following

>>> Advanced script error report

You might have an error in your function

-Ron
#2
12/15/2003 (11:19 am)
Yea to put it simply..

say we have

function AddBot()
{
%somecode=0;
}

found in file:
addbot.cs


we can locate for example:
../server/scripts/main.cs

and notice all the
exec(filename);

add your filename to a line like this.

read the console output when this file is executed.
it will tell you if your code is failing.
#3
12/15/2003 (3:19 pm)
Thanks, Ron, that was it. Sigh, don't forget to look at console.log! :-P