<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) > UBound(varWorlds) Or (%1 - 1) < LBound(varWorlds) Then
Note "This world number does not exist!"
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.
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
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...
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.