Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » read gamelog from scripts.dll
read gamelog from scripts.dll [message #205903] Wed, 28 June 2006 16:07 Go to next message
sycar is currently offline  sycar
Messages: 144
Registered: February 2006
Location: Reading, UK
Karma: 0
Recruit
i know its possible im just not sure how so if someone could point me in the right direction or give me some example code that would be great!

but how can i get the scripts.dll to read the gamelogs, basically i want to create my own custom commands in scripts.dll so you get the idea.

Cheers buffymaniack
Re: read gamelog from scripts.dll [message #205917 is a reply to message #205903] Wed, 28 June 2006 16:54 Go to previous messageGo to next message
theplague is currently offline  theplague
Messages: 261
Registered: May 2004
Karma: 0
Recruit
well, heres a clue, you gotta do it line, by line. As in, everytime you read it, you gotta load the whole file, then set the position you wanna read from.

long last_line = 0;
ifstream gamelog("example_gamelog_name.txt"); // gamelog names do change, your gonna have to generate the correct names
if (gamelog.is_open()) {
  std::string line;
  gamelog.seekg (last_line, ios::beg); // puts it back to the last read position
  while (!gamelog.eof()) { // reads until the end of file is reached
    getline(gamelog,line); // saves a line into a string 'line' to do with as you wish
  }
  gamelog.seekg(0, ios::end); // sets the pointer to the last point in the file
  last_line = gamelog.tellg(); // saves the last point into the variable 'last_line'
} else {
  printf("Error occured, gamelog unreadable.\n");
}


and all this could be within a function and called every X time period, or whenever checking of new lines is needed.


http://users.tpg.com.au/ling44/av_firefox.gifhttp://users.tpg.com.au/ling44/av_rg.gif

[Updated on: Wed, 28 June 2006 16:55]

Report message to a moderator

Re: read gamelog from scripts.dll [message #205919 is a reply to message #205903] Wed, 28 June 2006 17:11 Go to previous messageGo to next message
Whitedragon is currently offline  Whitedragon
Messages: 832
Registered: February 2003
Location: California
Karma: 1
Colonel
Reading gamelog from scripts.dll is pointless. All the information that is in gamelog is available through various scripts.dll functions that your stuff can also use.

Black-Cell.net
Network Administrator (2003 - )

DragonServ, Renegade's first IRC interface bot
Creator and lead coder (2002 - )

Dragonade, Renegade's first server side modification
Lead coder (2005 - )
Re: read gamelog from scripts.dll [message #205931 is a reply to message #205903] Wed, 28 June 2006 19:32 Go to previous messageGo to next message
theplague is currently offline  theplague
Messages: 261
Registered: May 2004
Karma: 0
Recruit
-_- yes, the awsome page and player leave hooks...

theres a hack way around the player leave, but page is just, from what i can see, not possible


http://users.tpg.com.au/ling44/av_firefox.gifhttp://users.tpg.com.au/ling44/av_rg.gif

[Updated on: Wed, 28 June 2006 19:33]

Report message to a moderator

Re: read gamelog from scripts.dll [message #205959 is a reply to message #205903] Wed, 28 June 2006 22:00 Go to previous messageGo to next message
Whitedragon is currently offline  Whitedragon
Messages: 832
Registered: February 2003
Location: California
Karma: 1
Colonel
Those arent in gamelog either.

Black-Cell.net
Network Administrator (2003 - )

DragonServ, Renegade's first IRC interface bot
Creator and lead coder (2002 - )

Dragonade, Renegade's first server side modification
Lead coder (2005 - )
Re: read gamelog from scripts.dll [message #205960 is a reply to message #205903] Wed, 28 June 2006 22:03 Go to previous messageGo to next message
Whitedragon is currently offline  Whitedragon
Messages: 832
Registered: February 2003
Location: California
Karma: 1
Colonel
Those arent in gamelog either.

Black-Cell.net
Network Administrator (2003 - )

DragonServ, Renegade's first IRC interface bot
Creator and lead coder (2002 - )

Dragonade, Renegade's first server side modification
Lead coder (2005 - )
Re: read gamelog from scripts.dll [message #206049 is a reply to message #205903] Thu, 29 June 2006 15:09 Go to previous messageGo to next message
sycar is currently offline  sycar
Messages: 144
Registered: February 2006
Location: Reading, UK
Karma: 0
Recruit
sorry my mistake when i said gamelog, i actually meant renlog so i can view chat etc. and create a on command system for example custom kill commands etc. so i can go about getting it to view the renlog and if a certain command is there it will perform what i want it to.

But how within scripts.dll can i get it to run that function every 10 seconds or something. I mean im familiar with loops etc. im just unsure how to get it to run a function within a .dll every x amount of secs.

Thanks buffymaniack
Re: read gamelog from scripts.dll [message #206059 is a reply to message #205903] Thu, 29 June 2006 16:12 Go to previous messageGo to next message
jonwil is currently offline  jonwil
Messages: 3557
Registered: February 2003
Karma: 0
General (3 Stars)

For 2.9, I am going to add a hook that will get called everytime something is written to the console. Maybe you could use that to get your "renlog" parsing.


Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
Re: read gamelog from scripts.dll [message #206081 is a reply to message #205903] Fri, 30 June 2006 00:14 Go to previous messageGo to next message
dead6re is currently offline  dead6re
Messages: 602
Registered: September 2003
Karma: 0
Colonel
If you want to check the text that someone is saying, have a look at the Chat Hook.

Let all your wishes be granted except one, so you will still have something to strieve for.
Re: read gamelog from scripts.dll [message #206181 is a reply to message #205903] Fri, 30 June 2006 18:40 Go to previous messageGo to next message
theplague is currently offline  theplague
Messages: 261
Registered: May 2004
Karma: 0
Recruit
wd, i made a mistake about the page's but player leave is in the renlog. page is in the bhs logs, which is still a log.

what confuses me is if bhs.dll can get pages, why can't it be made into a hook? or is there a deeper reason?

Chathook
AddChatHook(hook); /* add this someplace at the execution of the scripts,
like in dllmain's section where it loads the bhs.dll functions
and stuff. or even when ObjectHookClass's start is called*/

const char *WideCharToChar(const wchar_t *wcs); // this is in engine.h/.cpp so no need to redo the whole body
void hook(int id, int type, const wchar_t *msg) {
  // type 0 = normal chat
  // type 1 = team chat
  if (type == 2) return; // don't want ppage's to show as chat
  std::string text = WideCharToChar(msg);
  // phrase the message
}


http://users.tpg.com.au/ling44/av_firefox.gifhttp://users.tpg.com.au/ling44/av_rg.gif

[Updated on: Fri, 30 June 2006 18:46]

Report message to a moderator

Re: read gamelog from scripts.dll [message #206207 is a reply to message #205903] Sat, 01 July 2006 03:08 Go to previous message
sycar is currently offline  sycar
Messages: 144
Registered: February 2006
Location: Reading, UK
Karma: 0
Recruit
ok thanks for that, i found that the ssaow already claims the right to the chat hook, and from bhs.txt says only one hook can be in use at one time, so i guess I'll have to embed it inside the ssaow chat hook.

unless anyone knows different?
thanks buffymaniack
Previous Topic: function on launch
Next Topic: BuggyCross Founded Try it out today !!!!
Goto Forum:
  


Current Time: Wed Dec 04 17:40:16 MST 2024

Total time taken to generate the page: 0.00865 seconds