MC crash

Posted by Poromenos on Fri 05 Sep 2003 11:40 PM — 10 posts, 23,372 views.

Greece #0

<aliases>
  <alias
   match="^sw[ ]+(\d)$"
   enabled="y"
   regexp="y"
   send_to="12"
   ignore_case="y"
   keep_evaluating="y"
   sequence="100"
  >
  <send>Dim wrlWorld
Dim varWorlds

varWorlds = GetWorldIdList
If (%1 - 1) &gt; UBound(varWorlds) Or (%1 - 1) &lt; LBound(varWorlds) Then
    Note &quot;This world number does not exist!&quot;
Else
    Set wrlWorld = GetWorldById(varWorlds(%1 - 1))
    World.PushCommand
    World.Disconnect
    wrlWorld.Connect
    wrlWorld.Activate
End If
</send>
  </alias>
</aliases>

This SOMETIMES crashes MC. The world number is valid, by the way.
Amended on Fri 05 Sep 2003 11:41 PM by Poromenos
Australia Forum Administrator #1
There is a known bug that new worlds (ones that are not yet saved) are not yet allocated an ID, and thus the GetWorldIdList will return blank for such worlds.

This means the getworldbyid will fail. I would add this test:


if wrlWorld is nothing then
   world.note "World has not been saved"
else
  ' blah blah
end if 

Greece #2
No, there aren't new worlds there... I have 2 open worlds that have been saved, I switch between them about 4-5 times, and then, all of a sudden, it crashes...
Australia Forum Administrator #3
I would still put the test in.
Greece #4
I will put the test in, but why does it return null when it's not supposed to?
Australia Forum Administrator #5
I cannot explain that, but the spec for GetWorldByID says "In Vbscript use the test "is nothing" to see if the reference is to a valid world.".
Greece #6
Added it, still crashes...
Australia Forum Administrator #7
Don't know. It shouldn't, but ...

If you can give me steps to reliably reproduce it I will try to work out why.
Greece #8
Yes, add the alias and try it between two worlds lots of times :P That's what mine does... Crashes once in about 50 times...
Australia Forum Administrator #9
I tried it hundreds of times without a crash. Perhaps you have some script that runs on world activate or something like that, that is causing the crash.

You could try a couple of empty worlds, with that alias and nothing at all else, and see if it still happens. If not, I suggest you check elsewhere.