Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Technical Support » Other » new fds bot, c++ php, perl
Re: new fds bot, c++ php, perl [message #207993 is a reply to message #207285] Fri, 14 July 2006 00:35 Go to previous messageGo to next message
dead6re is currently offline  dead6re
Messages: 602
Registered: September 2003
Karma: 0
Colonel
Most regulators read the information the FDS & and SSAOW from the renlog_<date>.txt because that used to be the only way.

Let all your wishes be granted except one, so you will still have something to strieve for.
Re: new fds bot, c++ php, perl [message #208029 is a reply to message #207285] Fri, 14 July 2006 06:03 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
are there any other ways? what i would prefer is a program would detect output and issues the command in cmd:#

outputprogram > mybot

this way, outputprogram would normally print to the console what has been said in renegade. instead it goes to mybot. but if there is a better way, you are the experts! im not very good at using data streams.

ty, dan
Re: new fds bot, c++ php, perl [message #208257 is a reply to message #207285] Sat, 15 July 2006 16:16 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
i will, use the way you said. but is there a way to "stream" the file to my program or do i just keep reading it in a loop untill it changes?
Re: new fds bot, c++ php, perl [message #208305 is a reply to message #207285] Sat, 15 July 2006 21:26 Go to previous messageGo to next message
cmatt42 is currently offline  cmatt42
Messages: 2057
Registered: July 2004
Karma: 0
General (2 Stars)
Holy shit, many double posts.

[Updated on: Sat, 15 July 2006 21:27]

Report message to a moderator

Re: new fds bot, c++ php, perl [message #208347 is a reply to message #207285] Sun, 16 July 2006 02:33 Go to previous messageGo to next message
dead6re is currently offline  dead6re
Messages: 602
Registered: September 2003
Karma: 0
Colonel
There are two different methods for reading the renlog file.

BRenBot reads the log file be recording the line number that it is on and runs until the EOF. Then it waits a little while and then continues reading the file from the last line number to the EOF.

The other method is to copy the logfile to your Regulator directory and read the logfile.

Copy -> Read -> Wait for Renlog to get some info -> GoTo Start


Let all your wishes be granted except one, so you will still have something to strieve for.
Re: new fds bot, c++ php, perl [message #208365 is a reply to message #207285] Sun, 16 July 2006 06:32 Go to previous messageGo to next message
Nightma12 is currently offline  Nightma12
Messages: 2593
Registered: August 2003
Karma: 0
General (2 Stars)
Category Moderator
read entire log file to memory

delete it

parse it....

wait for a new log file to appear

repeat above ^^^^
Re: new fds bot, c++ php, perl [message #208397 is a reply to message #207285] Sun, 16 July 2006 10:32 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
thx, i never thought of that. at first i was going to read the file over and over untill it changes, but i thought that it will take alot of prosccessing power for and fast loop like that. the way you said is how i will do it, i will post again when i have some luck.

ty dan.

BTW: i will be crediting all the people that have help me on this project in the source file and as a hardcoded auto-anounce. Wink

you really have helped me alot.

EDIT: i will be posting some source soon, maby in 2 weeks. Nightma12 were you really born in 1991? so was i...

[Updated on: Sun, 16 July 2006 12:15]

Report message to a moderator

Re: new fds bot, c++ php, perl [message #208554 is a reply to message #207285] Mon, 17 July 2006 13:45 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
i have run into another problem, i have programmed my bot so far to get the date, open the file ssaow_<month>-<day>-<year>.txt read it delete it, print it out. it works when i put the file there myself. but not when i put it in the server dir why is this?
here is some code:
bool find_new_text(string &line)
{
	string st;
	string day, mon, year;
	get_date(day, mon, year);
	st.assign("ssaow_"+mon+"-"+day+"-"+year+".txt");
	ifstream file;
	file.open(st.c_str(), ios::in);
	char buf[50];
	if(file.is_open())
	{
		file.getline(buf, 50);
		line.assign(buf);
		file.close();
		unlink(st.c_str());
		return 1;
	}
	else
	{
		return 0;
	}
	return 0;

}
void pre_parse()
{
	string find;
	while(1)
	{
		if(find_new_text(find))
		{
			parse(find);
			find.clear();
		}
	}
}
void parse(string line)
{
	stringstream strs;
	int f = 11;
	while(f != line.size())
	{
		strs << line[f++];
	}
	cout << endl << strs.str();
}


parse() at the moment removes 11 chars from the beggining of the string and prints it.

pre_parse() is the function called;

the debug error i get is:

Debug Assertion Failed

Program: C:\Westwood\RenegadeFDS\Server\bot.exe
File: .\string
Line: 1508

Expression: string subscript out of range

why would it do this if i create the file manually and it works?
Re: new fds bot, c++ php, perl [message #208556 is a reply to message #207285] Mon, 17 July 2006 14:11 Go to previous messageGo to next message
Nightma12 is currently offline  Nightma12
Messages: 2593
Registered: August 2003
Karma: 0
General (2 Stars)
Category Moderator
erm, ewww

just run NR and code your own scripts Dont Get It
Re: new fds bot, c++ php, perl [message #208560 is a reply to message #207285] Mon, 17 July 2006 14:35 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
lol, i will figure it out probly to be, somthing small. iv started it now and i don't want to give up.
Re: new fds bot, c++ php, perl [message #208585 is a reply to message #208554] Mon, 17 July 2006 19:23 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
help-linux wrote on Mon, 17 July 2006 21:45


bool find_new_text(string &line)
{
	string st;
	string day, mon, year;
	get_date(day, mon, year);
	st.assign("ssaow_"+mon+"-"+day+"-"+year+".txt");
	ifstream file;
	file.open(st.c_str(), ios::in);
	char buf[50];
	if(file.is_open())
	{
		file.getline(buf, 50);
		line.assign(buf);
		file.close();
		if(remove(line.c_str()) == -1)
                {
                        cout << "could not delete";   //Changed this
                }
		return 1;
	}
	else
	{
		return 0;
	}
	return 0;

}
void pre_parse()
{
	string find;
	while(1)
	{
		if(find_new_text(find))
		{
			parse(find);
			find.clear();
		}
	}
}
void parse(string line)
{
	stringstream strs;
	int f = 11;
        if(!line.enpty())  // added this
        {
	          while(f != line.size())
	          {
		         strs << line[f++];
	          }
        }
	cout << endl << strs.str();
}




it works now, i will be posting code next week i hope!
Re: new fds bot, c++ php, perl [message #208644 is a reply to message #207285] Tue, 18 July 2006 09:16 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
here is a screen shot of it just getting the messages from the server and printing them.

btw sorry about large screen shot.
  • Attachment: working.bmp
    (Size: 2.25MB, Downloaded 116 times)
Re: new fds bot, c++ php, perl [message #208678 is a reply to message #208644] Tue, 18 July 2006 14:34 Go to previous messageGo to next message
Cat998
Messages: 1081
Registered: January 2004
Location: Austria, Vienna
Karma: 0
General (1 Star)
Moderator/Captain

help-linux wrote on Tue, 18 July 2006 18:16

here is a screen shot of it just getting the messages from the server and printing them.

btw sorry about large screen shot.


Use the jpg format the next time ^^ (compression)

However, logging reading sucks, why reading something from a file

that is already in the memory ?

Download the scripts 2.8 source:


http://sourceforge.net/projects/rentools


There is a chathook which allows you to get all the F2/F3 messages

in realtime without any stupid logfile reading.


When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter then "Yes"

Programming is like sex: one mistake and you have to support it for the rest of your life

Want the best answers? Ask the best questions!

"So long, and thanks for all the fish."
Re: new fds bot, c++ php, perl [message #208693 is a reply to message #207285] Tue, 18 July 2006 16:33 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
i have the source to and the dll for scripts 2.8 and i cannot find a function/class for this.

i have it working now, but i do want to use a chathook, im not using it if it needs ridiculouse pointers and variables to use. i also cannot use it if i have to "fork" the code. (not in the dirty way you are thinking). at the mo i have sounds working and availible to download as a beta.

Remember this is only a BETA so it will have bugs. read the readme before using, please.

oh and Nightma12 i used your FDSTalk.exe i have included the readme, but if you don't want me to use it just say!

Download is less than 100kb so please give it a try.
  • Attachment: H-L BOT.zip
    (Size: 96.82KB, Downloaded 73 times)
Re: new fds bot, c++ php, perl [message #208762 is a reply to message #207285] Tue, 18 July 2006 23:02 Go to previous messageGo to next message
Cat998
Messages: 1081
Registered: January 2004
Location: Austria, Vienna
Karma: 0
General (1 Star)
Moderator/Captain

It's pretty easy, just create a function in the form

void Chat(int ID, int Type, const wchar_t *wc_msg) {
}


Then you need to tell the hook, to call your function everytime

someone sends a message with

AddChatHook(Chat);


It's the best when you do this in dllmain.cpp for the beginning (isn't nice, but it does what you want).

you maybe do not want to use widecharacter strings (wchar_t), so

you need to convert it to a normal char* string.

char str[256];
wcstombs(str, wc_msg, 256);

printf("Test: %s\n", str);


When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter then "Yes"

Programming is like sex: one mistake and you have to support it for the rest of your life

Want the best answers? Ask the best questions!

"So long, and thanks for all the fish."

[Updated on: Tue, 18 July 2006 23:03]

Report message to a moderator

Re: new fds bot, c++ php, perl [message #208773 is a reply to message #207285] Wed, 19 July 2006 00:49 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
ty for help, but i cannot het it to comple the is a sytax error that i cannot figure out:

error missing ';' before '*' on line xxx

here is that line:
GameObject *Get_GameObj(int ID); //convert a player ID into a GameObject
Re: new fds bot, c++ php, perl [message #208786 is a reply to message #207285] Wed, 19 July 2006 02:50 Go to previous messageGo to next message
Cat998
Messages: 1081
Registered: January 2004
Location: Austria, Vienna
Karma: 0
General (1 Star)
Moderator/Captain

I need the complete error/building-list.

What Compiler do you use ?


When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter then "Yes"

Programming is like sex: one mistake and you have to support it for the rest of your life

Want the best answers? Ask the best questions!

"So long, and thanks for all the fish."
Re: new fds bot, c++ php, perl [message #208801 is a reply to message #207285] Wed, 19 July 2006 05:04 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
i use visual c++ 2005 express edition. th whole error is:

all of the errors are on that line
  • Attachment: error.JPG
    (Size: 226.88KB, Downloaded 178 times)

[Updated on: Wed, 19 July 2006 05:09]

Report message to a moderator

Re: new fds bot, c++ php, perl [message #208803 is a reply to message #207285] Wed, 19 July 2006 05:55 Go to previous messageGo to next message
Areilius is currently offline  Areilius
Messages: 26
Registered: October 2005
Karma: 0
Recruit
About sending commands, I found that using FDSTalk.dll was waay faster than any command line program.
(The WinRem source might be of use there)

Or you can use SSAOW's DDE thingy, which I dont know much about..

But there might an even better way, using scripts.dll.. I dont know because I couldn't call scripts.dll functions with the noob scripting lang I used for my crappy bot Blush
Re: new fds bot, c++ php, perl [message #208804 is a reply to message #208803] Wed, 19 July 2006 06:04 Go to previous messageGo to next message
Cat998
Messages: 1081
Registered: January 2004
Location: Austria, Vienna
Karma: 0
General (1 Star)
Moderator/Captain

help-linux wrote on Wed, 19 July 2006 14:04

i use visual c++ 2005 express edition. th whole error is:

all of the errors are on that line


It seems you've download an old version of the scripts source.

Download the latest one ( 2.8 )

Also, be sure you have installed the Microsoft SDK which

includes all the windows header files needed to compile it.

Sparkmist wrote on Wed, 19 July 2006 14:55

But there might an even better way, using scripts.dll.. I dont know because I couldn't call scripts.dll functions with the noob scripting lang I used for my crappy bot Blush


It's because it isn't possible to call it from outside


When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter then "Yes"

Programming is like sex: one mistake and you have to support it for the rest of your life

Want the best answers? Ask the best questions!

"So long, and thanks for all the fish."

[Updated on: Wed, 19 July 2006 06:04]

Report message to a moderator

Re: new fds bot, c++ php, perl [message #208817 is a reply to message #207285] Wed, 19 July 2006 09:38 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
just checked and i do use scripts.dll 2.8 i installed sdk pagage for my bot(i need windows.h). can you get it to compile?

i also checked out renrem source and it is in basic (or another )language i don't know. i will stick to fdstalk.exe as it is a good program. i checked blaze regulater as well but that is the same.
Re: new fds bot, c++ php, perl [message #208848 is a reply to message #207285] Wed, 19 July 2006 12:30 Go to previous messageGo to next message
Cat998
Messages: 1081
Registered: January 2004
Location: Austria, Vienna
Karma: 0
General (1 Star)
Moderator/Captain

There are no files called jfwh.h, jfwh2.h, jfwh.h3, jfwh4.h, jfwh5.h in scripts 2.8 Listen

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter then "Yes"

Programming is like sex: one mistake and you have to support it for the rest of your life

Want the best answers? Ask the best questions!

"So long, and thanks for all the fish."
Re: new fds bot, c++ php, perl [message #208858 is a reply to message #207285] Wed, 19 July 2006 13:10 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
i still get errors when i compile, on every cpp script it is looking for a precompiled header
Re: new fds bot, c++ php, perl [message #208872 is a reply to message #207285] Wed, 19 July 2006 13:48 Go to previous messageGo to next message
Cat998
Messages: 1081
Registered: January 2004
Location: Austria, Vienna
Karma: 0
General (1 Star)
Moderator/Captain

Then turn them off, Project --> Scripts settings --> C/C++, anywhere Razz

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter then "Yes"

Programming is like sex: one mistake and you have to support it for the rest of your life

Want the best answers? Ask the best questions!

"So long, and thanks for all the fish."
Re: new fds bot, c++ php, perl [message #208910 is a reply to message #207285] Wed, 19 July 2006 17:01 Go to previous messageGo to previous message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
it wouldn't link. anyway im going to see if i can find or write a lib file because scripts.dll exports all its functions doen't it?

if not, i cannot use it. i will try write my own version of fdstalk.dll
Previous Topic: Can some1 help me
Next Topic: German Need help
Goto Forum:
  


Current Time: Wed Dec 11 14:19:26 MST 2024

Total time taken to generate the page: 0.01422 seconds