Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ VBscript
➜ Invalid Page Fault
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Talon
(4 posts) Bio
|
| Date
| Fri 12 Jul 2002 09:11 PM (UTC) |
| Message
| 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? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Fri 12 Jul 2002 10:00 PM (UTC) |
| Message
| I would check that the createobject and opentextfile actually worked. I don't have the docs in front of me right now, but it would be something like:
if not IsNull (filen) then
' blah blah
end if
(You might need IsEmpty instead of IsNull, see what OpenTextFile returns in case of error). |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Talon
(4 posts) Bio
|
| Date
| Reply #2 on Sat 13 Jul 2002 07:55 AM (UTC) |
| Message
| | Well, I tried using IsNull, and IsEmpty, I couldn't find any documentation on what OpenTextFile returns so I tried both and neither of them worked. What really REALLY makes the whole mess stranger is that I created two blank bots, put in just the simplest of script, for writing and reading. I played with them, messing with the code and getting them to read and write at the same times as each other, I got a few script errors, like 'Permission Denied', which is actually good.. I got NO crashes on the simple bots. Any other suggestions? If it's not the bots reading/writing at the same time, and it's not a full hard drive (I tried moving all the stat files to my other hard drive, no luck..) what else could it be? I hate bugs like this! | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Thu 01 Aug 2002 01:45 AM (UTC) |
| Message
| Strangely enough, I cannot see any reference myself to how the opentextfile method handles failure. This is very strange, surely you would expect that a file could not be opened, because it wasn't there, insufficient privileges, or was in use.
All the examples in the MSDN documentation assume that the call will work, an assumption I would not personally make.
All I can suggest for now is doing it a different way, eg. using plugins with their serialization, writing a COM object, using variables or something like that. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Prashanth
(1 post) Bio
|
| Date
| Reply #4 on Tue 24 Jan 2006 05:05 AM (UTC) |
| Message
| My vbscript code giving error "File could not opened" when i am trying to upload any file
i'm using this code
<SCRIPT language="vbscript">
function ReadBinaryFile(FileName)
on error resume next
Const adTypeBinary = 1
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")
BinaryStream.Type = adTypeBinary
BinaryStream.Open
on error resume next
BinaryStream.LoadFromFile FileName
if Err.number<> 0 then
msgbox(Err.Description )
boolFileExists = false
ReadBinaryFile = ""
exit function
end if
alert(BinaryStream.ReadText)
ReadBinaryFile = BinaryStream.Read
exit function
Msgbox("File Dosen't Exist")
end function
plz.. help me... | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #5 on Tue 24 Jan 2006 05:27 AM (UTC) |
| Message
| This is nothing to do with MUSHclient or invalid page faults is it?
By the looks you are working on a web page with imbedded VBscript. I suggest posting on a forum that deals with VBscript in web pages. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
19,956 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top