Alright, I'm going insane here. I play a graphical MUCK, and use MUSHclient for my 'bots' on it. I have a sparring place, the bots regulate the battles, allow you to buy new weapons, armor, saying how much damage you hit for, etc. I recently upgraded all of them to change the way they store stats, making it so a user's stats are stored in a file, and through VBScript, each bot can access the stats, alter them, and so forth. Things work fine, until all of a sudden sometimes one of the bots crash, giving me an error like this:
MUSHCLIENT caused an invalid page fault in
module MUSHCLIENT.EXE at 0167:0046f1af.
Registers:
EAX=00fc0078 CS=0167 EIP=0046f1af EFLGS=00010212
EBX=000000c2 SS=016f ESP=0077ef44 EBP=0077ef64
ECX=2fa80000 DS=016f ESI=00000000 FS=504f
EDX=0201004b ES=016f EDI=0000000b GS=0000
Bytes at CS:EIP:
89 4a 04 8b 4d f8 8b 51 04 8b 49 08 89 4a 08 8b
Stack dump:
00000054 010d44e0 010069a8 00000000 00fc01bc 000000c2 010d44aa 00000032 0077ef8c 00468bd6 010c000c 00000002 010d44e0 0047bd45 010d44e0 0041cd07
What causes this kind of error? The only thing I can imagine is that two of the bots must be trying to access the same file at the same time, or something? The funny thing is the bot I made purely in C has no problem. Here's an example of reading, and writing, that the bots use.
set fileo=createobject("scripting.filesystemobject")
set filen=fileo.opentextfile("c:\windows\desktop\filecrap\stats\" & getvarname(mid(vars(1), 14)), 1, true)
if (filen.atendofstream><true) then holderblah=filen.readall
filen.close
vars(1) is the string containing the user's name, getvarname is a function that changes the name to be file-safe (i.e. it will change any special characters not allowed in filenames to _)
set fileo=createobject("scripting.filesystemobject")
...
holderblah=world.getvariable("space1stats")
set filen=fileo.opentextfile("c:\windows\desktop\filecrap\stats\" & getvarname(world.getvariable("space1")), 2, true)
filen.write holderblah
filen.close
space1stats was the MUSH variable the person's stats were stored in for the battle, space1 is the MUSH variable that has their name..
Any ideas..? Am I doing something wrong? Or is it just that you can't have 4 bots trying to use the same files at once? |