.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   HPB_bot (http://forums.bots-united.com/forumdisplay.php?f=35)
-   -   Beginner / noob - need help :/ (http://forums.bots-united.com/showthread.php?t=2175)

Kn@rF 02-07-2004 07:54

Beginner / noob - need help :/
 
I figured i'd start making a bot, now i've spent the last 4 hours reading about HPB, and playing around in MSVS.

I want to make a bot for the mod NS (Natural-Selection)
I used the exports.c, and removed the dublicates, added it to linkfunc.cpp

next I added
Quote:

else if (strcmpi(mod_name, "nsp") == 0)
{
mod_id = NSP_DLL; #ifndef __linux__
// test if the game DLL file is NOT available outside of the Steam/PAK cache
if (access("nsp/dlls/ns.dll", 0) == -1)
{
filebuf = LOAD_FILE_FOR_ME ("dlls/ns.dll", &filesize);
filep = fopen ("nsp/dlls/ns.dll", "wb");
if (filep != NULL)
{
fwrite (filebuf, 1, filesize, filep); // if in cache, then extract it fclose (filep);
}
}
h_Library = LoadLibrary("nsp/dlls/ns.dll");
#else
h_Library = dlopen("nsp/dlls/ns_i386.so", RTLD_NOW);
#endif
}
to the h_export.cpp

and in bot.h I added #define NSP_DLL 6

so far so good, I then compiled the DLL file

changed the liblist.gam to the name of the DLL

opened NS, created a server. and puff back to the desktop :/

Is there any way i can get error logs or something :/ or do someone know what might be wrong? :)

Whistler 02-07-2004 09:15

Re: Beginner / noob - need help :/
 
change all the "ALERT(at_error, "blahblah")" to make it log into a file.

Kn@rF 02-07-2004 15:35

Re: Beginner / noob - need help :/
 
Quote:

Originally Posted by Whistler
change all the "ALERT(at_error, "blahblah")" to make it log into a file.

Would you mind explaining a bit more precise what I should do?
I have no idea on how I can make it to log into a file :)

botman 02-07-2004 16:03

Re: Beginner / noob - need help :/
 
Code:

FILE *fp = fopen("logfile.txt", "a");
 fprintf(fp, "Insert Error Message Here!!!\n");
 fclose(fp);

If you don't know standard C I/O routines like 'fopen', 'fprintf', or 'fclose', search for them on google.com.

botman

Pierre-Marie Baty 02-07-2004 16:54

Re: Beginner / noob - need help :/
 
run a dedicated server and tie the bot DLL to the MSVC debugger... then set breakpoints on the critical functions such as GetEntityAPI() and GiveFnptrsToDll()
It'll tell you what's wrong since you'll be able to *see* how the code performs

Kn@rF 02-07-2004 17:34

Re: Beginner / noob - need help :/
 
Quote:

Originally Posted by Pierre-Marie Baty
run a dedicated server

Should the server load the bot DLL here, or the standard .dll file ?

Quote:

Originally Posted by Pierre-Marie Baty
and tie the bot DLL to the MSVC debugger...

Could you explain this a little more precisely? :)

Pierre-Marie Baty 02-07-2004 18:25

Re: Beginner / noob - need help :/
 
http://racc.bots-united.com/msvc-debug-howto.png
A picture is worth a thousand words... :)

Of course the server should load the bot DLL
And of course, the bot DLL should be compiled in DEBUG mode.

Then instead of starting the HL server the normal way, click on the "start debug" (F5) button in the MSVC toolbar. This will launch the server for you. Don't forget to set a few breakpoints before :)

Kn@rF 07-07-2004 20:52

Re: Beginner / noob - need help :/
 
the first thing that happens is that it says one or more breakpoints hav ebeen disabled, then it shows a dissasembly window :>tried to step into and so on, but can't figure out what is wrong :/

Pierre-Marie Baty 08-07-2004 01:36

Re: Beginner / noob - need help :/
 
That's because you haven't compiled in debug mode, the debug symbols are not enabled. Normally in place of these assembly codes you would see your C/C++ code if it was compiled with debug symbols.

To enable that you must set the appropriate options in the "C/C++" and "Link" tabs of your project settings (in the same window as the screenshot I posted above)

Kn@rF 09-07-2004 18:45

Re: Beginner / noob - need help :/
 
Would you mind cutting it out in pieces what I should do, under debug I have added what I need, apparently I can't figure out the other parts, C/C++ should be set to optimizations (Default), and link to (debug) Is this correct?


All times are GMT +2. The time now is 16:51.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.