Thread

VB: Chat Logging (Sdk)

VB: Chat Logging // Sdk

1  |  

gamer

May 10, 2001, 1:04pm
Hi, I want to write a simple bot that logs all chat within its radius to a
TXT file, I'm not sure how to make it save conents in a text file...would
any be kind enough to lend a hand? :)

-Gamer

grimble

May 10, 2001, 1:22pm
Check out the help files for the "Open", "Close" and "Print #" statements.

How you implement it is up to you really, ... Open the file for OUTPUT and
leave it open all the time you are loggin the chat (closing it at the end of
the task) or, for each chat event, open the file for APPEND, write to it and
then close it again.

If you want to do something a little more interesting, try to log the
messages in an array in memory and then write the whole array to the file
every 2 minutes or so (using APPEND mode and a timer ... and remembering to
clear the array after its been written to file). It will give you give you
check points in your code incase the program crashes, it won't keep opening
and closing the file every time (remember that the whole event handler is
hogging the CPU ... no aw_waits are going while your in it) and, more
importantly, it will give you something a bit more taxing/fun to do.

Grims.



[View Quote]

gamer

May 10, 2001, 1:38pm
I see whacha mean, I was thinking help more in a way of code though, thanks!
:)

[View Quote]

grimble

May 10, 2001, 3:37pm
Well maybe you should try and write some first using the pointers you have
been given before getting other people to do the work for you. Geesh!



[View Quote]

gamer

May 10, 2001, 3:48pm
hehe, as it happens I have have a go : )

ok so enter the code to open, print, close the text file each time someone
speaks...and when someone speaks i get a compile error saying i have
declared log.txt (my log file) as a variable....why does it think its a
variable?

also once i fix that...if i do Open #1 Print #1 Close #1....wont that write
over the last string as a new one is added? how can i make it log like a AW
chat file? :o)

-Gamer

[View Quote]

moria

May 10, 2001, 4:11pm
have a look in the manual under open for append rather than just open

Moria


[View Quote]

grimble

May 10, 2001, 7:53pm
Hey guess what !! I have just read a post that tells you what to look in
the help files under ... You might recognise it, but I pasted it in below
anyway. You may find paragraph 2 especially relevant.

-------------------------

grimble <grimble2000 at btinternet.com> wrote ...

Check out the help files for the "Open", "Close" and "Print #" statements.

How you implement it is up to you really, ... Open the file for OUTPUT and
leave it open all the time you are loggin the chat (closing it at the end of
the task) or, for each chat event, open the file for APPEND, write to it and
then close it again.

If you want to do something a little more interesting, try to log the
messages in an array in memory and then write the whole array to the file
every 2 minutes or so (using APPEND mode and a timer ... and remembering to
clear the array after its been written to file). It will give you give you
check points in your code incase the program crashes, it won't keep opening
and closing the file every time (remember that the whole event handler is
hogging the CPU ... no aw_waits are going while your in it) and, more
importantly, it will give you something a bit more taxing/fun to do.

Grims.

gamer

May 11, 2001, 4:23am
lol, keep trying grimble, its very almost getting through my skull, shoulda
listened to ya the first time :o)

[View Quote]

brant

May 11, 2001, 11:36pm
There's another way to do what you're asking besides using the "Open",
"Close", etc. commands. If you look in the MSDN library that comes
with VB, there's an object called the FileSystemObject, which, when
created and associated with a file, makes editing files easier. For
example, if you declared object a as one of these objects, then you
could simply say:

f$ = a.readall()

to read all of the text in a file into a string. The statements
a.read(), a.write(), etc. would also work.

I would cut and paste the documentation here, but it's on the other
computer, which someone else is currently using.

kah

May 12, 2001, 9:05am
Tip: if you want the latest, up-to-date info, use MSDN Online :-))
http://msdn.microsoft.com

KAH

[View Quote]

grimble

May 12, 2001, 9:19am
Hmmm ... this is true ... but I'm not sure gamer wants to get into the
nasties of OLE right now with the issues it can cause with distribution.
However, this would work (within buffer/memory limitations) too.

Grims

[View Quote]

1  |  
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2022. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn