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 message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
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 #208347 is a reply to message #207285] |
Sun, 16 July 2006 02:33 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
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 #208397 is a reply to message #207285] |
Sun, 16 July 2006 10:32 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/avatars/gosticon 0000.jpeg) |
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](images/smiley_icons/icon_wink.gif)
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 message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/avatars/gosticon 0000.jpeg) |
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 #208585 is a reply to message #208554] |
Mon, 17 July 2006 19:23 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/avatars/gosticon 0000.jpeg) |
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 #208762 is a reply to message #207285] |
Tue, 18 July 2006 23:02 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/1976.png) |
Cat998
Messages: 1081 Registered: January 2004 Location: Austria, Vienna
Karma: 0
|
General (1 Star) Moderator/Captain |
![171832178](/theme/Renegade_Forums/images/icq.png) ![berni2288](/theme/Renegade_Forums/images/yahoo.png)
|
|
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
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 #208804 is a reply to message #208803] |
Wed, 19 July 2006 06:04 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/1976.png) |
Cat998
Messages: 1081 Registered: January 2004 Location: Austria, Vienna
Karma: 0
|
General (1 Star) Moderator/Captain |
![171832178](/theme/Renegade_Forums/images/icq.png) ![berni2288](/theme/Renegade_Forums/images/yahoo.png)
|
|
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
|
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
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Tue Aug 20 15:13:49 MST 2024
Total time taken to generate the page: 0.01760 seconds
|